Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Changed normalisation to 4pi to be consistent everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
anand43 committed Nov 10, 2023
1 parent 7b297d4 commit 6b2c496
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph,
fac2 = 2 * t0 * (t1 - (2.0_DP - (14.0_DP * t2 / 3.0_DP)) * t3)

if(cos(theta) > epsilon(0.0_DP)) then
call PLegendreA_d1(p, p_deriv, l_max, cos(theta)) ! Unnormalized Associated Legendre Polynomials and the 1st Derivative
call PlmBar_d1(p, p_deriv, l_max, cos(theta)) ! Unnormalized Associated Legendre Polynomials and the 1st Derivative
else
call PLegendreA_d1(p, p_deriv, l_max, 0.0_DP)
call PlmBar_d1(p, p_deriv, l_max, 0.0_DP)
end if

do l = 1, l_max ! skipping the l = 0 term; It is the spherical body term
Expand Down
4 changes: 2 additions & 2 deletions swiftest/sph_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def clm_from_ellipsoid(mass, density, a, b = None, c = None, lmax = 6, ref_radiu

# get gravity coefficients
clm_class = pysh.SHGravCoeffs.from_shape(shape_SH, rho = density, gm = Gmass) # 4pi normalization
clm = clm_class.to_array(normalization = 'ortho') # Change to orthonormal normalization
clm = clm_class.to_array(normalization = '4pi') # export as array with 4pi normalization

# Return reference radius EQUALS the radius of the Central Body
print(f'Ensure that the Central Body radius equals the reference radius.')
Expand Down Expand Up @@ -123,7 +123,7 @@ def clm_from_relief(mass, density, grid, lmax = 6, ref_radius = True):

# get coefficients
clm_class = pysh.SHGravcoeffs.from_shape(shape_SH, rho = density, gm = Gmass) # 4pi normalization
clm = clm_class.to_array(normalization = 'ortho') # change to orthogonal normalization
clm = clm_class.to_array(normalization = '4pi') # export as array with 4pi normalization

# Return reference radius EQUALS the radius of the Central Body

Expand Down

0 comments on commit 6b2c496

Please sign in to comment.