Question on "ghost_mode"

Hi everyone,

I have a short question about the ghost mode in (legacy) FEniCS. I have a setup with some internal facets, which I have to intergrate over. Just using

assemble(Constant(1)*dS)

threw an exception of the form

*** -------------------------------------------------------------------------
*** Error:   Unable to assemble form.
*** Reason:  Incorrect mesh ghost mode "none" (expected "shared_vertex" or "shared_facet" for interior facet integrals in parallel).
*** Where:   This error was encountered inside AssemblerBase.cpp.
*** Process: 10
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset:  3ea2183fbfe7277de9f16cbe1a9ffaab133ba1fa
*** -------------------------------------------------------------------------

Of course, this can be fixed by adding either

parameters["ghost_mode"] = "shared_vertex"

or

parameters["ghost_mode"] = "shared_facet"

before importing the mesh. Just for my understanding: Are there any fundamental differences between these two modes and what are those? Is one to be preferred over the other?

Or are these just two equivalent models of sharing the ghosted data?

Thanks a lot in advance,
Sebastian

shared_vertex shares every cell with a neighbouring process if it contains a vertex from another processes. This is more expensive to compute (and adds more communciation) than shared_facet, but is required in certain use-cases. For computing dS integrals, you only require to use shared_facet.

Great, thanks a lot. This answers my question :wink: