[petsc-users] Fluid-Structure interaction with multiple DMPlex

Thibault Bridel-Bertomeu thibault.bridelbertomeu at gmail.com
Tue Jan 11 13:59:02 CST 2022


Le mar. 11 janv. 2022 à 16:36, Jed Brown <jed at jedbrown.org> a écrit :

> Thibault Bridel-Bertomeu <thibault.bridelbertomeu at gmail.com> writes:
>
> > Hello everybody,
> >
> > So, let's say i have the mesh attached to this email that has 2 physical
> > surfaces and 5 physical curves. This gives me 2 strata in the "Cell Sets"
> > and 5 strata in the "Face Sets".
> > Would something like the following piece of code be the right way to
> > "extract" and manipulate each stratum of the "Cell Sets" to assign them a
> > DS, a TS etc...?
> >
> >     DMLabel surfacesLabel;    ierr = DMGetLabel(dm, "Cell Sets",
> > &surfacesLabel);CHKERRQ(ierr);    IS fluidIS;    ierr =
> > DMLabelGetStratumIS(surfacesLabel, 2, &fluidIS);CHKERRQ(ierr);
> > DMLabel fluidLabel;    ierr = DMLabelCreate(PETSC_COMM_WORLD, "Fluid",
> > &fluidLabel);CHKERRQ(ierr);    ierr = DMLabelSetStratumIS(fluidLabel,
> > 1, fluidIS);CHKERRQ(ierr);
> >
> > Once I have the Fluid label linked to the fluidIS (same for the
> > solid), should I call DMPlexLabelComplete on both the labels before
> > proceeding and calling the DMCreateSubDM with their IS ?
>
> How do you want to implement the function space and interface condition?
> As single-valued temperature seen from both sides? With a discontinuous
> space and a surface integral? Euler equations are commonly solved in
> conservative variables, thus you don't have an option of a continuous
> temperature space.
>

A priori, the job of the fluid is to provide a certain heat flux to the
solid that will subsequently warm up. So I am not expecting that both fluid
and solid will have the same temperature at the interface, it will indeed
be discontinuous.
I do not get why you mention a surface integral though ?
Anyways, for now, I do not really know how to handle this boundary
condition problem ... it is one of the _big_ items of my todo list and I
think I'll need your help.

For now, I am trying to figure out how to handle both discretizations, and
I am going the following way :

// Set up the discrete systems for both domains
//+ Fluid is finite volumes
PetscFV fluidFV;
ierr = PetscFVCreate(PetscObjectComm((PetscObject) dm), &fluidFV);CHKERRQ
(ierr);
user->dof = 4;
ierr = PetscFVSetNumComponents(fluidFV, user->dof);CHKERRQ(ierr);
PetscInt dim;
ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr);
ierr = PetscFVSetSpatialDimension(fluidFV, dim);CHKERRQ(ierr);
ierr = PetscObjectSetName((PetscObject) fluidFV, "EulerEquation");CHKERRQ
(ierr);
ierr = PetscFVSetType(fluidFV, PETSCFVLEASTSQUARES);CHKERRQ(ierr);
ierr = PetscFVSetComputeGradients(fluidFV, PETSC_FALSE);CHKERRQ(ierr);
PetscInt fluidFieldNum = 0;
ierr = DMSetField(dm, fluidFieldNum, fluidLabel, (PetscObject) fluidFV);
CHKERRQ(ierr);
ierr = DMViewFromOptions(dm, NULL, "-dm_fv_view");CHKERRQ(ierr);
//+ Solid is finite elements
PetscBool simplex;
ierr = DMPlexIsSimplex(dm, &simplex);CHKERRQ(ierr);
PetscFE solidFE;
ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) dm), dim, 1,
simplex, "heateqn_", -1, &solidFE);CHKERRQ(ierr);
ierr = PetscObjectSetName((PetscObject) solidFE, "HeatEquation");CHKERRQ
(ierr);
PetscInt solidFieldNum = 1;
ierr = DMSetField(dm, solidFieldNum, solidLabel, (PetscObject) solidFE);
CHKERRQ(ierr);
ierr = PetscFEDestroy(&solidFE);CHKERRQ(ierr);
ierr = DMViewFromOptions(dm, NULL, "-dm_fe_view");CHKERRQ(ierr);
// //+ Sub-DM for the fluid domain
// DM fluidDM;
// IS subFluidIS;
// ierr = DMCreateSubDM(dm, 1, &fluidFieldNum, &subFluidIS,
&fluidDM);CHKERRQ(ierr);
// ierr = DMViewFromOptions(fluidDM, NULL, "-fluid_dm_view");CHKERRQ(ierr);
// //+ Sub-DM for the solid domain
// DM solidDM;
// IS subSolidIS;
// ierr = DMCreateSubDM(dm, 1, &solidFieldNum, &subSolidIS,
&solidDM);CHKERRQ(ierr);
// ierr = DMViewFromOptions(solidDM, NULL, "-solid_dm_view");CHKERRQ(ierr);
//+ Create the DS covering both domains
ierr = DMCreateDS(dm);CHKERRQ(ierr);
ierr = DMViewFromOptions(dm, NULL, "-dm_ds_view");CHKERRQ(ierr);
//+ Sub-DS for the fluid domain
PetscDS fluidDS;
ierr = DMGetRegionNumDS(dm, fluidFieldNum, &fluidLabel, &fluidIS, &fluidDS);
CHKERRQ(ierr);
ierr = PetscDSViewFromOptions(fluidDS, NULL, "-fluid_ds_view");CHKERRQ
(ierr);
//+ Sub-DS for the solid domain
PetscDS solidDS;
ierr = DMGetRegionNumDS(dm, solidFieldNum, &solidLabel, &solidIS, &solidDS);
CHKERRQ(ierr);
ierr = PetscDSViewFromOptions(solidDS, NULL, "-solid_ds_view");CHKERRQ
(ierr);

I am not sure where I am going with this for now, I am really experimenting
...
I tried generating two sub-DMs because it seemed to me that, that way, I
could have two TS and basically work my two problems independently and
figure out the interface later. But! When I printed them (with
fluid_dm_view and solid_dm_view), it seemed that something was wrong : the
fluidDM showed a FEM field and both sub DMs appeared to know the whole mesh
and all the strata of all the fields.
The next step is to figure out the FEM for the heat equation -- I have the
details for the FVM in another code, it should be pretty straightforward.
The following step will be to plug in a timestepper, or two timesteppers.
Then the interface and the connection between the two problems.

Thanks for your help and all your input, as always !!!!

Cheers,
Thibault
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220111/97252156/attachment.html>


More information about the petsc-users mailing list