Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

On specialcf.mesh_size

More
3 years 8 months ago #2969 by Guosheng Fu
Hello,

I am looking into the mesh size CF
Code:
h = specialcf.mesh_size
again, and noticed that it has different meaning when evaluated at volume or facet.
github.com/NGSolve/ngsolve/blob/master/fem/python_fem.cpp
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:
Code:
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?

Best,
Guosheng
More
3 years 8 months ago #2971 by joachim
Replied by joachim on topic On specialcf.mesh_size
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
Attachments:
The following user(s) said Thank You: Guosheng Fu
Time to create page: 0.128 seconds