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

Commit

Permalink
Commented out most of the un-used tide stuff. To be reactivated and c…
Browse files Browse the repository at this point in the history
…ompleted next Someday.
  • Loading branch information
daminton committed Nov 1, 2022
1 parent 12aecbc commit 061cb9b
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 111 deletions.
28 changes: 14 additions & 14 deletions src/fraggle/fraggle_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
17 changes: 9 additions & 8 deletions src/helio/helio_kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 20 additions & 20 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
31 changes: 16 additions & 15 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
48 changes: 24 additions & 24 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down Expand Up @@ -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" )
Expand Down Expand Up @@ -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" )
Expand Down Expand Up @@ -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
Expand All @@ -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" )
Expand Down
12 changes: 6 additions & 6 deletions src/rmvs/rmvs_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 16 additions & 13 deletions src/rmvs/rmvs_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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), &
Expand Down Expand Up @@ -320,21 +321,23 @@ 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
pl%xh(:, 1:npl) = pl%inner(NTPHENC)%x(:, 1:npl)
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)
Expand Down
10 changes: 5 additions & 5 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 061cb9b

Please sign in to comment.