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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Mar 10, 2023
2 parents fa27dcd + b078c93 commit dafd36c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
5 changes: 0 additions & 5 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS_RELEASE}"
"-pg -fbacktrace"
)

SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS_PROFILE}"
Fortran "-check bounds,pointers,uninit" # Intel
"-fcheck=bounds,pointer,mem"
)

# Sanitize
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fsanitize=address,undefined" # Gnu
Expand Down
8 changes: 4 additions & 4 deletions src/encounter/encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ subroutine encounter_check_all_triangular_plplm(nplm, nplt, rplm, vplm, rplt, vp
end subroutine encounter_check_all_triangular_plplm


subroutine encounter_check_all_triangular_pltp(npl, ntp, rpl, vpl, xtp, vtp, renc, dt, &
subroutine encounter_check_all_triangular_pltp(npl, ntp, rpl, vpl, rtp, vtp, renc, dt, &
nenc, index1, index2, lvdotr)
!! author: David A. Minton
!!
Expand All @@ -511,7 +511,7 @@ subroutine encounter_check_all_triangular_pltp(npl, ntp, rpl, vpl, xtp, vtp, ren
integer(I4B), intent(in) :: ntp !! Total number of test particles
real(DP), dimension(:,:), intent(in) :: rpl !! Position vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: vpl !! Velocity vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: xtp !! Position vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: rtp !! Position vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: vtp !! Velocity vectors of massive bodies
real(DP), dimension(:), intent(in) :: renc !! Critical radii of massive bodies that defines an encounter
real(DP), intent(in) :: dt !! Step size
Expand All @@ -529,12 +529,12 @@ subroutine encounter_check_all_triangular_pltp(npl, ntp, rpl, vpl, xtp, vtp, ren
renct(:) = 0.0_DP

!$omp parallel do default(private) schedule(dynamic)&
!$omp shared(rpl, vpl, xtp, vtp, renc, renct, lenc, ind_arr) &
!$omp shared(rpl, vpl, rtp, vtp, renc, renct, lenc, ind_arr) &
!$omp firstprivate(npl, ntp, dt)
do i = 1, npl
call encounter_check_all_triangular_one(0, ntp, rpl(1,i), rpl(2,i), rpl(3,i), &
vpl(1,i), vpl(2,i), vpl(3,i), &
xtp(1,:), xtp(2,:), xtp(3,:), &
rtp(1,:), rtp(2,:), rtp(3,:), &
vtp(1,:), vtp(2,:), vtp(3,:), &
renc(i), renct(:), dt, ind_arr(:), lenc(i))
if (lenc(i)%nenc > 0) lenc(i)%index1(:) = i
Expand Down
21 changes: 10 additions & 11 deletions src/swiftest/swiftest_kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ module subroutine swiftest_kick_getacch_int_all_tri_norad_pl(npl, nplm, r, Gmass
end subroutine swiftest_kick_getacch_int_all_tri_norad_pl



module subroutine swiftest_kick_getacch_int_all_tp(ntp, npl, xtp, rpl, GMpl, lmask, acc)
module subroutine swiftest_kick_getacch_int_all_tp(ntp, npl, rtp, rpl, GMpl, lmask, acc)
!! author: David A. Minton
!!
!! Compute direct cross (third) term heliocentric accelerations of test particles by massive bodies with parallelisim
Expand All @@ -353,27 +352,27 @@ module subroutine swiftest_kick_getacch_int_all_tp(ntp, npl, xtp, rpl, GMpl, lma
implicit none
integer(I4B), intent(in) :: ntp !! Number of test particles
integer(I4B), intent(in) :: npl !! Number of massive bodies
real(DP), dimension(:,:), intent(in) :: xtp !! Test particle position vector array
real(DP), dimension(:,:), intent(in) :: rtp !! Test particle position vector array
real(DP), dimension(:,:), intent(in) :: rpl !! Massive body particle position vector array
real(DP), dimension(:), intent(in) :: GMpl !! Array of massive body G*mass
logical, dimension(:), intent(in) :: lmask !! Logical mask indicating which test particles should be computed
real(DP), dimension(:,:), intent(inout) :: acc !! Acceleration vector array
! Internals
real(DP) :: rji2
real(DP) :: xr, yr, zr
real(DP) :: rx, ry, rz
integer(I4B) :: i, j

!$omp parallel do default(private) schedule(static)&
!$omp shared(npl, ntp, lmask, xtp, rpl, GMpl) &
!$omp shared(npl, ntp, lmask, rtp, rpl, GMpl) &
!$omp reduction(-:acc)
do i = 1, ntp
if (lmask(i)) then
do j = 1, npl
xr = xtp(1, i) - rpl(1, j)
yr = xtp(2, i) - rpl(2, j)
zr = xtp(3, i) - rpl(3, j)
rji2 = xr**2 + yr**2 + zr**2
call swiftest_kick_getacch_int_one_tp(rji2, xr, yr, zr, GMpl(j), acc(1,i), acc(2,i), acc(3,i))
do concurrent (j = 1:npl)
rx = rtp(1, i) - rpl(1, j)
ry = rtp(2, i) - rpl(2, j)
rz = rtp(3, i) - rpl(3, j)
rji2 = rx**2 + ry**2 + rz**2
call swiftest_kick_getacch_int_one_tp(rji2, rx, ry, rz, GMpl(j), acc(1,i), acc(2,i), acc(3,i))
end do
end if
end do
Expand Down
4 changes: 2 additions & 2 deletions src/swiftest/swiftest_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,11 @@ module subroutine swiftest_kick_getacch_int_all_tri_norad_pl(npl, nplm, r, Gmass
real(DP), dimension(:,:), intent(inout) :: acc !! Acceleration vector array
end subroutine swiftest_kick_getacch_int_all_tri_norad_pl

module subroutine swiftest_kick_getacch_int_all_tp(ntp, npl, xtp, rpl, GMpl, lmask, acc)
module subroutine swiftest_kick_getacch_int_all_tp(ntp, npl, rtp, rpl, GMpl, lmask, acc)
implicit none
integer(I4B), intent(in) :: ntp !! Number of test particles
integer(I4B), intent(in) :: npl !! Number of massive bodies
real(DP), dimension(:,:), intent(in) :: xtp !! Test particle position vector array
real(DP), dimension(:,:), intent(in) :: rtp !! Test particle position vector array
real(DP), dimension(:,:), intent(in) :: rpl !! Massive body particle position vector array
real(DP), dimension(:), intent(in) :: GMpl !! Array of massive body G*mass
logical, dimension(:), intent(in) :: lmask !! Logical mask indicating which test particles should be computed
Expand Down

0 comments on commit dafd36c

Please sign in to comment.