### Behavioir of set_all() for facetfunction in MPI

229
views
1
9 months ago by
Hello,
I have a question about the use of set_all(value) for facetfunction using MPI.
Below is a simple example of my issue with a figure that illustrate it, with mpirun -n 2 *

So basically, i want to mark all the external facets ds with a certain value 10 (so i use set_all), but i do not want the facets between the different partitioned meshes are also marked with this value. If you look at the picture, the arrow shows the facets between the two partitioned meshes, and they have been marked also by set_all(). I would like these facets have the 0 default id, and not 10.

In serial, there is not this problem of course.

Second question related with this issue: what happen if a flux is applied in the variational formulation on the facets marked with this id 10: Is a flux will be applied on these 'internal' facets also?
And what happen also when we do an assemble on this marked surface:  Is the assemble will be performed on these internal facets also ? (EDIT: i have checked it simply by calculting the surface with assemble, with mpirun -n 1 and mpirun -n 2 and exact same area has been calculated: thus the internal facets are not considered - i beleive a flux defined in the variational formulation will also not be affected then, but if someone can confirm it...)

# For any mesh

# Define facet
facets_subdomain = FacetFunction('size_t', mesh)

# Initial marking
facets_subdomain.set_all(10)

# Other markings..
***().mark(facets_subdomain,***)
...

# Plot
plot(facets_subdomain, title='Left active material, interface id, process {}'.format(rank_process), interactive=True)
​

Figure:

Top image: facets id for the process 0,
Bottom image: facets id of the process 1:

Note: The 'green' id 7 has been added later.
The mesh i use for the example is very simple, but in my application the mesh is extremely tortuous, so i use set_all() to mark the complex interface, and then i overwritte some interface (such as the geen one) with simple spatial condition.
So in my case, the use of set_all() is very precious.

Thanks for any help!

Community: FEniCS Project

4
9 months ago by
This is the intended behavior of set_all (see the documentation).

If you want to mark only facets on the boundary try something like this:

from dolfin import *

mesh = BoxMesh(Point(0,0,0), Point(1,1,1), 5, 5, 5)
ff = FacetFunction("size_t", mesh)

class boundary(SubDomain):
def inside(self, x, on_boundary):
return on_boundary

boundary().mark(ff, 10)
plot(ff, interactive=True)​
That was a lightning answer !
And indeed, it works as i want now, thanks you!
written 9 months ago by Francois Usseglio Viretta