Check mesh quality in mixed element type volume with python

Hi,

I would like to check the quality of meshed volume with python to make some smoothing iterations if the quality is bad. In my cas I have mixed element type volume and I found that the “get_quality_stats_at_geometry does not support element type pyramid”.
Can you suggest me the best way to do it ? i.e. give me a list of all type elements in a volume and the value the minimum value for “scaled Jacobian” quality.

Thanks
Rocco

Hello Rocco,

you could get the quality for pyramids with get_quality_value for example. With this you can query quality metrics for a specific element.

Here is a short example that prints out the lowest quality for pyramid elements.

#!cubit
reset
create brick x 1
create brick x 1
move vol 1 x -0.5
move vol 2 x 0.5
imprint vol all
merge vol all
mesh vol 2
vol 1 scheme tetmesh
mesh vol 1

draw vol 2
draw pyramid all color red add

#!python
pyr_ids = cubit.parse_cubit_list("pyramid","all in vol 1")
quality_values = []
for id in pyr_ids:
 quality_values.append(cubit.get_quality_value("pyramid",id,"scaled jacobian"))

print(f"The lowest quality is {min(quality_values)}")