Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

calculating average element size

Please login with a confirmed email address before reporting spam

Hi,

I am trying to characteise the effect of mesh quality and element size on the solution of a model. I have generated a standard and several refined meshes using an external software (Simpleware) and imported them to Comsol.

I am using q = meshqual(fem.mesh); to calculate the mesh quality.

Is there a similar command or calculate the average element size?

I have tried a subdomain plot of "h" the element size, exporting the plot data to Matlab and calculating the average. However I have noticed the number of elements in the output file is alot more than the real number of elements.

I am not sure how the export plot data works in this case? Is it exporting the element size at each vertex?

Thanks

Amr


16 Replies Last Post 2013年2月23日 GMT-5 07:41
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年2月18日 GMT-5 02:32
Hi

I'm interested to understand and hear in which version, and how you import the mesh and how you then get COMSOL to use it: as geometry or as entities or as mesh ?

--
Good luck
Ivar
Hi I'm interested to understand and hear in which version, and how you import the mesh and how you then get COMSOL to use it: as geometry or as entities or as mesh ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年2月18日 GMT-5 02:52
Hi Ivar,

I import the mesh as an .mphtxt file - which is generated by Simpleware and I use the imported mesh to solve the model . I am using V3.5a

However, the same question about calculating the average element size applies to any simple geometry drawn and meshed in Comsol.

I know I can set the element size when generating the mesh in Comsol. But how do I check that the actual element size in the mesh I generate in Comsol matches what I specified?

Thanks

Hi Ivar, I import the mesh as an .mphtxt file - which is generated by Simpleware and I use the imported mesh to solve the model . I am using V3.5a However, the same question about calculating the average element size applies to any simple geometry drawn and meshed in Comsol. I know I can set the element size when generating the mesh in Comsol. But how do I check that the actual element size in the mesh I generate in Comsol matches what I specified? Thanks

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年2月18日 GMT-5 04:17
Hi

"h" is the mesh element size but it's local to be understand as "h_i" where _i represent every "i" mesh element.

So basically I would say it's taking the average of "h" over the domain, something like intop1(h)/intop1(1), where intop1() is your Integration Coupling variable (ported back to 3.5, that's getting oldish for me ;) in V4 it's simply aveop1(h)

you have also something like a "dvol" if I remember right in addition to "qual" in 3.5

