On specialcf.mesh_size

3 months 1 week ago #2969 by Guosheng Fu

I am looking into the mesh size CF
h = specialcf.mesh_size
again, and noticed that it has different meaning when evaluated at volume or facet.
In line 513, 'h' returns det/ip.GetMeasure(). On triangular mesh, it is 2*area/edge_length, and takes two different values on two internal edges.

Sometimes, it is more natural to work directly with edge length directly in a DG formulation. Is there a coefficient function for the edge length?

I am thinking of the following hack to get edge length by defining a DG0 facet gridfunction:
V = FacetFESpace(mesh)
u,v = V.TnT()
a  = u*v*dx(skeleton=True)
a  = u*v*ds(skeleton=True)

h0 = GridFunction(V)
temp = h0.vec.CreateVector()
temp[:] = 1
a.Apply(temp, h0.vec)
This is not clean, but does it impact the speed of the code if I replace the specialcf.mesh_size in DG formulation by this gridfunction h0?


Please Log in or Create an account to join the conversation.

3 months 1 week ago #2971 by joachim
we use volume / facet-area which is the element-size perpendicular to the facet, since this is needed as DG stabilization for anisotropic elements.

We have wrapped also the Jacobian, which allows to compute most other geometric quantities. E.g. the edge-length (for affine edges) is || F * tau ||, where tau is the unit tangential vector.

Here an example. It uses the logging - coefficientfunction, which prints the function values on evaluation.

- Joachim
The following user(s) said Thank You: Guosheng Fu

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve