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

Commit

Permalink
Improved formatting of discard reporting to get rid of blank spaces a…
Browse files Browse the repository at this point in the history
…round particle ids
  • Loading branch information
daminton committed Aug 19, 2021
1 parent ba6f482 commit 988773f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/discard/discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ subroutine discard_cb_tp(tp, system, param)
! Internals
integer(I4B) :: i
real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, rmaxu2
character(len=STRMAX) :: idstr

associate(ntp => tp%nbody, cb => system%cb, t => param%t, Gmtot => system%Gmtot)
rmin2 = max(param%rmin * param%rmin, cb%radius * cb%radius)
Expand All @@ -122,12 +123,14 @@ subroutine discard_cb_tp(tp, system, param)
rh2 = dot_product(tp%xh(:, i), tp%xh(:, i))
if ((param%rmax >= 0.0_DP) .and. (rh2 > rmax2)) then
tp%status(i) = DISCARDED_RMAX
write(*, *) "Particle ", tp%id(i), " too far from sun at t = ", t
write(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " too far from the central body at t = ", t
tp%ldiscard(i) = .true.
tp%lmask(i) = .false.
else if ((param%rmin >= 0.0_DP) .and. (rh2 < rmin2)) then
tp%status(i) = DISCARDED_RMIN
write(*, *) "Particle ", tp%id(i), " too close to sun at t = ", t
write(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " too close to the central body at t = ", t
tp%ldiscard(i) = .true.
tp%lmask(i) = .false.
else if (param%rmaxu >= 0.0_DP) then
Expand All @@ -136,7 +139,8 @@ subroutine discard_cb_tp(tp, system, param)
energy = 0.5_DP * vb2 - Gmtot / sqrt(rb2)
if ((energy > 0.0_DP) .and. (rb2 > rmaxu2)) then
tp%status(i) = DISCARDED_RMAXU
write(*, *) "Particle ", tp%id(i), " is unbound and too far from barycenter at t = ", t
write(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = ", t
tp%ldiscard(i) = .true.
tp%lmask(i) = .false.
end if
Expand Down
10 changes: 7 additions & 3 deletions src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ subroutine symba_discard_cb_pl(pl, system, param)
! Internals
integer(I4B) :: i, j
real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, rmaxu2
character(len=STRMAX) :: idstr

associate(npl => pl%nbody, cb => system%cb)
call system%set_msys()
Expand All @@ -33,12 +34,14 @@ subroutine symba_discard_cb_pl(pl, system, param)
pl%ldiscard(i) = .true.
pl%lcollision(i) = .false.
pl%status(i) = DISCARDED_RMAX
write(*, *) "Massive body ", pl%id(i), " too far from the central body at t = ", param%t
write(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too far from the central body at t = ", param%t
else if ((param%rmin >= 0.0_DP) .and. (rh2 < rmin2)) then
pl%ldiscard(i) = .true.
pl%lcollision(i) = .false.
pl%status(i) = DISCARDED_RMIN
write(*, *) "Massive body ", pl%id(i), " too close to the central body at t = ", param%t
write(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too close to the central body at t = ", param%t
else if (param%rmaxu >= 0.0_DP) then
rb2 = dot_product(pl%xb(:,i), pl%xb(:,i))
vb2 = dot_product(pl%vb(:,i), pl%vb(:,i))
Expand All @@ -47,7 +50,8 @@ subroutine symba_discard_cb_pl(pl, system, param)
pl%ldiscard(i) = .true.
pl%lcollision(i) = .false.
pl%status(i) = DISCARDED_RMAXU
write(*, *) "Massive body ", pl%id(i), " is unbound and too far from barycenter at t = ", param%t
write(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = ", param%t
end if
end if
end if
Expand Down

0 comments on commit 988773f

Please sign in to comment.