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

Commit

Permalink
Rearranged code so that the loblatecb flag gets called during the set…
Browse files Browse the repository at this point in the history
…up phase, regardless if we are using NetCDF or binary input
  • Loading branch information
daminton committed Mar 4, 2022
1 parent 757118c commit 22d5f3a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,6 @@ subroutine io_read_in_cb(self, param)

if (ierr == 0) then

param%loblatecb = ((self%j2rp2 /= 0.0_DP) .or. (self%j4rp4 /= 0.0_DP))
if (param%rmin < 0.0) param%rmin = self%radius

select type(cb => self)
Expand Down Expand Up @@ -1420,6 +1419,12 @@ module subroutine io_read_in_system(self, param)
self%Euntracked = param%Euntracked
end if

param%loblatecb = ((self%cb%j2rp2 /= 0.0_DP) .or. (self%cb%j4rp4 /= 0.0_DP))
if (.not.param%loblatecb) then
if (allocated(self%pl%aobl)) deallocate(self%pl%aobl)
if (allocated(self%tp%aobl)) deallocate(self%tp%aobl)
end if

return
end subroutine io_read_in_system

Expand Down
1 change: 0 additions & 1 deletion src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ module function netcdf_read_frame_system(self, iu, param) result(ierr)

call check( nf90_get_var(iu%ncid, iu%j2rp2_varid, cb%j2rp2, start=[tslot]) )
call check( nf90_get_var(iu%ncid, iu%j4rp4_varid, cb%j4rp4, start=[tslot]) )
param%loblatecb = ((cb%j2rp2 /= 0.0_DP) .or. (cb%j4rp4 /= 0.0_DP))

call self%read_particle_info(iu, param, plmask, tpmask)
end associate
Expand Down
8 changes: 2 additions & 6 deletions src/rmvs/rmvs_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ module subroutine rmvs_setup_pl(self, n, param)
do i = 0, NTPHENC
allocate(pl%inner(i)%x(NDIM, n))
allocate(pl%inner(i)%v(NDIM, n))
allocate(pl%inner(i)%aobl(NDIM, n))
pl%inner(i)%x(:,:) = 0.0_DP
pl%inner(i)%v(:,:) = 0.0_DP
pl%inner(i)%aobl(:,:) = 0.0_DP
end do
if (param%loblatecb) then
do i = 0, NTPHENC
allocate(pl%inner(i)%aobl(NDIM, n))
pl%inner(i)%aobl(:,:) = 0.0_DP
end do
end if
if (param%ltides) then
do i = 0, NTPHENC
allocate(pl%inner(i)%atide(NDIM, n))
Expand Down
10 changes: 4 additions & 6 deletions src/setup/setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ module subroutine setup_body(self, n, param)
allocate(self%vb(NDIM, n))
allocate(self%ah(NDIM, n))
allocate(self%ir3h(n))
allocate(self%aobl(NDIM, n))

self%id(:) = 0
do i = 1, n
Expand All @@ -216,20 +217,17 @@ module subroutine setup_body(self, n, param)
end do

self%status(:) = INACTIVE
self%lmask(:) = .false.
self%ldiscard(:) = .false.
self%lmask(:) = .false.
self%mu(:) = 0.0_DP
self%xh(:,:) = 0.0_DP
self%vh(:,:) = 0.0_DP
self%xb(:,:) = 0.0_DP
self%vb(:,:) = 0.0_DP
self%ah(:,:) = 0.0_DP
self%ir3h(:) = 0.0_DP
self%mu(:) = 0.0_DP
self%aobl(:,:) = 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

0 comments on commit 22d5f3a

Please sign in to comment.