Skip to content

Commit c5c46e7

Browse files
committed
Merge branch 'operators/sphere_angle_nonunit_radius_fix' into hotfix-v8.0.2 (PR #1148)
This merge generalizes the mpas_sphere_angle function so that it provides correct results for non-unit-radius spheres. The methods previously employed in the mpas_sphere_angle function for computing the side lengths of a spherical triangle were only applicable to unit-radius spheres. This merge generalizes the computation of these side lengths so that the mpas_sphere_angle function can be used to compute spherical angles on spheres of arbitrary radius. This merge closes Issue #1149.
2 parents 9b2d183 + 35b28c7 commit c5c46e7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/operators/mpas_geometry_utils.F

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ real (kind=RKIND) function mpas_sphere_angle(ax, ay, az, bx, by, bz, cx, cy, cz)
4242
real (kind=RKIND) :: s ! Semiperimeter of the triangle
4343
real (kind=RKIND) :: sin_angle
4444

45-
a = acos(max(min(bx*cx + by*cy + bz*cz,1.0_RKIND),-1.0_RKIND)) ! Eqn. (3)
46-
b = acos(max(min(ax*cx + ay*cy + az*cz,1.0_RKIND),-1.0_RKIND)) ! Eqn. (2)
47-
c = acos(max(min(ax*bx + ay*by + az*bz,1.0_RKIND),-1.0_RKIND)) ! Eqn. (1)
45+
46+
a = mpas_arc_length(bx, by, bz, cx, cy, cz)
47+
b = mpas_arc_length(ax, ay, az, cx, cy, cz)
48+
c = mpas_arc_length(ax, ay, az, bx, by, bz)
4849

4950
ABx = bx - ax
5051
ABy = by - ay

0 commit comments

Comments
 (0)