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

Commit

Permalink
Cleaned up code a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 7, 2021
1 parent 986cfaf commit 20dac50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/helio/helio_getacch.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ module subroutine helio_getacch_pl(self, system, param, t)
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters of
real(DP), intent(in) :: t !! Current simulation time
! Internals
logical, save :: lmalloc = .true.
integer(I4B) :: i
real(DP) :: r2
real(DP), dimension(:), allocatable, save :: irh
real(DP), dimension(:, :), allocatable, save :: xh_loc, aobl

associate(cb => system%cb, pl => self, npl => self%nbody)
pl%ahi(:,:) = 0.0_DP
call helio_getacch_int_pl(pl, t)
pl%ah(:,:) = pl%ahi(:,:)
if (param%loblatecb) call pl%obl_acc(cb)
Expand Down Expand Up @@ -53,10 +47,9 @@ module subroutine helio_getacch_tp(self, system, param, t, xhp)
real(DP) :: r2, mu
real(DP), dimension(:), allocatable, save :: irh, irht

associate(tp => self, ntp => self%nbody, cb => system%cb, pl => system%pl, npl => system%pl%nbody)
associate(tp => self, ntp => self%nbody, cb => system%cb, npl => system%pl%nbody)
select type(pl => system%pl)
class is (helio_pl)
self%ahi(:,:) = 0.0_DP
call helio_getacch_int_tp(tp, pl, t, xhp)
tp%ah(:,:) = tp%ahi(:,:)
if (param%loblatecb) call tp%obl_acc(cb)
Expand Down Expand Up @@ -84,6 +77,7 @@ subroutine helio_getacch_int_pl(pl, t)
real(DP), dimension(NDIM) :: dx

associate(npl => pl%nbody)
pl%ahi(:,:) = 0.0_DP
do i = 1, npl - 1
do j = i + 1, npl
dx(:) = pl%xh(:,j) - pl%xh(:,i)
Expand Down Expand Up @@ -119,9 +113,10 @@ subroutine helio_getacch_int_tp(tp, pl, t, xhp)
real(DP), dimension(NDIM) :: dx

associate(ntp => tp%nbody, npl => pl%nbody)
tp%ahi(:,:) = 0.0_DP
do i = 1, ntp
if (tp%status(i) == ACTIVE) then
do j = 2, npl
do j = 1, npl
dx(:) = tp%xh(:,i) - xhp(:,j)
r2 = dot_product(dx(:), dx(:))
fac = pl%Gmass(j) / (r2 * sqrt(r2))
Expand Down
2 changes: 1 addition & 1 deletion src/whm/whm_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module subroutine whm_step_system(self, param, t, dt)
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Current stepsize

associate(system => self, cb => self%cb, pl => self%pl, tp => self%tp, ntp => self%tp%nbody, npl => self%pl%nbody)
associate(system => self, cb => self%cb, pl => self%pl, tp => self%tp, ntp => self%tp%nbody)
call pl%set_rhill(cb)
call self%set_beg_end(xbeg = pl%xh)
call pl%step(system, param, t, dt)
Expand Down

0 comments on commit 20dac50

Please sign in to comment.