Error estimator based on Alfeld splits and refinement

Hello everyone,

I tried to implement the residual type error estimator defined on Alfeld splits, but the refinement is based on the elements before splitting. Therefore, after calculating the element-wise error estimator using the following
Integrate ( (h*(lamLaplace(gfu)+source))**2dx +
h*(n*(lamgrad(gfu) (lamgrad(gfu)).Other()))**2*dx(element_boundary=True), mesh, element_wise=True), this is done for the elements after splitting

I need to find the parent element in order to define the error estimator defined on the elements before splitting, I think we can sum up the error estimator for the children elements of each parent element. But it seems that mesh.GetParentElement can not give the indices of the parent element, may I ask for any advice? Many thanks

Best regards,
Lina

Alfeld splits is using the HPRefinement toolset, so this information is stored in hpelements of the netgen mesh class. There each element knows its coarse grid number

Best
Christopher

till now, the underlying macro-mesh was not wrapped to Python - I have just done it. With the up-coming pre-prelease you can access the parent elements like that:

from ngsolve import *
from ngsolve.webgui import Draw

ngmesh = unit_square.GenerateMesh(maxh=0.2)
ngmesh.SplitAlfeld()

mesh = Mesh(ngmesh)
Draw (mesh);

macromesh = ngmesh.macromesh
Draw (Mesh(macromesh));

for i in range(len(ngmesh.Elements2D())):
    print (ngmesh.MacroElementNr(i))

Hello Christopher,

Thank you very much for your kind reply.

Best regards,
Lina

Hello Joachim,

Thank you so much for your kind help. This is really helpful. Really appreciate.

Best regards,
Lina