Load msh file that represents 2D mesh and use occ addPipe
Hi,
I have msh file that should contain 2D mesh with boundary layer that I created with gmsh.model.geo and want use that to construct 3D mesh using occ.addPipe functionality.
With the following command,
gmsh.model.add("coiled_pipe")
gmsh.merge("inlet.msh”)
s = gmsh.model.getEntities()
s should be
[(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (1, 1), (1, 2), (1, 3), (1, 4), (2, 1)]
But the tags can not be used as an input for occ functions. For example, I get the following error.
Error : Unknown OpenCASCADE surface with tag 1
I guess it is because the inlet.msh is made with gmsh.model.geo and is not OpenCASCADE. So, I want to know how I can load the msh file and use input for occ functions.
Basically, what I want to do is to replace
gmsh.model.occ.addPipe([(2, 1000)], 1000, 'DiscreteTrihedron')
in the following part from tutorial t19.py
# OpenCASCADE also allows general extrusions along a smooth path. Let's first
# define a spline curve:
nturns = 1.
npts = 20
r = 1.
h = 1. * nturns
p = []
for i in range(0, npts):
theta = i * 2 * math.pi * nturns / npts
gmsh.model.occ.addPoint(r * math.cos(theta), r * math.sin(theta),
i * h / npts, 1, 1000 + i)
p.append(1000 + i)
gmsh.model.occ.addSpline(p, 1000)
# A wire is like a curve loop, but open:
gmsh.model.occ.addWire([1000], 1000)
# We define the shape we would like to extrude along the spline (a disk):
gmsh.model.occ.addDisk(1, 0, 0, 0.2, 0.2, 1000)
gmsh.model.occ.rotate([(2, 1000)], 0, 0, 0, 1, 0, 0, math.pi / 2)
# We extrude the disk along the spline to create a pipe (other sweeping types
# can be specified; try e.g. 'Frenet' instead of 'DiscreteTrihedron'):
gmsh.model.occ.addPipe([(2, 1000)], 1000, 'DiscreteTrihedron')
# We delete the source surface, and increase the number of sub-edges for a
# nicer display of the geometry:
gmsh.model.occ.remove([(2, 1000)])
gmsh.option.setNumber("Geometry.NumSubEdges", 1000)
gmsh.model.occ.synchronize()
with the 2D mesh that I have created. I attached inlet.msh file for reference.
Edited by Kei Yamamoto