(3D) Mesh generation fails in parallel

I encountered a weird error trying to generate a 3D mesh in parallel. For instance,

from dolfin import *
parameters["ghost_mode"]="shared_facet" # doing calculations with CR/DG later in the code
com = MPI.comm_world
msh = UnitCubeMesh.create(com, [2,2,2], CellType.Type.tetrahedron)  # UnitCubeMesh(2,2,2) also fails

fails when run in parallel. The following are the warnings and error messages

...
...
Process 24: *** Warning: Mesh is empty, unable to create entities of dimension 2.
Process 24: *** Warning: Mesh is empty, unable to create connectivity 2 --> 3.
...
...
 msh = UnitCubeMesh.create(comm,[2,2,2], CellType.Type.tetrahedron)
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to create mesh entity.
*** Reason:  Mesh entity index 0 out of range [0, 0] for entity of dimension 2.
*** Where:   This error was encountered inside MeshEntity.cpp.
*** Process: 108
***
*** DOLFIN version: 2019.1.0
*** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------

It seems to run without any issues in serial. Any pointers as to what could be going wrong ?

Your error is coming from process 24 so I’m assuming you have 24 processes. Your mesh comprises 2 \times 2^3 = 16 cells. I think you have too many processes for a mesh which is too coarse.

Thanks! I should have checked that.

1 Like

Hello. I have a question also. I get the same messages:

Warning: Mesh is empty, unable to create entities of dimension 0.
Warning: Mesh is empty, unable to create entities of dimension 3.
Traceback (most recent call last):
File “multilayer.py”, line 60, in
1: Constant((-1.0, 0.0, 0.0))
File “/usr/local/lib/python2.7/dist-packages/magnumfe/common/state.py”, line 582, in interpolate
File “/usr/local/lib/python2.7/dist-packages/magnumfe/common/state.py”, line 638, in FunctionSpace
File “/usr/local/lib/python2.7/dist-packages/magnumfe/common/state.py”, line 617, in VectorFunctionSpace
File “/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.py”, line 628, in init
constrained_domain=constrained_domain)
File “/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.py”, line 168, in init
dolfin_dofmap = cpp.DofMap(ufc_dofmap, mesh)
File “/usr/lib/python2.7/dist-packages/dolfin/cpp/fem.py”, line 586, in init
_fem.DofMap_swiginit(self,_fem.new_DofMap(*args))
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue…
Error: Unable to create mesh entity.
Reason: Mesh entity index 0 out of range [0, 0] for entity of dimension 3.
Where: This error was encountered inside MeshEntity.cpp.
Process: unknown

DOLFIN version: 1.5.0
Git changeset: unknown
But my object is too small, because I create simulation in nanostructure.
This is example of .geo file:

algebraic3d

solid 
1  = plane (0,0,0;-1,0,0 )
and plane (1,1,1; 1,0,0 )
and plane (0,0,0; 0,-1,0)
and plane (1,1,1; 0, 1,0 )
and plane (0,0,0.3; 0,0,-1 )
and plane (1,1,1; 0,0, 1 );

solid cube4 = plane (0,0,0; -1,0,0 )
and plane (1,1,1;  1,0,0 )
and plane (0,0,0; 0,-1,0 )
and plane (1,1,1; 0, 1,0 )
and plane (0,0,2.1; 0,0,-1 )
and plane (1,1,2.8; 0,0, 1 );

solid cube2 = plane (0,0,0; -1,0,0 )
and plane (1,1,1;  1,0,0 )
and plane (0,0,0; 0,-1,0 )
and plane (1,1,1; 0, 1,0 )
and plane (0,0,1.1; 0,0,-1 )
and plane (1,1,2.1; 0,0, 1 );

solid cube5 = plane (0,0,0; -1,0,0 )
and plane (1,1,1;  1,0,0 )
and plane (0,0,0; 0,-1,0 )
and plane (1,1,1; 0, 1,0 )
and plane (0,0,0; 0,0,-1 )
and plane (1,1,0.3; 0,0, 1 );

solid cube3 = plane (0,0,0; -1,0,0 )
and plane (1,1,1;  1,0,0 )
and plane (0,0,0; 0,-1,0 )
and plane (1,1,1; 0, 1,0 )
and plane (0,0,1.0; 0,0,-1 )
and plane (1,1,1.1; 0,0, 1 ) -maxh=0.05;


tlo cube3;
tlo cube1;
tlo cube2;
tlo cube4;
tlo cube5;

for creating mesh I used Netgen.

You are using a very outdated version of DOLFIN (v1.5.0) which was released in 2015, a long time ago. I would suggest you move to a later version of Dolfin and provide a minimal reproducible example.

My colleagues give me access only to this version. How I can update DOLFIN? It’s installed on our virtual server due to MobaXterm.

mesh = Mesh("cubeses.xml")
cell_regions  = MeshFunction("size_t", mesh, "cubeses_physical_region.xml")
facet_regions = MeshFunction("size_t", mesh, "cubeses_facet_region.xml")
state = State(mesh, cell_markers = cell_regions, facet_markers = facet_regions)
state = State(mesh,
  cell_domains = {
    'magnetic': (1, 2),
    'conducting': (4, 5, 3),
    'free': 2,
    'fixed': 1
  },
  facet_domains = {
    'contact1': 4,
    'contact2': 5,
    'outermagnet': 3
  },
  scale = 1e-9,
  m = Constant((1, 0, 0))
  )
state.material['magnetic'] = Material(
    alpha = 1.0,
    ms = 8e5,
    Aex = 1.3e-11,
    D0 = 1e-3,
    C0 = 6e6,
    beta = 0.9,
    beta_prime = 0.8,
    tau_sf = 5e-14,
    J = 4.0e-20
  )
state.material['!magnetic'] = Material(
    D0 = 5e-3,
    C0 = 6e6,
    tau_sf = 1e-14
  )
state.m.assign(
 state.interpolate({
        2: Constant((1.0, 0.0, 0.0)),
        1: Constant((-1.0, 0.0, 0.0))
    })
  )