Discussion Forum

Mesh element volume

Topics: Mesh, 3.5, Meshing

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   15 Replies   Last post: February 3, 2012 4:11pm UTC
Wonseok Yoon

Wonseok Yoon

July 1, 2009 9:07pm UTC

Mesh element volume

Dear all,

I have a material property having a different value in a domain and
it is function of individual volume of deformed mesh element and undeformed mesh
element.
Could you tell me how to get the volume of the mesh element?
In 2D, this may be the area of the each element. (Am I right?)

I appreciate your reply.

Thank you.

Yoon

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

July 4, 2009 10:12am UTC in response to Wonseok Yoon

Re: Mesh element volume

hello
I'm not sure I really catch fully your request, but to calculate the volume, surface, length you simply apply a "Integration Coupling Variable" on a Subdomain, Boundary, respectively Edge, you define the geometrical object onto where to integrate, and you integrate with the value "1".
It's not writen fully out but these GUI's are there to calculate th integration over dV=dx,dy,dz, dA=dx,dy, respectiely ds (or whatever Geometry Reference Coordinate you are using, length is slightly particular as it differs slightly depending on the number of DoFs seleted, have a read through the manuals).
Such an integratin can only be calulated once the volume is meshed and the solver initialised (use Solve Get Inital Value).

Now if you want to get the mesh difference before and after "deformation" you have either the "u,v,w" values to play with or you could perhaps turn on the "frame" (Physics Properties Crate Frame On) and then integrate on the different frames you define.

I would suggest that you write out the equations of what you want to do and then read through the manuals, start to test with a simple case.

Comsol, in opposition to most other FEM programmes is really a global physics PDE solver, so you should really switch to thinking physics from the PDE world side, not the first though fr those of us trained to use more traditional FEM programmes

Good luck

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Wonseok Yoon

Wonseok Yoon

July 5, 2009 12:38am UTC in response to Ivar Kjelberg

Re: Mesh element volume

I appreciate your reply.

I noticed that ALE module can allow us to calculate the volume ratio of deformed and undeformed
mesh. The variable (dvol_ale/dvol) seems to give me the ratio for individual mesh element.
Please correct me if I'm wrong.

Thank you very much for your comments.

Yoon

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

July 13, 2009 5:37am UTC in response to Wonseok Yoon

Re: Mesh element volume

Hello

ALE is certainly a good approach, particularly if you have larger deformations. I cannot confirm your formula, bacause I havent to now used it myself, but from the help I beleive you are right.
I have learned to carefully check every variable, as there is not always the full physical formula written out in the doc (COMSOL would need to rewrite a full physics book, but I still beleive they should).
This is my only concern with COMSOL, I'm still not 100% used to COMSOl's way to not write indexes, nor even integrals , in their formulas, and GUI's.
Good luck

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alois Pfenniger

Alois Pfenniger

July 22, 2011 2:55pm UTC in response to Ivar Kjelberg

Re: Mesh element volume

Hi,

In Comsol 4.1, is there a way to display or export the volume of each single mesh element (I am not speaking about the volume of a domain). I can display the size, h, but what about the volume of each mesh element? I could of course display h^3, which would assume that each element is a cube with edge length h. But I guess this is not really accurate.

Thanks for any help.

Alois

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Wonseok Yoon

Wonseok Yoon

July 22, 2011 6:33pm UTC in response to Alois Pfenniger

Re: Mesh element volume

Hi, Alois

You can probably utilize the deformation gradient tensor to calculate the volume of each mesh element.
For the large deformation, the determinant of the tensor give you the ratio of deformed and undeformed volume.
For the small deformation, you can use strain to get the approximate value for that.

Wonseok

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alois Pfenniger

Alois Pfenniger

July 22, 2011 7:19pm UTC in response to Wonseok Yoon

Re: Mesh element volume

Hi Wonsoek,

thanks for your suggestion. I do not have any mechanical deformation, since my problem uses the "Electric Currents" physics. I am just interested in the volume represented by each single mesh element.

I export the data to Matlab, where I need to compute an integral over a domain (Biot-Savart). This integral requires knowledge of a physical quantity at each mesh element (the current density) and the volume of each mesh element.

Exporting the current density is ok. But how do I export the volume of each mesh element?

Thanks. Alois

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Paul Barclay

Paul Barclay

December 1, 2011 7:08pm UTC in response to Alois Pfenniger

Re: Mesh element volume

I am also interested in this problem. Did you find a solution?

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alois Pfenniger

Alois Pfenniger

December 1, 2011 9:26pm UTC in response to Paul Barclay

Re: Mesh element volume

Hi,
Yes I got the solution from Comsol support. Here is a summary of this support case:

My email #1:

