Personal tools
You are here: Home Forum Use Re: How to get the volume of two different meshes ?

Re: How to get the volume of two different meshes ?

Up to Use

Re: How to get the volume of two different meshes ?

Posted by Markus Gruber at March 27. 2013

I am having a mesh with two submeshes and i just want to have for post - processing the (real)  volume of this sub-meshes

 

here is a short extract from my python script

  inter_block_ss = geompy.GetInPlaceByHistory(partiton_block_spheres, inter_block)
  id_block_ss = geompy.addToStudyInFather(partiton_block_spheres,inter_block_ss, "1")

  #interected Spheres
  part_spheres_ss = geompy.GetInPlaceByHistory(partiton_block_spheres, part_spheres)
  id_block_ss = geompy.addToStudyInFather(partiton_block_spheres,part_spheres_ss, "2")

 .

.

 mesh_int_block = smesh.Mesh(partiton_block_spheres )

.

.

#Create Groups of Meshes

###############################################

####Block
 id_sub_mesh_int_block = mesh_int_block.GroupOnGeom(inter_block_ss ,'1')

####Spheres
 
 id_sub_mesh_sphere = mesh_int_block.GroupOnGeom(part_spheres_ss,'2')

 

isDone = mesh_int_block.Compute()

 

and after computing  the meshes(es) , i just want to have the (real) volume

with best regards

 

 

Re: How to get the volume of two different meshes ?

Posted by SMESH expert at March 27. 2013

Hello Markus

Mesh volume can't be currently retrieved directly, this feature will appear in a version (not in the nearest version).

So far you can calculate volume of a mesh group using the following code.

p, li { white-space: pre-wrap; }

vol = 0.

for v in id_sub_mesh_int_block.GetIDs():

    vol += mesh.GetVolume( v )

Best regards

Edward

Re: How to get the volume of two different meshes ?

Posted by Robert at October 04. 2013

Hi Edward,

I could not follow your solution, I'm new to salome and also python.

I have imported a mesh (.med) to salome meca and I want to calculate the volume of a group (group_1) of that mesh.

How should I define that object and calculate the volume of its elements?

Thanks,

BME

Re: How to get the volume of two different meshes ?

Posted by jeanpierreaubry at October 04. 2013

hello

 

quite easy in Aster, 

add this in the .comm file and run

 

massin=POST_ELEM(

MODELE=model, #your model name

CHAM_MATER=material, #your material, must contain a value for RHO

#CARA_ELEM=elemcar, #not necessary in 3D elements

MASS_INER=_F(GROUP_MA=('group_1,),),

TITRE= 'massin',

);

IMPR_TABLE (TABLE=massin,)

 

mass divide by RHO gives volume

 

jean pierre aubry

Re: How to get the volume of two different meshes ?

Posted by Robert at October 04. 2013

Hi Jean,

Thanks for your quick reply. I can calculate the mass this way in CA, but I get two different volume for 1st and 2nd order elements for the same mesh which is very surprising. That's why I want to double check it with salome meca. 

Best regards,

bme

Re: How to get the volume of two different meshes ?

Posted by jeanpierreaubry at October 05. 2013

it may be true, it depends on the value of the differences

second order depicts more closely the geometry

take a cylinder with 4 nodes in the circumference

the mesh looks likes an extruded square, volume of the mesh is 2/pi the cylinder volume

with a second order mesh the mehs looks like an extruded octagon, volume of the mesh is 2*sqrt(2)/pi the cylinder volume

with more nodes the difference is less of course

Re: How to get the volume of two different meshes ?

Posted by Robert at October 07. 2013

yes, it should be more accurate for 2nd order elements, but the thing is, no matter how much I refine my mesh with Homard, the results of 1st order elements does not converge to 2nd order results.

Re: How to get the volume of two different meshes ?

Posted by jeanpierreaubry at October 07. 2013

without having the problem in hands it is impossible to say more

Powered by Ploneboard
Document Actions