--
Good luck
Ivar
Hi "h" is the mesh element size but it's local to be understand as "h_i" where _i represent every "i" mesh element. So basically I would say it's taking the average of "h" over the domain, something like intop1(h)/intop1(1), where intop1() is your Integration Coupling variable (ported back to 3.5, that's getting oldish for me ;) in V4 it's simply aveop1(h) you have also something like a "dvol" if I remember right in addition to "qual" in 3.5 -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年6月2日 GMT-4 22:05
Hi,

I am using free Triangular mesh, and need to determine the area of each triangle for calculating ds. I have tried to use average h_i(mesh element size), but it looks like it is not exact solution. Can you please let me know how I can calculate the area of each triangle within Triangular mesh?

Thanx,
Shahed
Hi, I am using free Triangular mesh, and need to determine the area of each triangle for calculating ds. I have tried to use average h_i(mesh element size), but it looks like it is not exact solution. Can you please let me know how I can calculate the area of each triangle within Triangular mesh? Thanx, Shahed

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年7月12日 GMT-4 03:49
i'm interested how can you handle the obtained mesh from simpleware in Comsol??
i'm interested how can you handle the obtained mesh from simpleware in Comsol??

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年4月27日 GMT-4 14:40
Can I have a question that what does it mean by "mesh size" when describing a Free Tetrahedral mesh? Which dimension is it talking about since it has a unit of "m"?

I prefer to know the volume of each mesh in my case for calculating the total enthalpy in the final product.

Thanks for answering Ivar.
Can I have a question that what does it mean by "mesh size" when describing a Free Tetrahedral mesh? Which dimension is it talking about since it has a unit of "m"? I prefer to know the volume of each mesh in my case for calculating the total enthalpy in the final product. Thanks for answering Ivar.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年4月27日 GMT-4 16:40
Hi
there is something I do not understand, why do you all want to know the volume or area of the mesh elements ? In Comsol one define the physics on the geoemtrical Entities,so the results are also obtained by integrating over the entities (doamins and boundaries). A mesh is finally only the discretisation used, and it might change, the entities, far less.

It's like when you digitalise a analogue signal, for example some music. Finally one want the melody as results, not the size of each sample used to discretized the signal. If the quality is not good enough, OK one decides to use a faster and more detailed discretisation, but the end esire is the quality of the final sound.

or have I missed something ?

--
Good luck
Ivar
Hi there is something I do not understand, why do you all want to know the volume or area of the mesh elements ? In Comsol one define the physics on the geoemtrical Entities,so the results are also obtained by integrating over the entities (doamins and boundaries). A mesh is finally only the discretisation used, and it might change, the entities, far less. It's like when you digitalise a analogue signal, for example some music. Finally one want the melody as results, not the size of each sample used to discretized the signal. If the quality is not good enough, OK one decides to use a faster and more detailed discretisation, but the end esire is the quality of the final sound. or have I missed something ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年4月30日 GMT-4 18:02
Thanks for your reply.

In my case, I would like to know the total enthaply inside my food material in joule heating module.

After building up a heat transfer module and solved, I can see the temperature distribution, and also, I can export the enthalpy data. However, the unit of "enthalpy" and "total enthalpy" are both with a unit of J/kg. So I am wondering shall I know the volume of each mesh, and then calculate the mass of each mesh, in order to obtain the enthalpy within each mesh and add them up? or just simply add all them up and them multiply by the total mass of product?

Thanks, let me know if it is not clear enough.

Yang




Hi
there is something I do not understand, why do you all want to know the volume or area of the mesh elements ? In Comsol one define the physics on the geoemtrical Entities,so the results are also obtained by integrating over the entities (doamins and boundaries). A mesh is finally only the discretisation used, and it might change, the entities, far less.

It's like when you digitalise a analogue signal, for example some music. Finally one want the melody as results, not the size of each sample used to discretized the signal. If the quality is not good enough, OK one decides to use a faster and more detailed discretisation, but the end esire is the quality of the final sound.

or have I missed something ?

--
Good luck
Ivar


Thanks for your reply. In my case, I would like to know the total enthaply inside my food material in joule heating module. After building up a heat transfer module and solved, I can see the temperature distribution, and also, I can export the enthalpy data. However, the unit of "enthalpy" and "total enthalpy" are both with a unit of J/kg. So I am wondering shall I know the volume of each mesh, and then calculate the mass of each mesh, in order to obtain the enthalpy within each mesh and add them up? or just simply add all them up and them multiply by the total mass of product? Thanks, let me know if it is not clear enough. Yang [QUOTE] Hi there is something I do not understand, why do you all want to know the volume or area of the mesh elements ? In Comsol one define the physics on the geoemtrical Entities,so the results are also obtained by integrating over the entities (doamins and boundaries). A mesh is finally only the discretisation used, and it might change, the entities, far less. It's like when you digitalise a analogue signal, for example some music. Finally one want the melody as results, not the size of each sample used to discretized the signal. If the quality is not good enough, OK one decides to use a faster and more detailed discretisation, but the end esire is the quality of the final sound. or have I missed something ? -- Good luck Ivar [/QUOTE]

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月1日 GMT-4 00:52
Hi

Well forget the "mesh" it's "only" the discretization. COMSOL looks after the integration. You should work on the "entities" where you have defined your physics, in particular the "domains" (volume in 3D, surfaces in 2D ...) and the boundaries (surfaces in 3D, edges in 2D ...)

If you solve the HT and want the total entalpy, you integrate over the domain(s) of interest "Cp*rho*T"

You shoul note that COMSOl calles these dependent variables "variables" but they are in fact "fields" its Cp(x,y,z,t) and rho(x,y,z,t) and T(x,y,z,t) (or whatever corresponds to your coordinate system and if used time response). And these are in dimension of the mesh elements (hence often you see densities per kg or per m^3, so most "variables" must be integrated over the domains (volumes) to get macroscopic values out.

For COMSOl you define the physics and BC on the Entities, and you postprocess the entities, the mesh is the discretization or sampling of your "signal/model" it must meet the Nyquist of mesh quality criteria, that is all). You can concentrate on the true physics and not on the FEM math with COMSOL, that is what is so nice with it ;)

--
Good luck
Ivar
Hi Well forget the "mesh" it's "only" the discretization. COMSOL looks after the integration. You should work on the "entities" where you have defined your physics, in particular the "domains" (volume in 3D, surfaces in 2D ...) and the boundaries (surfaces in 3D, edges in 2D ...) If you solve the HT and want the total entalpy, you integrate over the domain(s) of interest "Cp*rho*T" You shoul note that COMSOl calles these dependent variables "variables" but they are in fact "fields" its Cp(x,y,z,t) and rho(x,y,z,t) and T(x,y,z,t) (or whatever corresponds to your coordinate system and if used time response). And these are in dimension of the mesh elements (hence often you see densities per kg or per m^3, so most "variables" must be integrated over the domains (volumes) to get macroscopic values out. For COMSOl you define the physics and BC on the Entities, and you postprocess the entities, the mesh is the discretization or sampling of your "signal/model" it must meet the Nyquist of mesh quality criteria, that is all). You can concentrate on the true physics and not on the FEM math with COMSOL, that is what is so nice with it ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月1日 GMT-4 13:26
Hi Ivar,

