Skip to content

Netgen: curved meshes from Mesh constructor and refine_marked_elements#4930

Open
pbrubeck wants to merge 2 commits intomainfrom
pbrubeck/netgen-bendy-mesh
Open

Netgen: curved meshes from Mesh constructor and refine_marked_elements#4930
pbrubeck wants to merge 2 commits intomainfrom
pbrubeck/netgen-bendy-mesh

Conversation

@pbrubeck
Copy link
Contributor

@pbrubeck pbrubeck commented Feb 27, 2026

Description

Previously we had 2 methods to construct a curved Mesh out of a netgen mesh:

  1. First creating a firedrake Mesh from a linear netgen mesh, and then calling curve_field(degree) to produce new coordinates, then you could create a firedrake Mesh out of the curve field. The final Firedrake Mesh will not know that it comes from a netgen mesh, and therefore cannot be adaptively refined.
mesh1 = Mesh(netgen_mesh)
meshp = Mesh(mesh1.curve_field(p))
  1. Via the MeshHierarchy constructor, this method produces a MeshHierarchy in which each mesh knows that it comes from a netgen mesh
mesh1 = Mesh(netgen_mesh)
mh = MeshHierarchy(mesh1, refine, netgen_flags={order: p})
meshp = mh[0]

This PR enables the more intuitive approach (while not removing the other two)

meshp = Mesh(netgen_mesh, netgen_flags={order: p})

Also propagates the mesh order in refine_marked_elements.

Copy link
Contributor

@connorjward connorjward left a comment

Choose a reason for hiding this comment

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

This is a way better way to build these meshes. Could you amend our demos?

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