Alfeld split on active mesh

Hello,

I want to use CutFEM for the Stokes problem using Scott-Vogelius elements on Alfeld splits. Currently, I have a working code that does

  1. Create a simplicial background mesh
  2. Create an Alfeld split of the background mesh
  3. Create an active mesh of the splitted background mesh given a levelset function.

This is done in the following way:

levelset = sqrt((x-0.5)**2 + (y-0.5)**2) - 0.25

square = SplineGeometry()
square.AddRectangle((0, 0), (1, 1), bcs=[])
mesh = Mesh(square.GenerateMesh(maxh=0.1, quad_dominated=False))
mesh.SplitElements_Alfeld()

lsetp1 = GridFunction(H1(mesh, order=1))
InterpolateToP1(levelset, lsetp1)

ci = CutInfo(mesh, lsetp1)
hasneg = ci.GetElementsOfType(HASNEG)

Vhbase = VectorH1(mesh, order=order, dirichlet=[])
Qhbase = L2(mesh, order=order - 1)

Vh = Restrict(Vhbase, hasneg)
Qh = Restrict(Qhbase, hasneg)

However, what I want to do is the following:

  1. Create a simplicial background mesh
  2. Create an active mesh of the background mesh given a levelset function.
  3. Create an Alfeld split of the active mesh.

Can anyone indicate how to do the Alfeld based on the active mesh, not the background mesh?

Thanks

Hi,

you could do the mesh manipulation yourself.
Here is a simple script for 2D barycenter refinement:
barycenter_ref.py (1.3 KB)

You can now adapt it to only act on active elements (and ignore the others for refinement or remove them completely).

Best,
Christoph