- Thank you received: 6
On specialcf.mesh_size
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
4 years 4 months ago #2969
by Guosheng Fu
On specialcf.mesh_size was created by Guosheng Fu
Hello,
I am looking into the mesh size CF
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:
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
I am looking into the mesh size CF
Code:
h = specialcf.mesh_size
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)
Best,
Guosheng
4 years 4 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
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.094 seconds