<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Just wanted to give another perspective based on how we might do this in dune-fem:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
the way I would suggest doing this is to store the parameters defining your domain in a</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
discrete function over a `FiniteVolumeSpace`. This gives you then exactly one value per</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
entity (possibly a bit of an overkill since it is a double by default but that could be useful as</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
mention below). Then</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(a) local grid refinement and coarsening is taken care automatically., i.e., the material
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      properties are transferred to the new elements in the mesh when calling grid.adapt()
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(b) (when using Python bindings) you can directly use this discrete function as UFL coefficient       when describing the UFL form using `ufl.conditional`. Unfortunately `ufl.conditional` isn't</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      very nice to use but since I didn't so far have an application I didn't look more into ufl</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      and subdomains. So in fact instead of defining the material property discrete function
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      by setting an integer on each cell I would directly use the finite volume discrete function
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      to store the material properties - at least if this is not prohibitive w.r.t. memory, i.e., it</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      depends on how many material properties have to be set. Assuming it is only a few values</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      (r) then one could setup a finite volume discrete function with range dimension r and</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      directly use that within the ufl expression for the model. Again adaptivity would be handle</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      automatically as mentioned in (a).</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Just some thoughts</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Andreas<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dune <dune-bounces@lists.dune-project.org> on behalf of Christian Engwer <christian.engwer@uni-muenster.de><br>
<b>Sent:</b> 06 April 2020 16:39<br>
<b>To:</b> HELFER Thomas 202608 <thomas.helfer@cea.fr><br>
<b>Cc:</b> dune@lists.dune-project.org <dune@lists.dune-project.org><br>
<b>Subject:</b> Re: [Dune] Handling several materials</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">> In case of adaptative remeshing, would those modules update individual domains, so I<br>
> would not have to care about those technicalities you mentionned ?<br>
<br>
If you use local adaptivity you will always have to make sure your<br>
data is present on the adapted mesh. Usually this requires some<br>
interpolations and so on. In a similar way we now also have to<br>
transfer these indices. And additionaly from the "Gmsh" mesh to your<br>
actual mesh object.<br>
<br>
If you would opt for multidomain or subgrid. Things wuld be<br>
significantly more complecated. You would safe some work, because you<br>
don't transfer the parameters between meshes (as you have exactly one<br>
parameter set per subdomain), but you will have to setup Problems mit<br>
many different subdomains and extract the list of cells in one<br>
subdomain from your gmsh file (so you will need again the initial<br>
indices).<br>
<br>
Ciao<br>
Christian<br>
<br>
_______________________________________________<br>
Dune mailing list<br>
Dune@lists.dune-project.org<br>
<a href="https://lists.dune-project.org/mailman/listinfo/dune">https://lists.dune-project.org/mailman/listinfo/dune</a></div>
</span></font></div>
</body>
</html>