Skip to content

Commit

Permalink
Smoothing also in hierarchies
Browse files Browse the repository at this point in the history
Signed-off-by: Umberto Zerbinati <[email protected]>
  • Loading branch information
Umberto Zerbinati committed Feb 17, 2024
1 parent 3676e41 commit 5dc06a9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ngsPETSc/utils/firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def __init__(self, mesh, netgen_flags, user_comm=fd.COMM_WORLD):
#Optimises the mesh, for example smoothing
if mesh.dim == 2:
mesh.OptimizeMesh2d(MeshingParameters(optimize2d=optMoves))
print("Optimising mesh")
elif mesh.dim == 3:
mesh.OptimizeVolumeMesh(MeshingParameters(optimize3d=optMoves))
else:
Expand Down Expand Up @@ -371,6 +370,7 @@ def NetgenHierarchy(mesh, levs, flags):
order= [order]*(levs+1)
tol = flagsUtils(flags, "tol", 1e-8)
refType = flagsUtils(flags, "refinement_type", "uniform")
optMoves = flagsUtils(flags, "optimisation_moves", False)
#Firedrake quoantities
meshes = []
coarse_to_fine_cells = []
Expand All @@ -395,6 +395,14 @@ def NetgenHierarchy(mesh, levs, flags):
#We construct a Firedrake mesh from the DMPlex mesh
mesh = fd.Mesh(rdm, dim=meshes[-1].ufl_cell().geometric_dimension(), reorder=False,
distribution_parameters=params, comm=comm)
if optMoves:
#Optimises the mesh, for example smoothing
if ngmesh.dim == 2:
ngmesh.OptimizeMesh2d(MeshingParameters(optimize2d=optMoves))
elif mesh.dim == 3:
ngmesh.OptimizeVolumeMesh(MeshingParameters(optimize3d=optMoves))
else:
raise ValueError("Only 2D and 3D meshes can be optimised.")
mesh.netgen_mesh = ngmesh
#We curve the mesh
if order[l+1] > 1:
Expand Down

0 comments on commit 5dc06a9

Please sign in to comment.