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

Snapping back to the coarse grid #47

Merged
merged 11 commits into from
Sep 25, 2024
Merged

Snapping back to the coarse grid #47

merged 11 commits into from
Sep 25, 2024

Conversation

UZerbinati
Copy link
Collaborator

We added a feature that allows you to snap the mesh in the hierarchy to the coarsest curved geometry, hence creating a nested mesh hierarchy. Example on how to use the code:

from firedrake import *
from netgen.occ import *
from netgen.meshing import MeshingParameters

disk1 = Circle((0, 0), 1).Face()
disk1.name = "bnd"
gelato = (disk1*HalfSpace((0,0,0),(0.2,0.6,0)))*HalfSpace((0,0,0),(0.2,-0.6,0))
geo = OCCGeometry(gelato, dim=2)
mp = MeshingParameters(minh=1.0)
ngmesh = geo.GenerateMesh(maxh=3.0, mp=mp)
mesh = Mesh(ngmesh)
mh = MeshHierarchy(mesh, 2, netgen_flags={"snap_to": "coarse", "snap_smoothing": "hyperelastic", "degree": 3})
for i in range(3):
    File(f"gelato_{i}.pvd").write(mh[i])

Ref0
Ref1
Ref2

@UZerbinati UZerbinati merged commit 1ea4b0e into main Sep 25, 2024
5 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.

1 participant