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

Commit

Permalink
Skip calculation of kick if c_lm = 0; to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
anand43 committed Jan 25, 2024
1 parent 9e8d9f6 commit 592f1e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMp
do l = 1, l_max ! skipping the l = 0 term; It is the spherical body term
do m = 0, l

! If c_lm is too small, skip the iteration to improve performance
if (abs(c_lm(m+1, l+1, 1)) < epsilon(0.0_DP) .and. abs(c_lm(m+1, l+1, 2)) < epsilon(0.0_DP)) then
cycle
endif

! Associated Legendre Polynomials
lmindex = PlmIndex(l, m)
plm = p(lmindex) ! p_l,m
Expand Down

0 comments on commit 592f1e5

Please sign in to comment.