<div dir="ltr"><div dir="ltr">On Tue, Jan 11, 2022 at 2:59 PM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com">thibault.bridelbertomeu@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Le mar. 11 janv. 2022 à 16:36, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> a écrit :<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a>> writes:<br>
<br>
> Hello everybody,<br>
><br>
> So, let's say i have the mesh attached to this email that has 2 physical<br>
> surfaces and 5 physical curves. This gives me 2 strata in the "Cell Sets"<br>
> and 5 strata in the "Face Sets".<br>
> Would something like the following piece of code be the right way to<br>
> "extract" and manipulate each stratum of the "Cell Sets" to assign them a<br>
> DS, a TS etc...?<br>
><br>
>     DMLabel surfacesLabel;    ierr = DMGetLabel(dm, "Cell Sets",<br>
> &surfacesLabel);CHKERRQ(ierr);    IS fluidIS;    ierr =<br>
> DMLabelGetStratumIS(surfacesLabel, 2, &fluidIS);CHKERRQ(ierr);<br>
> DMLabel fluidLabel;    ierr = DMLabelCreate(PETSC_COMM_WORLD, "Fluid",<br>
> &fluidLabel);CHKERRQ(ierr);    ierr = DMLabelSetStratumIS(fluidLabel,<br>
> 1, fluidIS);CHKERRQ(ierr);<br>
><br>
> Once I have the Fluid label linked to the fluidIS (same for the<br>
> solid), should I call DMPlexLabelComplete on both the labels before<br>
> proceeding and calling the DMCreateSubDM with their IS ?<br>
<br>
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.<br></blockquote><div><br></div><div>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.</div><div>I do not get why you mention a surface integral though ?</div><div>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.</div></div></div></blockquote><div><br></div><div>Hmm, let's start here because that does not make sense to me. Can you write down the mathematical model? Usually I think of temperature as being</div><div>a continuous field. I have only seen discontinuities for rareified gases.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>For now, I am trying to figure out how to handle both discretizations, and I am going the following way :</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap"><div><span style="color:rgb(106,153,85)">    // Set up the discrete systems for both domains</span></div><div><span style="color:rgb(106,153,85)">    //+ Fluid is finite volumes</span></div><div>    PetscFV fluidFV;</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFVCreate</span>(<span style="color:rgb(220,220,170)">PetscObjectComm</span>((PetscObject) dm), &fluidFV);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    <span style="color:rgb(156,220,254)">user</span>-><span style="color:rgb(156,220,254)">dof</span> = <span style="color:rgb(181,206,168)">4</span>;</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFVSetNumComponents</span>(fluidFV, <span style="color:rgb(156,220,254)">user</span>-><span style="color:rgb(156,220,254)">dof</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    PetscInt dim;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMGetDimension</span>(dm, &dim);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFVSetSpatialDimension</span>(fluidFV, dim);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscObjectSetName</span>((PetscObject) fluidFV, <span style="color:rgb(206,145,120)">"EulerEquation"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFVSetType</span>(fluidFV, PETSCFVLEASTSQUARES);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFVSetComputeGradients</span>(fluidFV, PETSC_FALSE);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    PetscInt fluidFieldNum = <span style="color:rgb(181,206,168)">0</span>;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMSetField</span>(dm, fluidFieldNum, fluidLabel, (PetscObject) fluidFV);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">DMViewFromOptions</span>(dm, <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(206,145,120)">"-dm_fv_view"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div><span style="color:rgb(106,153,85)">    //+ Solid is finite elements</span></div><div>    PetscBool simplex;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMPlexIsSimplex</span>(dm, &simplex);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    PetscFE solidFE;</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFECreateDefault</span>(<span style="color:rgb(220,220,170)">PetscObjectComm</span>((PetscObject) dm), dim, <span style="color:rgb(181,206,168)">1</span>, simplex, <span style="color:rgb(206,145,120)">"heateqn_"</span>, -<span style="color:rgb(181,206,168)">1</span>, &solidFE);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscObjectSetName</span>((PetscObject) solidFE, <span style="color:rgb(206,145,120)">"HeatEquation"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    PetscInt solidFieldNum = <span style="color:rgb(181,206,168)">1</span>;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMSetField</span>(dm, solidFieldNum, solidLabel, (PetscObject) solidFE);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscFEDestroy</span>(&solidFE);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">DMViewFromOptions</span>(dm, <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(206,145,120)">"-dm_fe_view"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div><span style="color:rgb(106,153,85)">    // //+ Sub-DM for the fluid domain</span></div><div><span style="color:rgb(106,153,85)">    // DM fluidDM;</span></div><div><span style="color:rgb(106,153,85)">    // IS subFluidIS;</span></div><div><span style="color:rgb(106,153,85)">    // ierr = DMCreateSubDM(dm, 1, &fluidFieldNum, &subFluidIS, &fluidDM);CHKERRQ(ierr);</span></div><div><span style="color:rgb(106,153,85)">    // ierr = DMViewFromOptions(fluidDM, NULL, "-fluid_dm_view");CHKERRQ(ierr);</span></div><div><span style="color:rgb(106,153,85)">    // //+ Sub-DM for the solid domain</span></div><div><span style="color:rgb(106,153,85)">    // DM solidDM;</span></div><div><span style="color:rgb(106,153,85)">    // IS subSolidIS;</span></div><div><span style="color:rgb(106,153,85)">    // ierr = DMCreateSubDM(dm, 1, &solidFieldNum, &subSolidIS, &solidDM);CHKERRQ(ierr);</span></div><div><span style="color:rgb(106,153,85)">    // ierr = DMViewFromOptions(solidDM, NULL, "-solid_dm_view");CHKERRQ(ierr);</span></div><div><span style="color:rgb(106,153,85)">    //+ Create the DS covering both domains</span></div><div>    ierr = <span style="color:rgb(220,220,170)">DMCreateDS</span>(dm);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">DMViewFromOptions</span>(dm, <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(206,145,120)">"-dm_ds_view"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div><span style="color:rgb(106,153,85)">    //+ Sub-DS for the fluid domain</span></div><div>    PetscDS fluidDS;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMGetRegionNumDS</span>(dm, fluidFieldNum, &fluidLabel, &fluidIS, &fluidDS);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscDSViewFromOptions</span>(fluidDS, <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(206,145,120)">"-fluid_ds_view"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div><span style="color:rgb(106,153,85)">    //+ Sub-DS for the solid domain</span></div><div>    PetscDS solidDS;</div><div>    ierr = <span style="color:rgb(220,220,170)">DMGetRegionNumDS</span>(dm, solidFieldNum, &solidLabel, &solidIS, &solidDS);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div><div>    ierr = <span style="color:rgb(220,220,170)">PetscDSViewFromOptions</span>(solidDS, <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(206,145,120)">"-solid_ds_view"</span>);<span style="color:rgb(220,220,170)">CHKERRQ</span>(ierr);</div></div></div><div><br></div><div>I am not sure where I am going with this for now, I am really experimenting ...</div><div>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.</div><div>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.</div><div>The following step will be to plug in a timestepper, or two timesteppers.</div><div>Then the interface and the connection between the two problems.</div><div><br></div><div>Thanks for your help and all your input, as always !!!!</div><div><br></div><div>Cheers, </div><div>Thibault</div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>