mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added check for particle undergoing too many events.
This commit is contained in:
parent
c60589a316
commit
bf889922cb
2 changed files with 17 additions and 1 deletions
|
|
@ -73,6 +73,9 @@ module constants
|
|||
! Used for surface current tallies
|
||||
real(8), parameter :: TINY_BIT = 1e-8
|
||||
|
||||
! Maximum number of collisions/crossings
|
||||
integer, parameter :: MAX_EVENTS = 10000
|
||||
|
||||
! Codes for read errors -- better hope these numbers are never used in an
|
||||
! input file!
|
||||
integer, parameter :: ERROR_INT = -huge(0)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ contains
|
|||
|
||||
integer :: surf ! surface which particle is on
|
||||
integer :: last_cell ! most recent cell particle was in
|
||||
integer :: n_event ! number of collisions/crossings
|
||||
real(8) :: d_to_boundary ! distance to nearest boundary
|
||||
real(8) :: d_to_collision ! sampled distance to collision
|
||||
real(8) :: distance ! distance particle travels
|
||||
|
|
@ -63,6 +64,9 @@ contains
|
|||
call write_message()
|
||||
end if
|
||||
|
||||
! Initialize number of events to zero
|
||||
n_event = 0
|
||||
|
||||
! find energy index, interpolation factor
|
||||
do while (p % alive)
|
||||
|
||||
|
|
@ -100,7 +104,16 @@ contains
|
|||
! Save coordinates at collision for tallying purposes
|
||||
p % last_xyz = p % xyz
|
||||
end if
|
||||
|
||||
|
||||
! If particle has too many events, display warning and kill it
|
||||
n_event = n_event + 1
|
||||
if (n_event == MAX_EVENTS) then
|
||||
message = "Particle " // trim(int_to_str(p%id)) // " underwent " &
|
||||
// "maximum number of events."
|
||||
call warning()
|
||||
p % alive = .false.
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
end subroutine transport
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue