From cec6c5549a8c19ee73f5829201fa9a8e02f1441d Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 13 Jul 2021 08:42:53 -0400 Subject: [PATCH] Added tides directory and placeholder acceleration method. --- Makefile | 13 +++++---- src/modules/swiftest_classes.f90 | 8 ++++++ src/tides/tides_getacch_pl.f90 | 46 ++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 src/tides/tides_getacch_pl.f90 diff --git a/Makefile b/Makefile index 0e2b361e6..e78f0ceeb 100644 --- a/Makefile +++ b/Makefile @@ -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 .; \ @@ -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 $^) @@ -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* diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 8efe47fe9..59b1ddac0 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -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, & @@ -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 @@ -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 diff --git a/src/tides/tides_getacch_pl.f90 b/src/tides/tides_getacch_pl.f90 new file mode 100644 index 000000000..c10bff7e0 --- /dev/null +++ b/src/tides/tides_getacch_pl.f90 @@ -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 \ No newline at end of file