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 time stamp
  • Loading branch information
daminton committed Aug 19, 2021
1 parent 988773f commit fa9932f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 8 additions & 5 deletions src/discard/discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ subroutine discard_cb_tp(tp, system, param)
! Internals
integer(I4B) :: i
real(DP) :: energy, vb2, rb2, rh2, rmin2, rmax2, rmaxu2
character(len=STRMAX) :: idstr
character(len=STRMAX) :: idstr, timestr

associate(ntp => tp%nbody, cb => system%cb, t => param%t, Gmtot => system%Gmtot)
associate(ntp => tp%nbody, cb => system%cb, Gmtot => system%Gmtot)
rmin2 = max(param%rmin * param%rmin, cb%radius * cb%radius)
rmax2 = param%rmax**2
rmaxu2 = param%rmaxu**2
Expand All @@ -124,13 +124,15 @@ subroutine discard_cb_tp(tp, system, param)
if ((param%rmax >= 0.0_DP) .and. (rh2 > rmax2)) then
tp%status(i) = DISCARDED_RMAX
write(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " too far from the central body at t = ", t
write(timestr, *) param%t
write(*, *) "Particle " // trim(adjustl(idstr)) // " too far from the central body at t = " // trim(adjustl(timestr))
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(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " too close to the central body at t = ", t
write(timestr, *) param%t
write(*, *) "Particle " // trim(adjustl(idstr)) // " too close to the central body at t = " // trim(adjustl(timestr))
tp%ldiscard(i) = .true.
tp%lmask(i) = .false.
else if (param%rmaxu >= 0.0_DP) then
Expand All @@ -140,7 +142,8 @@ subroutine discard_cb_tp(tp, system, param)
if ((energy > 0.0_DP) .and. (rb2 > rmaxu2)) then
tp%status(i) = DISCARDED_RMAXU
write(idstr, *) tp%id(i)
write(*, *) "Particle " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = ", t
write(timestr, *) param%t
write(*, *) "Particle " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = " // trim(adjustl(timestr))
tp%ldiscard(i) = .true.
tp%lmask(i) = .false.
end if
Expand Down
11 changes: 7 additions & 4 deletions src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +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
character(len=STRMAX) :: idstr, timestr

associate(npl => pl%nbody, cb => system%cb)
call system%set_msys()
Expand All @@ -35,13 +35,15 @@ subroutine symba_discard_cb_pl(pl, system, param)
pl%lcollision(i) = .false.
pl%status(i) = DISCARDED_RMAX
write(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too far from the central body at t = ", param%t
write(timestr, *) param%t
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too far from the central body at t = " // trim(adjustl(timestr))
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(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too close to the central body at t = ", param%t
write(timestr, *) param%t
write(*, *) "Massive body " // trim(adjustl(idstr)) // " too close to the central body at t = " // trim(adjustl(timestr))
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 @@ -51,7 +53,8 @@ subroutine symba_discard_cb_pl(pl, system, param)
pl%lcollision(i) = .false.
pl%status(i) = DISCARDED_RMAXU
write(idstr, *) pl%id(i)
write(*, *) "Massive body " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = ", param%t
write(timestr, *) param%t
write(*, *) "Massive body " // trim(adjustl(idstr)) // " is unbound and too far from barycenter at t = " // trim(adjustl(timestr))
end if
end if
end if
Expand Down

0 comments on commit fa9932f

Please sign in to comment.