on areas and volumes of mesh elements

General discussion about Elmer
Post Reply
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

on areas and volumes of mesh elements

Post by spacedout »

Hi

I'm integrating a function over the mesh which therefore requires the knowledge of the element's volume.

I found out function elementsize under the online Elmer documentation. Yet its description is bizarre:

"Returns just the size of the element at its center" .......

To me, the size of an object is an inherent property of the said object and thus independent of, say another property like its centroid for example.

I also discovered function elementarea whose second input parameter is element. Now imagine this element is three dimensional, say a tetrahedron.
There are 4 faces on a tetrahedron. The returned element area will then refer to which of the four faces ?

Have a pleasant Easter Monday
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: on areas and volumes of mesh elements

Post by raback »

Hi

Do you have your own integration routine? You will find a plethora of loops over elements using Gaussian quadratures. There the ElementInfo returns the detJ which represents the element volume/area (compared to the reference element). I propose that you copy paste some of these routines if you're integrating over non-constant fields.

-Peter
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: on areas and volumes of mesh elements

Post by spacedout »

Good evening

I was just thinking of taking the average of all values of a field variable at the nodes of an element. multiply it by the volume of that element and then sum those contributions from each element.

It does not matter whether the dimension of each element is given by

DIM = CoordinateSystemDimension()

or if they are all boundary elements (in which case their dimension is given by DIM-1)


The intention was to get their volume by executing the following:

detJ = ElementSize(ElementNodes, CurrentElement)

At first, I had considered doing something like

n = GetElementNOFNOdes(CurrentElement)

Area = ElementArea( Solver % Mesh,CurrentElement,n )


for boundary elements, but I still cannot figure out why this function exist since ElementSize seems to do the job regardless of the element dimension. The size of an object a more general term than its area or volume. Afterall, the area of an element is meaningless if that element is three dimensional.

Regards to all Elmer users
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: on areas and volumes of mesh elements

Post by spacedout »

I used ElmerGrid to create a rectangular 200 x 400 mesh where each cell is a square. File mesh.elements shows that each element is of type 404 and has 4 corner nodes.

The area of each cell

.00001 meters x .00001 meters = 1e-10 square meters

but a print out of detJ from

detJ = ElementSize(CurrentElement, ElementNodes)

displays

2.5e-11 square meters (or a fourth of the above true value)

Why would that be?
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: on areas and volumes of mesh elements

Post by raback »

Hi

The reference element is a quadrilateral with local coordinates [-1,1] in both directions. Hence the reference area is 4. DetJ gives the determinant of the metric tensor related to coordinate tranformation from local to global.

-Peter
Post Reply