Sorry if this is a known bug. I did look into the forum and the repository, but did not find anything.
With a Gmsh file (/tmp/t.geo
):
SetFactory("OpenCASCADE");
Point(1) = {0, 0, 0, 1.0};
Point(2) = {3, 0, 0, 1.0};
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/6} {
Duplicata { Point{2}; }
}
Point(4) = {1, 0, 0, 1.0};
Rotate {{0, 0, 1}, {0, 0, 0}, Pi/6} {
Duplicata { Point{4}; }
}
Line(1) = {1, 4};
Line(2) = {5, 1};
Circle(3) = {4, 1, 5};
Line(4) = {4, 2};
Circle(5) = {2, 1, 3};
Line(6) = {3, 5};
Transfinite Curve {4} = 5 Using Progression 1;
Transfinite Curve {6} = 5 Using Progression 1;
a = 1;
Transfinite Curve {1} = 3 Using Progression a;
Transfinite Curve {2} = 3 Using Progression 1/a;
Curve Loop(1) = {1, 3, 2};
Plane Surface(1) = {1};
Curve Loop(2) = {4, 5, 6, -3};
Plane Surface(2) = {2};
Transfinite Surface {2};
Transfinite Curve {3} = 3 Using Progression 1;
Transfinite Curve {5} = 3 Using Progression 1;
Recombine Surface {2};
Physical Surface("small", 7) = {1};
Physical Surface("big", 8) = {2};
When trying to load the mesh (/tmp/t.py
):
from dolfinx.io import gmshio
from mpi4py import MPI
import gmsh
gmsh.initialize()
gmsh.model.add("Temp")
gmsh.merge("/tmp/t.geo")
gmsh.finalize()
gmsh_file_data = gmshio.read_from_msh("/tmp/t.geo", MPI.COMM_WORLD, gdim=2)
The error is:
Traceback (most recent call last):
File "/usr/lib/python3.10/pdb.py", line 1726, in main
pdb._runscript(mainpyfile)
File "/usr/lib/python3.10/pdb.py", line 1586, in _runscript
self.run(statement)
File "/usr/lib/python3.10/bdb.py", line 597, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/tmp/t.py", line 10, in <module>
gmsh_file_data = gmshio.read_from_msh("/tmp/t.geo", MPI.COMM_WORLD, gdim=2)
File "/usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py", line 292, in read_from_msh
output = model_to_mesh(gmsh.model, comm, rank, gdim=gdim)
File "/usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py", line 188, in model_to_mesh
topologies = extract_topology_and_markers(model)
File "/usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py", line 99, in extract_topology_and_markers
assert len(entity_types) == 1
AssertionError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py(99)extract_topology_and_markers()
-> assert len(entity_types) == 1
Hopefully, this helps:
#+TITLE: Debugger info for *pdb t.py shell*
This is based on an org-mode buffer. Hit tab to expand/contract sections.
* General Information (realgud-cmdbuf-info)
- Debugger name :: pdb
- Command-line args :: ["python","-m","pdb","/tmp/t.py"]
- Starting directory :: nil
- Current source-code path :: [[/usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py]]
- Selected window should contain source? :: nil
- Last input end :: 1410
- Source should go into short-key mode? :: t
- In debugger? :: t
- Ignore file regexps :: (<string>)
- remapped file names :: nil
** Remap table for debugger commands
- backtrace :: where
- clear :: clear %X:%l
- delete :: clear %p
- eval :: !%s
- finish :: return
- frame :: *not-implemented*
- info-breakpoints :: break
- info-locals-names-list :: print('\n'.join(locals().keys()))
- info-type :: type(%s)
- info-value :: pp %s
- kill :: quit
- shell :: *not-implemented*
* Source Buffers Seen (srcbuf-list)
- gmshio.py
- t.py
** Source Positions Stopped at (loc-hist)
- buffer size :: 20
- position :: 0
*** 0
- filename :: /tmp/t.py
- line number :: 1
- source marker :: #<marker at 1 in t.py>
- cmdbuf marker :: #<marker at 123 in *pdb t.py shell*>
*** 1
- filename :: /usr/lib/python3.10/site-packages/dolfinx/io/gmshio.py
- line number :: 99
- source marker :: #<marker at 3576 in gmshio.py>
- cmdbuf marker :: #<marker at 1410 in *pdb t.py shell*>
#+STARTUP: overview
#+STARTUP: content
#+STARTUP: showall
#+STARTUP: showeverything
(How does one upload files around here?).
Thanks!
[Edit]
import dolfinx
import gmsh
print(dolfinx.common.git_commit_hash)
print(gmsh.GMSH_API_VERSION)
22f61674e9f0412f5c4a887f1d49c2c4edbfad4a
4.10.4
and
python --version
uname -r | head -n 1
Python 3.10.5
5.18.14-arch1-1