Hello,
In the file mom4_beta2/shared/spherical_regrid/spherical_regrid.F90
starting at line 592 we have
--------------
s = sqrt(cross(1)**2.+cross(2)**2.+cross(3)**2.)
if (abs(s - 1.0) < epsln) s = s - epsln ! fix possible floating point exception
! for some compilers
dot = r1(1)*r2(1) + r1(2)*r2(2) + r1(3)*r2(3)
if (dot > 0) then
ang = asin(s)
else if (dot < 0) then
ang = pi - asin(s)
else
ang = pi/2.
endif
==============================================
This is not the correct way to the value of 's' due to roundoff errors
since it does not guarantee that the value of 's' will be less than 1 and
therefore be an illegal argument to the asin function.
The statement
if (abs(s - 1.0) < epsln) s = s - epsln
should be replaced by
s=min(s,1.0)
or (if one wants s to be strictly less than 1)
s=min(s,nearest(1.0,-1.0))
where nearest is the F90 intrinsic.
s=min(s,1.0-epsln)
should also be satisfactory.
Cheers,
Russ Fiedler
-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing
real-time communications platform! Don't just IM. Build it in!
http://www.jabber.com/osdn/xim
_______________________________________________
FMS-mom4 mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fms-mom4