From 061cb9bb5a0ac31fdc829b868fd65eca2f2cc092 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 1 Nov 2022 12:58:46 -0400 Subject: [PATCH] Commented out most of the un-used tide stuff. To be reactivated and completed next Someday. --- src/fraggle/fraggle_io.f90 | 28 +++++++++---------- src/helio/helio_kick.f90 | 17 +++++------ src/io/io.f90 | 40 +++++++++++++------------- src/modules/swiftest_classes.f90 | 31 +++++++++++---------- src/netcdf/netcdf.f90 | 48 ++++++++++++++++---------------- src/rmvs/rmvs_setup.f90 | 12 ++++---- src/rmvs/rmvs_step.f90 | 29 ++++++++++--------- src/symba/symba_collision.f90 | 10 +++---- src/whm/whm_kick.f90 | 11 ++++---- src/whm/whm_step.f90 | 2 +- 10 files changed, 117 insertions(+), 111 deletions(-) diff --git a/src/fraggle/fraggle_io.f90 b/src/fraggle/fraggle_io.f90 index fd15cf058..b1a60a25b 100644 --- a/src/fraggle/fraggle_io.f90 +++ b/src/fraggle/fraggle_io.f90 @@ -128,20 +128,20 @@ module subroutine fraggle_io_log_pl(pl, param) end do end if - if (param%ltides) then - write(LUN, *) "Q" - do i = 1, pl%nbody - write(LUN, *) i, pl%Q(i) - end do - write(LUN, *) "k2" - do i = 1, pl%nbody - write(LUN, *) i, pl%k2(i) - end do - write(LUN, *) "tlag" - do i = 1, pl%nbody - write(LUN, *) i, pl%tlag(i) - end do - end if + ! if (param%ltides) then + ! write(LUN, *) "Q" + ! do i = 1, pl%nbody + ! write(LUN, *) i, pl%Q(i) + ! end do + ! write(LUN, *) "k2" + ! do i = 1, pl%nbody + ! write(LUN, *) i, pl%k2(i) + ! end do + ! write(LUN, *) "tlag" + ! do i = 1, pl%nbody + ! write(LUN, *) i, pl%tlag(i) + ! end do + ! end if close(LUN) diff --git a/src/helio/helio_kick.f90 b/src/helio/helio_kick.f90 index 8ad60db7b..067a6195c 100644 --- a/src/helio/helio_kick.f90 +++ b/src/helio/helio_kick.f90 @@ -37,14 +37,15 @@ module subroutine helio_kick_getacch_pl(self, system, param, t, lbeg) else cb%aoblend = cb%aobl end if - if (param%ltides) then - call pl%accel_tides(system) - if (lbeg) then - cb%atidebeg = cb%atide - else - cb%atideend = cb%atide - end if - end if + ! TODO: Implement tides + ! if (param%ltides) then + ! call pl%accel_tides(system) + ! if (lbeg) then + ! cb%atidebeg = cb%atide + ! else + ! cb%atideend = cb%atide + ! end if + ! end if end if if (param%lextra_force) call pl%accel_user(system, param, t, lbeg) if (param%lgr) call pl%accel_gr(param) diff --git a/src/io/io.f90 b/src/io/io.f90 index 208b5d2ed..aa797ddbe 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -1559,10 +1559,10 @@ module function io_read_frame_body(self, iu, param) result(ierr) read(iu, err = 667, iomsg = errmsg) pl%rot(2, :) read(iu, err = 667, iomsg = errmsg) pl%rot(3, :) end if - if (param%ltides) then - read(iu, err = 667, iomsg = errmsg) pl%k2(:) - read(iu, err = 667, iomsg = errmsg) pl%Q(:) - end if + ! if (param%ltides) then + ! read(iu, err = 667, iomsg = errmsg) pl%k2(:) + ! read(iu, err = 667, iomsg = errmsg) pl%Q(:) + ! end if end select param%maxid = max(param%maxid, maxval(self%id(1:n))) @@ -1599,10 +1599,10 @@ module function io_read_frame_body(self, iu, param) result(ierr) read(iu, *, err = 667, iomsg = errmsg) self%Ip(1, i), self%Ip(2, i), self%Ip(3, i) read(iu, *, err = 667, iomsg = errmsg) self%rot(1, i), self%rot(2, i), self%rot(3, i) end if - if (param%ltides) then - read(iu, *, err = 667, iomsg = errmsg) self%k2(i) - read(iu, *, err = 667, iomsg = errmsg) self%Q(i) - end if + ! if (param%ltides) then + ! read(iu, *, err = 667, iomsg = errmsg) self%k2(i) + ! read(iu, *, err = 667, iomsg = errmsg) self%Q(i) + ! end if end select param%maxid = param%maxid + 1 self%id(i) = param%maxid @@ -1667,10 +1667,10 @@ module function io_read_frame_cb(self, iu, param) result(ierr) read(iu, err = 667, iomsg = errmsg) self%rot(2) read(iu, err = 667, iomsg = errmsg) self%rot(3) end if - if (param%ltides) then - read(iu, err = 667, iomsg = errmsg) self%k2 - read(iu, err = 667, iomsg = errmsg) self%Q - end if + ! if (param%ltides) then + ! read(iu, err = 667, iomsg = errmsg) self%k2 + ! read(iu, err = 667, iomsg = errmsg) self%Q + ! end if ierr = 0 return @@ -2061,10 +2061,10 @@ module subroutine io_write_frame_body(self, iu, param) write(iu, err = 667, iomsg = errmsg) pl%rot(2, 1:n) write(iu, err = 667, iomsg = errmsg) pl%rot(3, 1:n) end if - if (param%ltides) then - write(iu, err = 667, iomsg = errmsg) pl%k2(1:n) - write(iu, err = 667, iomsg = errmsg) pl%Q(1:n) - end if + ! if (param%ltides) then + ! write(iu, err = 667, iomsg = errmsg) pl%k2(1:n) + ! write(iu, err = 667, iomsg = errmsg) pl%Q(1:n) + ! end if end select end associate @@ -2105,10 +2105,10 @@ module subroutine io_write_frame_cb(self, iu, param) write(iu, err = 667, iomsg = errmsg) cb%rot(2) write(iu, err = 667, iomsg = errmsg) cb%rot(3) end if - if (param%ltides) then - write(iu, err = 667, iomsg = errmsg) cb%k2 - write(iu, err = 667, iomsg = errmsg) cb%Q - end if + ! if (param%ltides) then + ! write(iu, err = 667, iomsg = errmsg) cb%k2 + ! write(iu, err = 667, iomsg = errmsg) cb%Q + ! end if end associate return diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index d58891fe5..aace128bf 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -287,7 +287,7 @@ module swiftest_classes procedure :: accel_int => kick_getacch_int_pl !! Compute direct cross (third) term heliocentric accelerations of massive bodies procedure :: accel_obl => obl_acc_pl !! Compute the barycentric accelerations of bodies due to the oblateness of the central body procedure :: setup => setup_pl !! A base constructor that sets the number of bodies and allocates and initializes all arrays - procedure :: accel_tides => tides_kick_getacch_pl !! Compute the accelerations of bodies due to tidal interactions with the central body + ! procedure :: accel_tides => tides_kick_getacch_pl !! Compute the accelerations of bodies due to tidal interactions with the central body procedure :: append => util_append_pl !! Appends elements from one structure to another procedure :: h2b => util_coord_h2b_pl !! Convert massive bodies from heliocentric to barycentric coordinates (position and velocity) procedure :: b2h => util_coord_b2h_pl !! Convert massive bodies from barycentric to heliocentric coordinates (position and velocity) @@ -401,7 +401,7 @@ module swiftest_classes procedure :: finalize => setup_finalize_system !! Runs any finalization subroutines when ending the simulation. procedure :: initialize => setup_initialize_system !! Initialize the system from input files procedure :: init_particle_info => setup_initialize_particle_info_system !! Initialize the system from input files - procedure :: step_spin => tides_step_spin_system !! Steps the spins of the massive & central bodies due to tides. + ! procedure :: step_spin => tides_step_spin_system !! Steps the spins of the massive & central bodies due to tides. procedure :: dealloc => util_dealloc_system !! Deallocates all allocatable components of the system procedure :: set_msys => util_set_msys !! Sets the value of msys from the masses of system bodies. procedure :: get_energy_and_momentum => util_get_energy_momentum_system !! Calculates the total system energy and momentum @@ -1109,19 +1109,20 @@ module subroutine setup_tp(self, n, param) class(swiftest_parameters), intent(in) :: param !! Current run configuration parametersr end subroutine setup_tp - module subroutine tides_kick_getacch_pl(self, system) - implicit none - class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object - class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object - end subroutine tides_kick_getacch_pl - - module subroutine tides_step_spin_system(self, param, t, dt) - implicit none - class(swiftest_nbody_system), intent(inout) :: self !! Swiftest nbody system object - class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters - real(DP), intent(in) :: t !! Simulation time - real(DP), intent(in) :: dt !! Current stepsize - end subroutine tides_step_spin_system + ! TODO: Implement the tides model + ! module subroutine tides_kick_getacch_pl(self, system) + ! implicit none + ! class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object + ! class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object + ! end subroutine tides_kick_getacch_pl + + ! module subroutine tides_step_spin_system(self, param, t, dt) + ! implicit none + ! class(swiftest_nbody_system), intent(inout) :: self !! Swiftest nbody system object + ! class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + ! real(DP), intent(in) :: t !! Simulation time + ! real(DP), intent(in) :: dt !! Current stepsize + ! end subroutine tides_step_spin_system module subroutine user_kick_getacch_body(self, system, param, t, lbeg) implicit none diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index 463bb80cf..0cd27f737 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -285,10 +285,10 @@ module subroutine netcdf_initialize_output(self, param) call check( nf90_def_var(self%ncid, ROTZ_VARNAME, self%out_type, [self%id_dimid, self%time_dimid], self%rotz_varid), "netcdf_initialize_output nf90_def_var rotz_varid" ) end if - if (param%ltides) then - call check( nf90_def_var(self%ncid, K2_VARNAME, self%out_type, [self%id_dimid, self%time_dimid], self%k2_varid), "netcdf_initialize_output nf90_def_var k2_varid" ) - call check( nf90_def_var(self%ncid, Q_VARNAME, self%out_type, [self%id_dimid, self%time_dimid], self%Q_varid), "netcdf_initialize_output nf90_def_var Q_varid" ) - end if + ! if (param%ltides) then + ! call check( nf90_def_var(self%ncid, K2_VARNAME, self%out_type, [self%id_dimid, self%time_dimid], self%k2_varid), "netcdf_initialize_output nf90_def_var k2_varid" ) + ! call check( nf90_def_var(self%ncid, Q_VARNAME, self%out_type, [self%id_dimid, self%time_dimid], self%Q_varid), "netcdf_initialize_output nf90_def_var Q_varid" ) + ! end if if (param%lenergy) then call check( nf90_def_var(self%ncid, KE_ORB_VARNAME, self%out_type, self%time_dimid, self%KE_orb_varid), "netcdf_initialize_output nf90_def_var KE_orb_varid" ) @@ -444,10 +444,10 @@ module subroutine netcdf_open(self, param, readonly) call check( nf90_inq_varid(self%ncid, ROTZ_VARNAME, self%rotz_varid), "netcdf_open nf90_inq_varid rotz_varid" ) end if - if (param%ltides) then - call check( nf90_inq_varid(self%ncid, K2_VARNAME, self%k2_varid), "netcdf_open nf90_inq_varid k2_varid" ) - call check( nf90_inq_varid(self%ncid, Q_VARNAME, self%Q_varid), "netcdf_open nf90_inq_varid Q_varid" ) - end if + ! if (param%ltides) then + ! call check( nf90_inq_varid(self%ncid, K2_VARNAME, self%k2_varid), "netcdf_open nf90_inq_varid k2_varid" ) + ! call check( nf90_inq_varid(self%ncid, Q_VARNAME, self%Q_varid), "netcdf_open nf90_inq_varid Q_varid" ) + ! end if if (param%lenergy) then call check( nf90_inq_varid(self%ncid, KE_ORB_VARNAME, self%KE_orb_varid), "netcdf_open nf90_inq_varid KE_orb_varid" ) @@ -689,15 +689,15 @@ module function netcdf_read_frame_system(self, iu, param) result(ierr) end select end if - if (param%ltides) then - call check( nf90_get_var(iu%ncid, iu%k2_varid, rtemp, start=[1, tslot]), "netcdf_read_frame_system nf90_getvar k2_varid" ) - cb%k2 = rtemp(1) - if (npl > 0) pl%k2(:) = pack(rtemp, plmask) + ! if (param%ltides) then + ! call check( nf90_get_var(iu%ncid, iu%k2_varid, rtemp, start=[1, tslot]), "netcdf_read_frame_system nf90_getvar k2_varid" ) + ! cb%k2 = rtemp(1) + ! if (npl > 0) pl%k2(:) = pack(rtemp, plmask) - call check( nf90_get_var(iu%ncid, iu%Q_varid, rtemp, start=[1, tslot]), "netcdf_read_frame_system nf90_getvar Q_varid" ) - cb%Q = rtemp(1) - if (npl > 0) pl%Q(:) = pack(rtemp, plmask) - end if + ! call check( nf90_get_var(iu%ncid, iu%Q_varid, rtemp, start=[1, tslot]), "netcdf_read_frame_system nf90_getvar Q_varid" ) + ! cb%Q = rtemp(1) + ! if (npl > 0) pl%Q(:) = pack(rtemp, plmask) + ! end if call check( nf90_get_var(iu%ncid, iu%j2rp2_varid, cb%j2rp2, start=[tslot]), "netcdf_read_frame_system nf90_getvar j2rp2_varid" ) call check( nf90_get_var(iu%ncid, iu%j4rp4_varid, cb%j4rp4, start=[tslot]), "netcdf_read_frame_system nf90_getvar j4rp4_varid" ) @@ -1035,10 +1035,10 @@ module subroutine netcdf_write_frame_base(self, iu, param) call check( nf90_put_var(iu%ncid, iu%roty_varid, self%rot(2, j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var roty_varid" ) call check( nf90_put_var(iu%ncid, iu%rotz_varid, self%rot(3, j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var rotz_varid" ) end if - if (param%ltides) then - call check( nf90_put_var(iu%ncid, iu%k2_varid, self%k2(j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var k2_varid" ) - call check( nf90_put_var(iu%ncid, iu%Q_varid, self%Q(j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var Q_varid" ) - end if + ! if (param%ltides) then + ! call check( nf90_put_var(iu%ncid, iu%k2_varid, self%k2(j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var k2_varid" ) + ! call check( nf90_put_var(iu%ncid, iu%Q_varid, self%Q(j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var Q_varid" ) + ! end if end select end do @@ -1059,10 +1059,10 @@ module subroutine netcdf_write_frame_base(self, iu, param) call check( nf90_put_var(iu%ncid, iu%roty_varid, self%rot(2), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb roty_varid" ) call check( nf90_put_var(iu%ncid, iu%rotz_varid, self%rot(3), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb rotz_varid" ) end if - if (param%ltides) then - call check( nf90_put_var(iu%ncid, iu%k2_varid, self%k2, start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb k2_varid" ) - call check( nf90_put_var(iu%ncid, iu%Q_varid, self%Q, start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb Q_varid" ) - end if + ! if (param%ltides) then + ! call check( nf90_put_var(iu%ncid, iu%k2_varid, self%k2, start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb k2_varid" ) + ! call check( nf90_put_var(iu%ncid, iu%Q_varid, self%Q, start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var cb Q_varid" ) + ! end if end select call check( nf90_set_fill(iu%ncid, old_mode, old_mode), "netcdf_write_frame_base nf90_set_fill old_mode" ) diff --git a/src/rmvs/rmvs_setup.f90 b/src/rmvs/rmvs_setup.f90 index 49cd102cc..2c5a0faea 100644 --- a/src/rmvs/rmvs_setup.f90 +++ b/src/rmvs/rmvs_setup.f90 @@ -50,12 +50,12 @@ module subroutine rmvs_setup_pl(self, n, param) pl%inner(i)%v(:,:) = 0.0_DP pl%inner(i)%aobl(:,:) = 0.0_DP end do - if (param%ltides) then - do i = 0, NTPHENC - allocate(pl%inner(i)%atide(NDIM, n)) - pl%inner(i)%atide(:,:) = 0.0_DP - end do - end if + ! if (param%ltides) then + ! do i = 0, NTPHENC + ! allocate(pl%inner(i)%atide(NDIM, n)) + ! pl%inner(i)%atide(:,:) = 0.0_DP + ! end do + ! end if end if end associate return diff --git a/src/rmvs/rmvs_step.f90 b/src/rmvs/rmvs_step.f90 index c341d7d41..25285899f 100644 --- a/src/rmvs/rmvs_step.f90 +++ b/src/rmvs/rmvs_step.f90 @@ -60,7 +60,7 @@ module subroutine rmvs_step_system(self, param, t, dt) tp%lmask(1:ntp) = .true. pl%lfirst = lfirstpl tp%lfirst = .true. - if (param%ltides) call system%step_spin(param, t, dt) + ! if (param%ltides) call system%step_spin(param, t, dt) else call whm_step_system(system, param, t, dt) end if @@ -266,10 +266,11 @@ subroutine rmvs_interp_in(cb, pl, system, param, dt, outer_index) call pl%accel_obl(system) pl%inner(0)%aobl(:, 1:npl) = pl%aobl(:, 1:npl) ! Save the oblateness acceleration on the planet for this substep end if - if (param%ltides) then - call pl%accel_tides(system) - pl%inner(0)%atide(:, 1:npl) = pl%atide(:, 1:npl) ! Save the oblateness acceleration on the planet for this substep - end if + ! TODO: Implement tides + ! if (param%ltides) then + ! call pl%accel_tides(system) + ! pl%inner(0)%atide(:, 1:npl) = pl%atide(:, 1:npl) ! Save the oblateness acceleration on the planet for this substep + ! end if do inner_index = 1, NTPHENC - 1 call drift_one(GMcb(1:npl), xtmp(1,1:npl), xtmp(2,1:npl), xtmp(3,1:npl), & @@ -320,10 +321,11 @@ subroutine rmvs_interp_in(cb, pl, system, param, dt, outer_index) call pl%accel_obl(system) pl%inner(inner_index)%aobl(:, 1:npl) = pl%aobl(:, 1:npl) end if - if (param%ltides) then - call pl%accel_tides(system) - pl%inner(inner_index)%atide(:, 1:npl) = pl%atide(:, 1:npl) - end if + ! TODO: Implement tides + ! if (param%ltides) then + ! call pl%accel_tides(system) + ! pl%inner(inner_index)%atide(:, 1:npl) = pl%atide(:, 1:npl) + ! end if end do if (param%loblatecb) then ! Calculate the final value of oblateness accelerations at the final inner substep @@ -331,10 +333,11 @@ subroutine rmvs_interp_in(cb, pl, system, param, dt, outer_index) call pl%accel_obl(system) pl%inner(NTPHENC)%aobl(:, 1:npl) = pl%aobl(:, 1:npl) end if - if (param%ltides) then - call pl%accel_tides(system) - pl%inner(NTPHENC)%atide(:, 1:npl) = pl%atide(:, 1:npl) - end if + ! TODO: Implement tides + ! if (param%ltides) then + ! call pl%accel_tides(system) + ! pl%inner(NTPHENC)%atide(:, 1:npl) = pl%atide(:, 1:npl) + ! end if ! Put the planet positions and accelerations back into place if (allocated(xh_original)) call move_alloc(xh_original, pl%xh) if (allocated(ah_original)) call move_alloc(ah_original, pl%ah) diff --git a/src/symba/symba_collision.f90 b/src/symba/symba_collision.f90 index 0e47e8c24..1423adc7e 100644 --- a/src/symba/symba_collision.f90 +++ b/src/symba/symba_collision.f90 @@ -825,11 +825,11 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status) plnew%rot(:, 1:nfrag) = frag%rot(:, 1:nfrag) end if - if (param%ltides) then - plnew%Q = pl%Q(ibiggest) - plnew%k2 = pl%k2(ibiggest) - plnew%tlag = pl%tlag(ibiggest) - end if + ! if (param%ltides) then + ! plnew%Q = pl%Q(ibiggest) + ! plnew%k2 = pl%k2(ibiggest) + ! plnew%tlag = pl%tlag(ibiggest) + ! end if !Copy over or set integration parameters for new bodies plnew%lcollision(1:nfrag) = .false. diff --git a/src/whm/whm_kick.f90 b/src/whm/whm_kick.f90 index 91f801850..54a6ef621 100644 --- a/src/whm/whm_kick.f90 +++ b/src/whm/whm_kick.f90 @@ -50,11 +50,12 @@ module subroutine whm_kick_getacch_pl(self, system, param, t, lbeg) else cb%aoblend = cb%aobl end if - if (param%ltides) then - cb%atidebeg = cb%aobl - call pl%accel_tides(system) - cb%atideend = cb%atide - end if + ! TODO: Implement tides + ! if (param%ltides) then + ! cb%atidebeg = cb%aobl + ! call pl%accel_tides(system) + ! cb%atideend = cb%atide + ! end if end if if (param%lgr) call pl%accel_gr(param) diff --git a/src/whm/whm_step.f90 b/src/whm/whm_step.f90 index e74cb719c..9f6b9bea1 100644 --- a/src/whm/whm_step.f90 +++ b/src/whm/whm_step.f90 @@ -29,7 +29,7 @@ module subroutine whm_step_system(self, param, t, dt) tp%lfirst = pl%lfirst call pl%step(system, param, t, dt) call tp%step(system, param, t, dt) - if (param%ltides) call system%step_spin(param, t, dt) + ! if (param%ltides) call system%step_spin(param, t, dt) end associate return end subroutine whm_step_system