FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
777 stars 182 forks source link

EM demos wrong because Gmsh-created meshes are by default not ghosted #2556

Closed garth-wells closed 1 month ago

garth-wells commented 1 year ago

The EM demos (demo_axis.py, demo_pml.py, maybe more) compute wrong diagnostic quantities because some quantities involve interior facet integrals. Proper computation of interior facet integrals requires meshes to be ghosted by facet. But, gmshio.model_to_mesh by default does not use any ghosting.

We should really be able to tell whether or not the mesh has the required ghosting.

garth-wells commented 1 year ago

@jorgensd thoughts?

jorgensd commented 1 year ago

@jorgensd thoughts?

I guess we should be able to add a check when generating the form that we have the appropriate ghosting (at least for dS integrals).

At least a quick fix for the demos is to set the Ghost mode in the partitioner input to read_from_msh and model_to_mesh https://github.com/FEniCS/dolfinx/blob/main/python/dolfinx/io/gmshio.py#L170 for the two demos