# Error element face midpoint distance

**URL:** <https://community.geodynamics.org/t/error-element-face-midpoint-distance/1456>\
**Category:** SPECFEM\
**Created:** [September 18, 2020, 3:49pm UTC](https://community.geodynamics.org/t/error-element-face-midpoint-distance/1456 "2020-09-18T15:49:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jflorescuba](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jflorescuba](https://community.geodynamics.org/u/jflorescuba)\
**Post date:** [September 18, 2020, 3:49pm UTC](https://community.geodynamics.org/t/error-element-face-midpoint-distance/1456/1 "2020-09-18T15:49:15Z")

</div>

Hello  
I am trying to run specfem3D for a mesh (2layer model) of 5kmx5kmx5km and element size 120m. I am using the stacey absorbing condition. when the database generation is running, I got the following message.

running database generation…

error element face midpoint distance: 0.250000000 - edge length: 899.995422 tolerance: 8.99995416E-02  
error corner: 1 xyz: 1040620.06 6291391.00 -191.233078  
error corner: 2 xyz: 1040620.06 6291391.00 -161.232971  
error corner: 3 xyz: 1040721.06 6291418.50 -159.854706  
error corner: 4 xyz: 1040721.06 6291418.50 -189.854630  
reference : 1 xyz: 1040721.06 6291418.50 -189.854630  
reference : 2 xyz: 1040721.06 6291418.50 -159.854706  
reference : 3 xyz: 1040620.06 6291391.00 -161.232971  
reference : 4 xyz: 1040620.06 6291391.00 -191.233078  
error element face midpoint distance: 0.250000000 - edge length: 900.000000 tolerance: 8.99999961E-02  
error corner: 1 xyz: 1037963.50 6292375.00 -164.766586  
error corner: 2 xyz: 1037963.50 6292490.00 -166.629639  
error corner: 3 xyz: 1037963.50 6292486.50 -106.794266  
error corner: 4 xyz: 1037963.50 6292375.00 -134.766586  
reference : 1 xyz: 1037963.50 6292375.00 -164.766586  
reference : 2 xyz: 1037963.50 6292375.00 -134.766586  
reference : 3 xyz: 1037963.50 6292486.50 -106.794266  
reference : 4 xyz: 1037963.50 6292490.00 -166.629639  
error element face midpoint distance: 0.253906250 - edge length: 900.045349 tolerance: 9.00045335E-02  
error corner: 1 xyz: 1041508.19 6294986.50 -98.7428589  
error corner: 2 xyz: 1041508.25 6294986.50 -68.7457809  
error corner: 3 xyz: 1041431.06 6295078.00 -58.3097878  
error corner: 4 xyz: 1041431.12 6295078.00 -88.3104782  
reference : 1 xyz: 1041431.12 6295078.00 -88.3104782  
reference : 2 xyz: 1041431.06 6295078.00 -58.3097878  
reference : 3 xyz: 1041508.25 6294986.50 -68.7457809  
reference : 4 xyz: 1041508.19 6294986.50 -98.7428589  
error element face midpoint distance: 0.250000000 - edge length: 1841.46899 tolerance: 0.184146896  
error corner: 1 xyz: 1037963.50 6294120.00 -22.6280594  
error corner: 2 xyz: 1037963.50 6294119.00 19.5043087  
error corner: 3 xyz: 1037963.50 6293996.50 19.3953953  
error corner: 4 xyz: 1037963.50 6293997.50 -23.5052948  
reference : 1 xyz: 1037963.50 6293997.50 -23.5052948  
reference : 2 xyz: 1037963.50 6293996.50 19.3953953  
reference : 3 xyz: 1037963.50 6294119.00 19.5043087  
reference : 4 xyz: 1037963.50 6294120.00 -22.6280594  
STOP error element face midpoint  
STOP error element face midpoint  
STOP error element face midpoint  
STOP error element face midpoint

any suggestions?  
Thanks

---

<div class="post-metadata">

**Author:** ![dpeter](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/dpeter/32/227_2.png) [@dpeter](https://community.geodynamics.org/u/dpeter)\
**Post date:** [September 21, 2020, 9:59am UTC](https://community.geodynamics.org/t/error-element-face-midpoint-distance/1456/2 "2020-09-21T09:59:07Z")

</div>

looks like your mesh coordinates are a bit large (e.g. y-coordinates around 6,294,120 m) which makes the numerical precision less sensitive, thus the default tolerance value for these face detections becomes too small.

as a quick check to see if things would go round, you could modify the tolerance value in file src/shared/get\_element\_face.f90 (around line 57):  
…  
! distance tolerance (relative to coordinate range)  
real(kind=CUSTOM\_REAL), parameter :: TOL\_DIST = 1.e-4  
…

to something like:  
real(kind=CUSTOM\_REAL), parameter :: TOL\_DIST = 1.e-3

which would be enough for the values given in your output log.
