From bf05e2053b371a1e0491883698b64af0e5823d85 Mon Sep 17 00:00:00 2001 From: Mark Wieczorek Date: Thu, 18 Apr 2024 11:30:59 +0200 Subject: [PATCH] Add test for triaxial centrifugal potential --- boule/tests/test_triaxialellipsoid.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/boule/tests/test_triaxialellipsoid.py b/boule/tests/test_triaxialellipsoid.py index f97c21b6..e3433cea 100644 --- a/boule/tests/test_triaxialellipsoid.py +++ b/boule/tests/test_triaxialellipsoid.py @@ -295,3 +295,25 @@ def test_geocentric_radius_biaxialellipsoid(triaxialellipsoid): npt.assert_allclose( radius_true, biaxialellipsoid.geocentric_radius(longitude, latitude) ) + + +def test_centrifugal_potential(triaxialellipsoid): + """ + Test that the centrifugal potential on the surface is greater along the + semimajor axis than the semimedium axis, and that the centrifugal potential + is zero at the poles. + """ + height = 2 * [0, 1, 1000] + latitude = 3 * [-90] + 3 * [90] + longitude = np.linspace(0, 360, 6) + assert ( + triaxialellipsoid.centrifugal_potential( + longitude=longitude, latitude=latitude, height=height + ) + < 1e-15 + ).all() + assert triaxialellipsoid.centrifugal_potential( + longitude=0, latitude=0, height=height + ) >= triaxialellipsoid.centrifugal_potential( + longitude=90, latitude=0, height=height + )