Added ability to trace history of specific particle.

This commit is contained in:
Paul Romano 2011-12-05 12:10:49 -05:00
parent 98268c0bae
commit f1f443dadc
6 changed files with 23 additions and 6 deletions

View file

@ -231,7 +231,7 @@ contains
type(Surface), pointer :: surf => null()
surf => surfaces(abs(p % surface))
if (verbosity >= 10) then
if (verbosity >= 10 .or. trace) then
message = " Crossing surface " // trim(int_to_str(surf % id))
call write_message()
end if
@ -254,7 +254,7 @@ contains
call score_surface_current(p)
! Display message
if (verbosity >= 10) then
if (verbosity >= 10 .or. trace) then
message = " Leaked out of surface " // trim(int_to_str(surf % id))
call write_message()
end if
@ -373,7 +373,7 @@ contains
p % last_xyz = p % coord0 % xyz + TINY_BIT * p % coord0 % uvw
! Diagnostic message
if (verbosity >= 10) then
if (verbosity >= 10 .or. trace) then
message = " Reflected from surface " // trim(int_to_str(surf%id))
call write_message()
end if
@ -440,7 +440,7 @@ contains
lat => lattices(p % coord % lattice)
if (verbosity >= 10) then
if (verbosity >= 10 .or. trace) then
message = " Crossing lattice " // int_to_str(lat % id)
call write_message()
end if

View file

@ -168,6 +168,11 @@ module global
! screen and in logs
integer :: verbosity = 7
! Trace for single particle
logical :: trace
integer :: trace_cycle
integer(8) :: trace_particle
contains
!===============================================================================

View file

@ -136,6 +136,12 @@ contains
weight_survive = cutoff_(1) % weight_avg
end if
! Particle trace
if (size(trace_) > 0) then
trace_cycle = trace_(1)
trace_particle = trace_(2)
end if
end subroutine read_settings_xml
!===============================================================================

View file

@ -90,6 +90,11 @@ contains
! set random number seed
i_particle = (i_cycle-1)*n_particles + p % id
call set_particle_seed(i_particle)
! set particle trace
trace = .false.
if (i_cycle == trace_cycle .and. &
p % id == trace_particle) trace = .true.
! transport particle
call transport(p)

View file

@ -52,12 +52,12 @@ contains
p % cell_born = p % coord % cell
end if
if (verbosity >= 9) then
if (verbosity >= 9 .or. trace) then
message = "Simulating Particle " // trim(int_to_str(p % id))
call write_message()
end if
if (verbosity >= 10) then
if (verbosity >= 10 .or. trace) then
message = " Born in cell " // trim(int_to_str(&
cells(p % coord % cell) % id))
call write_message()

View file

@ -25,5 +25,6 @@
<variable name="survival_" tag="survival_biasing" type="word" length="3" />
<variable name="cutoff_" tag="cutoff" type="cutoff_xml" dimension="1" />
<variable name="cross_sections_" tag="cross_sections" type="word" length="255" />
<variable name="trace_" tag="trace" type="integer-array" />
</template>