Created
April 4, 2022 19:38
-
-
Save mhochsteger/dd2ffb5e04cefa39ba7a13f010094dea to your computer and use it in GitHub Desktop.
Netgen closesurface identification with Netgen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from netgen.occ import * | |
from netgen.meshing import IdentificationType | |
box = Box((0,0,0),(1,1,1)) | |
plate = Box((0,0,0.48),(1,1,0.52)).mat("plate") | |
air = (box-plate).mat("air") | |
plate.faces.Min(Z).Identify(plate.faces.Max(Z), name="plate_identification", type=IdentificationType.CLOSESURFACES) | |
shape = Glue([plate,air]) | |
geo = OCCGeometry(shape) | |
nmesh = geo.GenerateMesh(maxh=0.3) | |
slices = [2**(-i) for i in reversed(range(1,6))] | |
nmesh.ZRefine("plate_identification", slices) | |
from ngsolve import * | |
mesh = Mesh(nmesh) | |
Draw(mesh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment