From 46f0fa33e7bb165989f864e1e8e15c2f8ddd0155 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 26 Oct 2021 08:19:26 -0400 Subject: [PATCH 1/2] Switched back to opening bin.nc in write mode and keeping it open when reading it in on a restart --- src/netcdf/netcdf.f90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index a4ee55c8c..44ba0e58d 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -68,7 +68,7 @@ module function netcdf_get_old_t_final_system(self, param) result(old_t_final) real(DP), dimension(1) :: val real(DP) :: KE_orb_orig, KE_spin_orig, PE_orig, Ltmp - call param%nciu%open(param, readonly=.true.) + call param%nciu%open(param) call check( nf90_inquire_dimension(param%nciu%ncid, param%nciu%time_dimid, len=itmax) ) call check( nf90_inquire_dimension(param%nciu%ncid, param%nciu%id_dimid, len=idmax) ) allocate(vals(idmax)) @@ -110,7 +110,6 @@ module function netcdf_get_old_t_final_system(self, param) result(old_t_final) end if deallocate(vals) - call param%nciu%close() return end function netcdf_get_old_t_final_system From 3a02f5b1a56f8537862c74b06328e5104655f709 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 26 Oct 2021 10:07:24 -0400 Subject: [PATCH 2/2] Moved the set_renc methods inside the various flavors of encounter_check so that it always has the most up-to-date value at the time it is called --- src/symba/symba_encounter_check.f90 | 5 +++++ src/symba/symba_step.f90 | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/symba/symba_encounter_check.f90 b/src/symba/symba_encounter_check.f90 index 7c40516b6..f75fc49f2 100644 --- a/src/symba/symba_encounter_check.f90 +++ b/src/symba/symba_encounter_check.f90 @@ -35,6 +35,8 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l nplm = pl%nplm nplt = npl - nplm + call pl%set_renc(irec) + if (nplt == 0) then call encounter_check_all_plpl(param, npl, pl%xh, pl%vh, pl%renc, dt, lvdotr, index1, index2, nenc) else @@ -116,6 +118,8 @@ module function symba_encounter_check(self, param, system, dt, irec) result(lany nenc_enc = count(lencmask(:)) if (nenc_enc == 0) return + call pl%set_renc(irec) + allocate(encidx(nenc_enc)) allocate(lencounter(nenc_enc)) encidx(:) = pack([(k, k = 1, self%nenc)], lencmask(:)) @@ -203,6 +207,7 @@ module function symba_encounter_check_tp(self, param, system, dt, irec) result(l if (self%nbody == 0) return associate(tp => self, ntp => self%nbody, pl => system%pl, npl => system%pl%nbody) + call pl%set_renc(irec) call encounter_check_all_pltp(param, npl, ntp, pl%xh, pl%vh, tp%xh, tp%vh, pl%renc, dt, lvdotr, index1, index2, nenc) lany_encounter = nenc > 0 diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index ba4c1a734..eac112dcd 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -173,7 +173,6 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) nloops = NTENC end if do j = 1, nloops - call system%pl%set_renc(irecp) lencounter = plplenc_list%encounter_check(param, system, dtl, irecp) .or. pltpenc_list%encounter_check(param, system, dtl, irecp) call plplenc_list%kick(system, dth, irecp, 1)