Thanks. As per my understanding, the mesh we made for discretilization is not important at all, can you give me an example of how to calculate the total energy absorbed in my material? The following data is exported as "total enthalpy" with a unit of J/kg. I took two time point for reference.

As far as I know the enthalpy distribution is fairly different at every different location in the material, but how to integrate them in comsol or any other postprocessing software? Can you show me simply how to do it?

Thanks,

% x
0.071
0.071
0.069781614
0.066606098
0.070207608
0.068316062

y
-0.04
-0.04
-0.044783645
-0.041805078
-0.043901277
-0.046817275

z
0.1116
0.107269484
0.1116
0.1116
0.106316936
0.107818497

jh.H0 (J/kg) @ t=0
520322.6718
520327.721
520337.4573
520306.691
520351.3471
520336.7744

jh.H0 (J/kg) @ t=900
858315.0763
862184.7099
860672.0054
861906.5826
865079.9856
864478.9603
Hi Ivar, Thanks. As per my understanding, the mesh we made for discretilization is not important at all, can you give me an example of how to calculate the total energy absorbed in my material? The following data is exported as "total enthalpy" with a unit of J/kg. I took two time point for reference. As far as I know the enthalpy distribution is fairly different at every different location in the material, but how to integrate them in comsol or any other postprocessing software? Can you show me simply how to do it? Thanks, % x 0.071 0.071 0.069781614 0.066606098 0.070207608 0.068316062 y -0.04 -0.04 -0.044783645 -0.041805078 -0.043901277 -0.046817275 z 0.1116 0.107269484 0.1116 0.1116 0.106316936 0.107818497 jh.H0 (J/kg) @ t=0 520322.6718 520327.721 520337.4573 520306.691 520351.3471 520336.7744 jh.H0 (J/kg) @ t=900 858315.0763 862184.7099 860672.0054 861906.5826 865079.9856 864478.9603

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月1日 GMT-4 15:22
Hi

I do normally everything within the GUI, check the example, if you need the time evolution, or difference between two times you need to fidle with the at() operator in the postprocessing

--
Good luck
Ivar
Hi I do normally everything within the GUI, check the example, if you need the time evolution, or difference between two times you need to fidle with the at() operator in the postprocessing -- Good luck Ivar


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月2日 GMT-4 13:41
I am sorry Ivar, I am not open the file you attached. I tried several different machine and it still does not work. I am using Comsol 4.2, Can you check your file and upload it again? Thanks!!!
I am sorry Ivar, I am not open the file you attached. I tried several different machine and it still does not work. I am using Comsol 4.2, Can you check your file and upload it again? Thanks!!!

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月2日 GMT-4 17:26
Hi

sorry I have only 4.2a installed, I agree the chase of versions is tricky and makes life difficult for exchanges, computer time ...

--
Good luck
Ivar
Hi sorry I have only 4.2a installed, I agree the chase of versions is tricky and makes life difficult for exchanges, computer time ... -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年5月2日 GMT-4 19:29
Thanks anyway, hope I can find some other people open it for me..

Can you try post a picture for the procedures doing that, I mean, calculate the enthalpy in GUI?

Thanks so much, Ivar!
Thanks anyway, hope I can find some other people open it for me.. Can you try post a picture for the procedures doing that, I mean, calculate the enthalpy in GUI? Thanks so much, Ivar!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年2月23日 GMT-5 01:12
Hi Ivar,
I am using artificial diffusion in comsol . as the effect of the articial diffusion is correlated with the mesh size, therefore I am really interested in how can I know the mesh size. I have tired the method you described here but no luck. Is there any embedded way that allows us to obtain the average mesh size?
Hi Ivar, I am using artificial diffusion in comsol . as the effect of the articial diffusion is correlated with the mesh size, therefore I am really interested in how can I know the mesh size. I have tired the method you described here but no luck. Is there any embedded way that allows us to obtain the average mesh size?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年2月23日 GMT-5 07:41
Hi

I believe you have only the average "h" mesh size (field its h(x,y,z) ;) at disposal, as meshes can be rather anisotropic, sometimes I do too miss some sort of hx,hy,hz, the three components of "h"

COMSOL itself have different artificial diffusion methods, depending on the physics, check carefully the solver section of the doc

--
Good luck
Ivar
Hi I believe you have only the average "h" mesh size (field its h(x,y,z) ;) at disposal, as meshes can be rather anisotropic, sometimes I do too miss some sort of hx,hy,hz, the three components of "h" COMSOL itself have different artificial diffusion methods, depending on the physics, check carefully the solver section of the doc -- Good luck Ivar

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.