Generate Sub Mesh in Parallel


146
views
1
8 weeks ago by
Birkan  
Dear all,

When I try to generate a submesh in parallel, it fails. Do you know if this can be done? I will use this submesh to solve a problem. If not, is there a way to generate the mesh with single cpu but run the solution in parallel?

The error message is below:
*** Error: Unable to perform operation in parallel.
*** Reason: SubMesh::init is not yet working in parallel.

The command I use to run in parallel is:
mpiexec -n 2 python *.py

The code is below:

from fenics import *

# Generate mesh
mesh = RectangleMesh(Point(-1.1,-1.1), Point(1.1,1.1), 32, 32,'crossed')

# Define subdomains
class outerbound(SubDomain):
    def inside(self, x, on_boundary):
         return (x[0]>0.0)
sub_domains=MeshFunction('size_t', mesh, mesh.topology().dim() - 0)
sub_domains.set_all(0)
obound=outerbound()
obound.mark(sub_domains,1)

# Generate sub mesh
smesh=SubMesh(mesh,sub_domains,0)
​

Thank you,
Birkan
Community: FEniCS Project

3 Answers


4
8 weeks ago by
Emek  
Hi,

try to use submesh from cbc post (see https://cbcpost.readthedocs.io/en/latest/ )

from cbcpost.utils import create_submesh
smesh = create_submesh(mesh, subdomains, 0)

Best, Emek
Hi Emek,

Worked well. Thank you.

Birkan
written 7 weeks ago by Birkan  
0
7 weeks ago by
Birkan  
I just realized there is a problem with this lib. I solved heat equation with the submesh with single and double cores.

What I get for a single core is correct and is the following:


What I get with double core is :

The problem is the Dirichlet boundary condition is also applied to the nodes at zero x axis. Submesh is generating an extra boundary at the interface of two cores. See marked boundaries where there is an extra boundary in the center:



Any suggestions? Can we merge boundaries in fenics?

Thanks
Birkan

0
7 weeks ago by
Hello,
Check this post that deal with a similar inter-boundary issue. Make sure to use 'on_boundary' when you define your facets.
https://www.allanswered.com/post/jrwmw/behavioir-of-set_all-for-facetfunction-in-mpi/
Best
Francois.
No, it is not related to set all. There is something different. I will post when I solve it.

Thanks
written 5 weeks ago by Birkan  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »