# Info about mesh quality

**URL:** <https://community.freefem.org/t/info-about-mesh-quality/662>\
**Category:** General Discussion\
**Created:** [November 20, 2020, 9:30am UTC](https://community.freefem.org/t/info-about-mesh-quality/662 "2020-11-20T09:30:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)\
**Post date:** [November 20, 2020, 9:30am UTC](https://community.freefem.org/t/info-about-mesh-quality/662/1 "2020-11-20T09:30:10Z")

</div>

Dear FreeFem users,

I’d like to know if there is an option to get information about mesh quality such as :

- the quality of a tetrahedron, or the quality of all elements and indicate the worst one
- the volume of a tetrahedron
- the length of the edges of a tetrahedron

Thanks in advance!

Lily

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [November 23, 2020, 5:38pm UTC](https://community.freefem.org/t/info-about-mesh-quality/662/2 "2020-11-23T17:38:07Z")

</div>

first I think that the mesh generator given this value,

but radius rho of inscribe sphere in tetrahedron K isgiven by  
 rho(K) = 6 V(K)/S(K) where V(K) is the volume of K and S(K) is the area of the  
surface of K.

so in freefem in see this examples:

mesh-quality.edp|attachment](upload://16y6CexNMWGudRVvldnQnNptLnn.edp) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)\
**Post date:** [November 23, 2020, 6:44pm UTC](https://community.freefem.org/t/info-about-mesh-quality/662/3 "2020-11-23T18:44:40Z")

</div>

Of course, the mesh generator gives this value but I’d like to use it in FreeFem to impose some conditions.

Sorry, the attachment failed. I don’t have access to the example. Can you load it again? Thank you !

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [November 30, 2020, 10:40am UTC](https://community.freefem.org/t/info-about-mesh-quality/662/4 "2020-11-30T10:40:29Z")

</div>

[mesh-quality.edp](https://community.freefem.org/uploads/short-url/16y6CexNMWGudRVvldnQnNptLnn.edp) (1.1 KB)

or the script :

{  
// classical mesh quality computation of mesh quality 2 sqrt(3) h/rho 1 best …  
mesh Th=square(1,1);  
Th=adaptmesh(Th,0.1,IsMetric=1,nbvx=1000);  
plot(Th,wait=1);  
real cc = 4_sqrt(3);// 3 / ( sqrt(3)/4 )  
fespace Ph(Th,P0);  
varf vquality1(uu,chi)= intalledges(Th)(hTriangle_chi/area/cc);// b_h = 2 area =\> ïnt dK 1 rho = 2 area  
Ph q; q[] =vquality1(0,Ph);  
plot(q,fill=1);  
q[].sort;  
for( int i=0; i\<=5; ++i )  
{  
int j = (q[].n-1)i/5;  
cout\<\< " quantile " \<\<i \<\< " : "\<\< j \<\< " quality " \<\< q[][j] \<\< endl;  
}  
}  
{ // same in 3d …  
load “msh3”  
// in 3d …  
// V = a^3/(6 sqrt(2))  
// S = a^3 sqrt(3)  
real cc= sqrt(3)(6_sqrt(2));// S/V  
mesh3 Th=cube(10,10,10);  
fespace Ph(Th,P0);  
fespace Vh(Th,P1);  
//func real f(real p) { cout \<\<nuTriangle \<\< " " \<\< hTriangle \<\< " "\<\< volume \<\< " "\<\< area \<\< endl ; return 1;}  
varf vquality1(uu,chi)= intallfaces(Th)(hTriangle\*chi/volume/cc);//  
Ph q; q[] =vquality1(0,Ph);  
cout \<\< q[].min \<\< " " \<\< q[].max \<\< endl;  
Vh q1=q;  
plot(q1,wait=1);  
q[].sort;  
for( int i=0; i\<=5; ++i )  
{  
int j = (q[].n-1)\*i/5;  
cout\<\< " quantile " \<\<j \<\< " quality " \<\< q[][j] \<\< endl;  
}

}

---

<div class="post-metadata">

**Author:** ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)\
**Post date:** [December 1, 2020, 9:21pm UTC](https://community.freefem.org/t/info-about-mesh-quality/662/5 "2020-12-01T21:21:04Z")

</div>

Thank you very much !