I would like to ask you if there is a way to obtain the volume of a mesh element in Comsol 4.1. I know that there is a variable called "mesh element size", "h". According to the documentation of Comsol 3.5a:
"The variable h, available only in subdomains, represents the mesh element size (of the undeformed mesh), that is, the length of the longest edge of the element."
So in a first guess, I could assume that the mesh element is a cube of length h, and its volume is h^3. But this is of course not accurate. Is there a way to obtain the exact mesh element volume?
For example, let's assume that we have a domain with constant density. I would like to know the mass of each single mesh element. For this I need to know the volume of each single mesh element, such that I can multiply it with the density.

Comsol support answer #1:

You can use the variable "dvol" to determine the volume of the mesh elements. However, for non-block elements you need to multiply dvol with the following factors to get the correct volume.
Triangle : 1/2
Tetrahedron : 1/6
Prism : 1/2
Pyramid : 1/3

My email #2:

Thanks a lot for your help. Just to be sure that I understand you well:
by block elements, you mean quad and hex?

Is there a variable that describes the element type, e.g. var=1 for prism, var=2 for tetrahedron, var=3 for pyramid, etc?

Comsol support answer #2:

Yes.

Yes, you can use the variable "meshtype", which is equal to the number of element edges for each mesh element type, for example, 9 for prism and 6 for tetrahedron.

My email #3:

What I want to do does not work unfortunately. I drew a cylinder (radius r and height h) in Comsol, generated a mesh, and solved for a simple laminar flow through the cylinder. I then extracted the information for dvol and meshtype to two different text files. I then loaded the two files in Matlab, and ran a for loop over all the elements, checking which type
they are, and correcting the volume accordingly (Tetrahedron : 1/6, Prism : 1/2, etc.). Finally I sumed up all the single corrected volumes to obtain the total volume of the mesh. I ended up with a value which is completely wrong compared to the theoretical volume of the cylinder obtained by pi*r^2*h.
What is strange is that dvol and meshtype are given for each mesh point. How can a mesh point give any information about volume and element type?
There are points which belong to tetrahedrons and prisms at the same time. Nevertheless, they will either indicate tetrahedron or prism. Furthermore, what is the meaning of dvol for a mesh element? The volume of a point???
Thanks for clarifying this issue.

Comsol support answer #3:

When you export solution data to file you can specify the evaluation points for the export in the Advanced section. If you use the default settings you typically get several evaluation points for each element. This might be the reason for the incorrect value of the total volume resulting from your MATLAB script.
In this case you only want one evaluation point per element. To achieve this choose Gauss points in the Evaluate in list (and use Gauss point order 1).

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

December 2, 2011 10:57am UTC in response to Alois Pfenniger

Re: Mesh element volume

Hi

from my understanding "dvol" is a mesh element scale factor (without units), not truly the volume of the element.

-----------
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alois Pfenniger

Alois Pfenniger

December 2, 2011 2:44pm UTC in response to Ivar Kjelberg

Re: Mesh element volume

Hi,

when multypling dvol with the corresponding correction factor (Triangle : 1/2; Tetrahedron : 1/6; Prism : 1/2; Pyramid : 1/3) and summing up the result over an entire domain (using the evaluation with Gauss points as described just above), you end up with the correct volume of this domain. So this variable represents a physical quantity, even if it is not obvious.

Alois

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

December 2, 2011 9:09pm UTC in response to Alois Pfenniger

Re: Mesh element volume

Hi

then I'm not sure how to use it within the GUI as the "summation over a domain" is over the nodes and not the elements from my understanding (integration of 1 = volume, summation is a number > number of elements)

while the GUI summation of dvol/average(meshtype) is far greater and the integration much smaller than the actual volume

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alois Pfenniger

Alois Pfenniger

December 3, 2011 7:34pm UTC in response to Ivar Kjelberg

Re: Mesh element volume

Hi,

I did not use it in the GUI, but I extracted the data (using Gauss evaluation of order 1) and then computed the summation in MATLAB. It might not work in the GUI,

Alois

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

December 3, 2011 8:51pm UTC in response to Alois Pfenniger

Re: Mesh element volume

Hi

Indeed it needs some further investigations ;)

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Urmi Roy

Urmi Roy

February 3, 2012 3:06pm UTC in response to Ivar Kjelberg

Re: Mesh element volume

Please help :

I need to know the mesh element size in the 'extremely coarse' mesh and may also need to know the element sizes in the other mesh types such as 'normal', 'fine' etc. Is there any way I can know this?
Also, if I want to define my mesh element size, then are the numbers input into 'maximum element size' in the free mesh parameters in units of cm/mm?

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

February 3, 2012 4:11pm UTC in response to Urmi Roy

Re: Mesh element volume

Hi

In V4 by default its Si units hence [m], except if you change the base unit system of your model (top node). You can change the default geoemtry units from [m] to [mm] or whatever, this remains limited to the geometry representation, the physics remain in default [m] the mesh normally follos the geoemtryx units, but there you have the m or mm appearing to the right of the max/min sizes

Mostly the units are mentioned in the GUI (still a few exceptions were its missing)

I believe in V3 the default was [m] (or the main pysics based units) for all not sure any longer

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines