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

Commit

Permalink
Fixed issue where oblateness acceleration variable was being allocate…
Browse files Browse the repository at this point in the history
…d when settting up bodies for non-oblate central bodies.
  • Loading branch information
daminton committed May 10, 2023
1 parent 678e812 commit 1da2306
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/base/base_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,7 @@ subroutine base_util_spill_arr_char_string(keeps, discards, lspill_list, ldestru
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down Expand Up @@ -1096,6 +1097,7 @@ subroutine base_util_spill_arr_DP(keeps, discards, lspill_list, ldestructive)
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down Expand Up @@ -1138,6 +1140,7 @@ subroutine base_util_spill_arr_DPvec(keeps, discards, lspill_list, ldestructive)
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(NDIM, nspill))
else if (size(discards, dim=2) /= nspill) then
Expand Down Expand Up @@ -1184,6 +1187,7 @@ subroutine base_util_spill_arr_I4B(keeps, discards, lspill_list, ldestructive)
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down Expand Up @@ -1226,6 +1230,7 @@ subroutine base_util_spill_arr_I8B(keeps, discards, lspill_list, ldestructive)
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down Expand Up @@ -1268,6 +1273,7 @@ subroutine base_util_spill_arr_logical(keeps, discards, lspill_list, ldestructiv
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down
8 changes: 6 additions & 2 deletions src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,6 @@ module subroutine swiftest_util_setup_body(self, n, param)
allocate(self%vb(NDIM, n))
allocate(self%ah(NDIM, n))
allocate(self%ir3h(n))
allocate(self%aobl(NDIM, n))
allocate(self%isperi(n))
allocate(self%peri(n))
allocate(self%atp(n))
Expand Down Expand Up @@ -2465,11 +2464,14 @@ module subroutine swiftest_util_setup_body(self, n, param)
self%vb(:,:) = 0.0_DP
self%ah(:,:) = 0.0_DP
self%ir3h(:) = 0.0_DP
self%aobl(:,:) = 0.0_DP
self%isperi(:) = 1
self%peri(:) = 0.0_DP
self%atp(:) = 0.0_DP

if (param%loblatecb) then
allocate(self%aobl(NDIM, n))
self%aobl(:,:) = 0.0_DP
end if
if (param%ltides) then
allocate(self%atide(NDIM, n))
self%atide(:,:) = 0.0_DP
Expand Down Expand Up @@ -2996,6 +2998,7 @@ module subroutine swiftest_util_spill_arr_info(keeps, discards, lspill_list, lde
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down Expand Up @@ -3043,6 +3046,7 @@ module subroutine swiftest_util_spill_arr_kin(keeps, discards, lspill_list, ldes
nlist = size(lspill_list(:))

if (.not.allocated(keeps) .or. nspill == 0) return
if (size(keeps) < nkeep) return
if (.not.allocated(discards)) then
allocate(discards(nspill))
else if (size(discards) /= nspill) then
Expand Down

0 comments on commit 1da2306

Please sign in to comment.