Quantcast
Channel: COMSOL Forums: Mesh element volume
Viewing all articles
Browse latest Browse all 80

Re: Mesh element volume

$
0
0
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).

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>