Graded meshes


I am solving the classical L-shaped domain and wanted to generate a graded mesh where grading is radial in nature emanating from the origin as the singularity lies at the origin. I wanted to know how to specify the grading with respect to the origin.

The code that generated this simple mesh without grading:

from ngsolve import *
import netgen.geom2d as geom2d;
geo = geom2d.SplineGeometry()
p1 = geo.AppendPoint (0,0)
p2 = geo.AppendPoint (1,0)
p3 = geo.AppendPoint (1,1)
p4 = geo.AppendPoint (-1,1)
p5 = geo.AppendPoint (-1,-1)
p6 = geo.AppendPoint (0,-1)

geo.Append ([“line”, p1, p2], bc=1)
geo.Append ([“line”, p2, p3], bc=1)
geo.Append ([“line”, p3, p4], bc=1)
geo.Append ([“line”, p4, p5], bc=1)
geo.Append ([“line”, p5, p6], bc=1)
geo.Append ([“line”, p6, p1], bc=1)

mesh = Mesh( geo.GenerateMesh(maxh=0.1))


you can specify a smaller mesh-size at points and segments, like

p1 = geo.AppendPoint (0,0, maxh=0.01)