Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh Smoothing #22

Merged
merged 5 commits into from
Mar 18, 2024
Merged

Mesh Smoothing #22

merged 5 commits into from
Mar 18, 2024

Conversation

UZerbinati
Copy link
Collaborator

Mesh optimisation options are exposed in ngsPETSc. In particular, this allows to do mesh smoothing.
All details on the mesh optimisation features are available here.
Here is an example:

from firedrake import *
from netgen.occ import *
# Make 2D rectangle from (0, 0) to (1, 2)
rect1 = WorkPlane(Axes((0,0,0), n=Z, h=X)).Rectangle(1,2).Face()
# Make 2D rectangle from (0, 1) to (2, 2)
rect2 = WorkPlane(Axes((0,1,0), n=Z, h=X)).Rectangle(2,1).Face()
L = rect1 + rect2
geo = OCCGeometry(L, dim=2)
ngmesh = geo.GenerateMesh(maxh=0.1)
mesh = Mesh(ngmesh, netgen_flags={"optimisation_moves": "mmmm"})
mh = MeshHierarchy(mesh, 3, netgen_flags={"optimisation_moves": "mmmm"})

@UZerbinati UZerbinati requested a review from pefarrell February 17, 2024 15:27
@@ -174,6 +174,20 @@ def curveField(self, order, tol=1e-8):
newFunctionCoordinates.sub(2).dat.data[datIdx] = curvedPhysPts[i][j][2]
return newFunctionCoordinates

def splitToQuads(plex, dim, comm):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For quad meshing: is there a way to get netgen to make a quad-native mesh? If not, is there a way to get netgen to make a quad-dominant mesh, and then only split the triangles? I worry this will make for poor-quality meshes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to generate a quad only mesh in Netgen.
But I think we might be able to do something to improve the degeneration of the mesh.

ngsPETSc/utils/firedrake.py Outdated Show resolved Hide resolved
Signed-off-by: Umberto Zerbinati <[email protected]>
@UZerbinati UZerbinati merged commit f83b50a into main Mar 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants