Skip to content

Commit

Permalink
Update meshing.py
Browse files Browse the repository at this point in the history
Fix for #147
  • Loading branch information
bknight1 committed Jan 17, 2024
1 parent 2e93593 commit cc3ec87
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions underworld3/meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ class boundary_normals_3D(Enum):
Front = sympy.Matrix([0, 1, 0])
Back = sympy.Matrix([0, 1, 0])

dim = len(minCoords)
if dim == 2:
boundaries = boundaries_2D
boundary_normals = boundary_normals_2D
else:
boundaries = boundaries_3D
boundary_normals = boundary_normals_3D

if filename is None:
if uw.mpi.rank == 0:
os.makedirs(".meshes", exist_ok=True)
Expand All @@ -88,12 +96,7 @@ class boundary_normals_3D(Enum):
gmsh.option.setNumber("General.Verbosity", verbosity)
gmsh.model.add("Box")

# Create Box Geometry
dim = len(minCoords)

if dim == 2:
boundaries = boundaries_2D
boundary_normals = boundary_normals_2D

xmin, ymin = minCoords
xmax, ymax = maxCoords
Expand Down Expand Up @@ -279,6 +282,14 @@ class boundary_normals_3D(Enum):
Front = sympy.Matrix([0, 1, 0])
Back = sympy.Matrix([0, 1, 0])

dim = len(minCoords)
if dim == 2:
boundaries = boundaries_2D
boundary_normals = boundary_normals_2D
else:
boundaries = boundaries_3D
boundary_normals = boundary_normals_3D

if filename is None:
if uw.mpi.rank == 0:
os.makedirs(".meshes", exist_ok=True)
Expand All @@ -295,11 +306,8 @@ class boundary_normals_3D(Enum):
gmsh.model.add("Box")

# Create Box Geometry
dim = len(minCoords)

if dim == 2:
boundaries = boundaries_2D
boundary_normals = boundary_normals_2D

xmin, ymin = minCoords
xmax, ymax = maxCoords
Expand Down Expand Up @@ -352,8 +360,6 @@ class boundary_normals_3D(Enum):
gmsh.model.mesh.set_recombine(2, surface)

else:
boundaries = boundaries_3D
boundary_normals = boundary_normals_3D

xmin, ymin, zmin = minCoords
xmax, ymax, zmax = maxCoords
Expand Down

0 comments on commit cc3ec87

Please sign in to comment.