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

Commit

Permalink
Added tides directory and placeholder acceleration method.
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 13, 2021
1 parent a54a4ff commit cec6c55
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ lib:
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/tides; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/util; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
Expand Down Expand Up @@ -176,13 +181,6 @@ drivers:
ln -s $(SWIFTEST_HOME)/Makefile .; \
make bin

#tools:
# cd $(SWIFTEST_HOME)/src/tool; \
# rm -f Makefile.Defines Makefile; \
# ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
# ln -s $(SWIFTEST_HOME)/Makefile .; \
# make bin

bin: *.f90
make $(basename $^)

Expand All @@ -202,6 +200,7 @@ clean:
cd $(SWIFTEST_HOME)/src/rmvs; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/setup; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/symba; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/tides; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/user; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/util; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/whm; rm -f Makefile.Defines Makefile *.gc*
Expand Down
8 changes: 8 additions & 0 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module swiftest_classes
public :: obl_acc_body, obl_acc_pl, obl_acc_tp
public :: orbel_el2xv_vec, orbel_xv2el_vec, orbel_scget, orbel_xv2aeq, orbel_xv2aqt
public :: setup_body, setup_construct_system, setup_pl, setup_tp
public :: tides_getacch_pl
public :: user_getacch_body
public :: util_coord_b2h_pl, util_coord_b2h_tp, util_coord_h2b_pl, util_coord_h2b_tp, util_exit, util_fill_body, util_fill_pl, util_fill_tp, &
util_index, util_peri_tp, util_reverse_status, util_set_beg_end_cb, util_set_beg_end_pl, util_set_ir3h, util_set_msys, util_set_mu_pl, &
Expand Down Expand Up @@ -214,6 +215,7 @@ module swiftest_classes
procedure, public :: eucl_index => eucl_dist_index_plpl !! Sets up the (i, j) -> k indexing used for the single-loop blocking Euclidean distance matrix
procedure, public :: eucl_irij3 => eucl_irij3_plpl !! Parallelized single loop blocking for Euclidean distance matrix calcualtion
procedure, public :: accel_obl => obl_acc_pl !! Compute the barycentric accelerations of bodies due to the oblateness of the central body
procedure, public :: accel_tides => tides_getacch_pl !! Compute the accelerations of bodies due to tidal interactions with the central body
procedure, public :: setup => setup_pl !! A base constructor that sets the number of bodies and allocates and initializes all arrays
procedure, public :: set_mu => util_set_mu_pl !! Method used to construct the vectorized form of the central body mass
procedure, public :: set_rhill => util_set_rhill !! Calculates the Hill's radii for each body
Expand Down Expand Up @@ -674,6 +676,12 @@ module subroutine setup_tp(self, n)
integer, intent(in) :: n !! Number of bodies to allocate space for
end subroutine setup_tp

module subroutine tides_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_getacch_pl

module subroutine user_getacch_body(self, system, param, t, lbeg)
implicit none
class(swiftest_body), intent(inout) :: self !! Swiftest massive body particle data structure
Expand Down
46 changes: 46 additions & 0 deletions src/tides/tides_getacch_pl.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
submodule(swiftest_classes) s_tides_getacch
use swiftest
contains
module subroutine tides_getacch_pl(self, system)
!! author: Jennifer L.L. Pouplin, Carlisle A. wishard, and David A. Minton
!!
!! Calculated tidal torques from central body to any planet and from any planet to central body
!! planet - planet interactions are considered negligeable
!! Adapted from Mercury-T code from Bolmont et al. 2015
implicit none
! Arguments
class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
! Internals
integer(I4B) :: i
real(DP) :: rmag
real(DP), dimension(NDIM) :: ej, vj, F_central
real(DP), dimension(:,:), allocatable :: F_tot

associate(pl => self, npl => self%nbody, cb => system%cb)
allocate(F_tot, mold=pl%ah)
do i = 1, npl
! Placeholders until model is implemented
! ***************************************
F_tot(:,i) = 0.0_DP
F_central(:) = 0.0_DP
! ***************************************
!rmag = norm2(pl%xh(:,i))
!ej = pl%xh(:,i) / rmag
!vj = pl%vh(:, i)
!Ftr =
!Pto =
!Pto_central = !Eq 5 Bolmont et al. 2015
!F_tot(:,i) = (Ftr + (Pto + Pto_central) * dot_product(vj, ej) / rmag * ej + Pto * cross_product((rotj - theta_j), ej) + Pto_central * cross_product((rot_central - theta_j), ej) !Eq 6 Bolmont et al. 2015
!F_central = F_central + F_tot(:,i)
end do

do i = 1, npl
pl%ah(:,i) = pl%ah(:,i) + F_tot(:,i) / pl%Gmass(i) + F_central(:) / cb%Gmass
end do
end associate

return

end subroutine tides_getacch_pl
end submodule s_tides_getacch

0 comments on commit cec6c55

Please sign in to comment.