I have this special geometry I want to solve on, as to import it I created a slab version of the step file (see attached) and selected the face for meshing
2DICRHSlab.step (52.9 KB):
if stp:
#what we want to do: https://forum.ngsolve.org/t/selective-mesh-on-step-file/2230
from netgen.occ import *
geo = OCCGeometry('../../../../data/TOMAS_data/2DICRHSlab.step')
logging.info('Extracting face 16')
shape2 = geo.shape
shape2.faces[15].name = "TheOne"
rt = Glue (shape2.faces["TheOne"])
geo = OCCGeometry(rt)
logging.info('Generating the mesh')
with TaskManager():
mesh = Mesh(geo.GenerateMesh (maxh=MAXH))
mesh.ngmesh.Scale(1/1000)
else:
import netgen.geom2d as geom2d
from netgen.geom2d import CSG2d, Circle, Rectangle
geo = CSG2d()
VesselWall = Circle( center=(0+0.78,0), radius=0.26, mat="Plasma", bc="wall" )
CircleWithAntennaRadius = Circle( center=(0+0.78,0), radius=0.215, mat="copper", bc="Antenna" )
AntennaCut1 = Rectangle( pmin=(-3+0.78,-1), pmax=(0+0.78,1), mat="copper", bc="cut" )
AntennaCut2 = Rectangle( pmin=(-4+0.78,0.21*np.sin(np.deg2rad(40))), pmax=(1,1 + 0.21*np.sin(np.deg2rad(40))), mat="copper", bc="cut")
AntennaCut3 = Rectangle( pmin=(-2+0.78,-1 + 0.21*np.sin(np.deg2rad(-40))), pmax=(1,0.21*np.sin(np.deg2rad(-40))), mat="copper", bc="cut" )
CircleWithLessthanAntennaRadius = Circle( center=(0+0.78,0), radius=0.210, mat="copper", bc="Antenna" )
Antenna = CircleWithAntennaRadius - CircleWithLessthanAntennaRadius - AntennaCut1 - AntennaCut2 - AntennaCut3
System = VesselWall-Antenna
geo.Add(System)
logging.info('Generating the mesh')
with TaskManager():
mesh = Mesh(geo.GenerateMesh (maxh=MAXH))
Draw (mesh)
Even though these two meshes look like the same kind of construction, when creating a HCurl and Hdiv,
the test functions of the first (with stp) are 3D instead of 2D. How can I make the face ā2Dā? Or is there an easier method of importing 2D structures?