This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Element-wise information

+1 vote

I need to perform some calculations over each single triangle of the mesh. Thus I need some information about it and I don't know (and didn't find anywhere) how to extract the following:

  • h (max dimension of the triangle)
  • length and directions of the semiaxes of the ellipse circumscribing the triangle.

Plus, I am not very sure how to calculate a L2-norm over the single element.

asked Dec 7, 2014 by nicholas_ FEniCS Novice (310 points)

1 Answer

0 votes
 
Best answer

I saw a discussion on your first on the mailing list, so I am pretty sure there is a built in functionality it. Edit: I just looked in the demos and

h = CellSize(mesh)

will give you an estimate.

The circumscribing ellipse part is done in the pragmatic mesh generator. It is available on github, look for the mesh_metric function in python/adaptivity.py

Note that
1. the code works in 2D as well as 3D, so there is some extra complexity
2. the DG0 tensor you get out has unit of inverse squared length
3. the DG0 tensor is scaled such that the triangle/tetrahedron with unit edge length results in the identity tensor.

answered Dec 10, 2014 by KristianE FEniCS Expert (12,900 points)
selected Feb 22, 2015 by nicholas_

Thank you, KristianE.
I've been very busy lately so I could not get into details, but now I'm back to work on metrics with PRAgMaTIc.
I was wondering if the tensor you are talking about is the diagonal tensor containing the (inverse squared) semiaxis.
I wrote an example, but this does not seem the case.

try to run the mesh_metric2_example.py test. It should plot the ellipse for you.

Thank you, I think I figured it out.

...