diff --git a/src/io/io.f90 b/src/io/io.f90 index 503f61659..8fd3381a8 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -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) @@ -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 diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index 0b84fa40b..56e20a018 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -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 diff --git a/src/rmvs/rmvs_setup.f90 b/src/rmvs/rmvs_setup.f90 index ff083815a..d3beeb2f8 100644 --- a/src/rmvs/rmvs_setup.f90 +++ b/src/rmvs/rmvs_setup.f90 @@ -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)) diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index e6678effa..9a7fe7e78 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -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 @@ -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