Why is BoundaryMesh returning zero vertices and zero cells for a gmsh generated mesh?


43
views
1
6 weeks ago by
Nick  
I have been using BoundaryMesh with ale.move to update a deforming mesh. This has been working fine for a square as a test geometry. However, when I imported a more complex geometry from gmsh this stopped working.

Using BoundaryMesh on the gmsh file gives:
from __future__ import print_function
from dolfin import *

#Mesh created in gmsh
meshName = "gmsh_mesh"
mesh1 = Mesh(meshName+'.xml')
subdomains = MeshFunction('size_t',mesh1,meshName+'_physical_region.xml') 
boundaries = MeshFunction("size_t",mesh1,meshName+'_facet_region.xml')
bmesh1 = BoundaryMesh(mesh1,'exterior')
print(bmesh1)​

<Mesh of topological dimension 1 (intervals) with 0 vertices and 0 cells, ordered>​

However, on a simple test square BoundaryMesh works:
from __future__ import print_function
from dolfin import *

#Test mesh
mesh_test = UnitSquareMesh(2,2)
meshFile=File('mesh_test.xml')
meshFile<<mesh_test
mesh2 = Mesh('mesh.xml')
bmesh2 = BoundaryMesh(mesh2, 'exterior')
print(bmesh2)​

<Mesh of topological dimension 1 (intervals) with 8 vertices and 8 cells, ordered>​

I would appreciate any help on why this is happening. I am using version 2017.2.0 on Docker.




Minimum working test code:
from __future__ import print_function
from dolfin import *

#Mesh created in gmsh
meshName = "gmsh_mesh"
mesh1 = Mesh(meshName+'.xml')
subdomains = MeshFunction('size_t',mesh1,meshName+'_physical_region.xml') 
boundaries = MeshFunction("size_t",mesh1,meshName+'_facet_region.xml')
bmesh1 = BoundaryMesh(mesh1,'exterior')
print(bmesh1)

#Test mesh
mesh_test = UnitSquareMesh(2,2)
meshFile=File('mesh_test.xml')
meshFile<<mesh_test
mesh2 = Mesh('mesh.xml')
bmesh2 = BoundaryMesh(mesh2, 'exterior')
print(bmesh2)
​


File attached: gmsh_mesh.xml (13.96 KB)

File attached: gmsh_mesh_facet_region.xml (4.63 KB)

File attached: gmsh_mesh_physical_region.xml (5.24 KB)

Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »