Following @Ekrem_Ekici’s reply, I have been able (I think) to revolve the surface. However, now I’m having trouble with translating the mesh to dolfinx with meshio. Below are the code and the error message. Any ideas what is wrong?
from dolfinx.io import gmshio
import gmsh
model = gmsh.model; geom = gmsh.model.geo
from mpi4py import MPI
mesh_comm = MPI.COMM_WORLD
Rbeta, Ralpha, calpha = 0.6976318239461305, 0.8720397799296024, -0.5232238679565371
ms = 0.1
gdim = 2
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 0)
model.add("3D acorn")
p = [
geom.addPoint(0, 0, Ralpha+calpha, ms),
geom.addPoint(Rbeta, 0, 0, ms),
geom.addPoint(0, 0, -Rbeta, ms),
geom.addPoint(0, 0, 0, ms),
geom.addPoint(0, 0, calpha, ms)
]
l = [
geom.addCircleArc(p[0], p[4], p[1]),
geom.addCircleArc(p[1], p[3], p[2]),
geom.addLine(p[2], p[0])
]
cl = geom.addCurveLoop([l[j] for j in range(len(l))])
s = geom.addPlaneSurface([cl], 10)
# Rotations are specified by an axis point (0, 0, 0), the axis direction (0, 0, 1), and a
# rotation angle (Pi/2). We input the dimension and tag of the surface to rotate [(2, 10)]
# and ask for 7 subdivisions.
revsol = geom.revolve([(2, 10)], 0, 0, 0, 0, 0, 1, np.pi/2, [7])
geom.synchronize()
model.add_physical_group(dim=gdim+1, tags=[revsol[1][1]]) # tag of the volume revsol
geom.synchronize()
model.mesh.generate(gdim+1)
domain = gmshio.model_to_mesh(model, mesh_comm, 0, gdim=gdim+1)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Input In [64], in <cell line: 43>()
40 geom.synchronize()
41 model.mesh.generate(gdim+1)
---> 43 domain = gmshio.model_to_mesh(model, mesh_comm, 0, gdim=gdim+1)
44 plotMesh(domain)
File /usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/io/gmshio.py:188, in model_to_mesh(model, comm, rank, gdim)
185 x = extract_geometry(model)
187 # Get mesh topology for each element
--> 188 topologies = extract_topology_and_markers(model)
190 # Extract Gmsh cell id, dimension of cell and number of
191 # nodes to cell for each
192 num_cell_types = len(topologies.keys())
File /usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/io/gmshio.py:99, in extract_topology_and_markers(model, name)
92 for entity in entities:
93 # Get cell type, list of cells with given tag and
94 # topology of tagged cells
95 # NOTE: Assumes that each entity only have one
96 # cell-type, i.e. facets of prisms and pyramid meshes
97 # are not supported
98 (entity_types, entity_tags, entity_topologies) = model.mesh.getElements(dim, tag=entity)
---> 99 assert len(entity_types) == 1
101 # Determine number of local nodes per element to create the
102 # topology of the elements
103 properties = model.mesh.getElementProperties(entity_types[0])
AssertionError: