mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added statistics and output for global tallies.
This commit is contained in:
parent
fa02077a91
commit
6a72d02d8d
6 changed files with 69 additions and 14 deletions
|
|
@ -6,7 +6,7 @@ module finalize
|
|||
use timing, only: timer_start, timer_stop
|
||||
|
||||
#ifdef HDF5
|
||||
use hdf5_interface, only: hdf5_write_timing, hdf5_close_output
|
||||
use hdf5_interface, only: hdf5_write_results, hdf5_close_output
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
|
@ -37,7 +37,7 @@ contains
|
|||
#ifdef HDF5
|
||||
! Write time statistics to HDF5 output
|
||||
if (master) then
|
||||
call hdf5_write_timing()
|
||||
call hdf5_write_results()
|
||||
call hdf5_close_output()
|
||||
end if
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module geometry
|
|||
use output, only: write_message
|
||||
use particle_header, only: LocalCoord, deallocate_coord
|
||||
use string, only: to_str
|
||||
use tally, only: score_surface_current
|
||||
use tally, only: score_surface_current, add_to_score
|
||||
|
||||
implicit none
|
||||
|
||||
|
|
@ -263,12 +263,17 @@ contains
|
|||
! forward slightly so that if the mesh boundary is on the surface, it is
|
||||
! still processed
|
||||
|
||||
if (tallies_on .and. n_current_tallies > 0) then
|
||||
! TODO: Find a better solution to score surface currents than
|
||||
! physically moving the particle forward slightly
|
||||
if (tallies_on) then
|
||||
if (n_current_tallies > 0) then
|
||||
! TODO: Find a better solution to score surface currents than
|
||||
! physically moving the particle forward slightly
|
||||
|
||||
p % coord0 % xyz = p % coord0 % xyz + TINY_BIT * p % coord0 % uvw
|
||||
call score_surface_current()
|
||||
p % coord0 % xyz = p % coord0 % xyz + TINY_BIT * p % coord0 % uvw
|
||||
call score_surface_current()
|
||||
end if
|
||||
|
||||
! Score to global leakage tally
|
||||
call add_to_score(global_tallies(LEAKAGE), p % wgt)
|
||||
end if
|
||||
|
||||
! Display message
|
||||
|
|
|
|||
|
|
@ -101,6 +101,17 @@ contains
|
|||
|
||||
end subroutine hdf5_write_summary
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_RESULTS
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_results()
|
||||
|
||||
call hdf5_write_timing()
|
||||
call hdf5_write_global_tallies()
|
||||
|
||||
end subroutine hdf5_write_results
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_GEOMETRY
|
||||
!===============================================================================
|
||||
|
|
@ -410,6 +421,30 @@ contains
|
|||
|
||||
end subroutine hdf5_write_materials
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_GLOBAL_TALLIES
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_global_tallies()
|
||||
|
||||
integer :: rank = 1
|
||||
integer(HSIZE_T) :: dims(1) = (/ 2 /)
|
||||
|
||||
call h5ltmake_dataset_double_f(hdf5_output_file, "k_analog", &
|
||||
rank, dims, (/ global_tallies(K_ANALOG) % sum, &
|
||||
global_tallies(K_ANALOG) % sum_sq /), hdf5_err)
|
||||
call h5ltmake_dataset_double_f(hdf5_output_file, "k_collision", &
|
||||
rank, dims, (/ global_tallies(K_COLLISION) % sum, &
|
||||
global_tallies(K_COLLISION) % sum_sq /), hdf5_err)
|
||||
call h5ltmake_dataset_double_f(hdf5_output_file, "k_tracklength", &
|
||||
rank, dims, (/ global_tallies(K_TRACKLENGTH) % sum, &
|
||||
global_tallies(K_TRACKLENGTH) % sum_sq /), hdf5_err)
|
||||
call h5ltmake_dataset_double_f(hdf5_output_file, "leakage", &
|
||||
rank, dims, (/ global_tallies(LEAKAGE) % sum, &
|
||||
global_tallies(LEAKAGE) % sum_sq /), hdf5_err)
|
||||
|
||||
end subroutine hdf5_write_global_tallies
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_TALLIES
|
||||
!===============================================================================
|
||||
|
|
|
|||
|
|
@ -387,7 +387,9 @@ contains
|
|||
|
||||
integer :: n ! active cycle number
|
||||
real(8) :: k_cycle ! single cycle estimate of keff
|
||||
#ifdef MPI
|
||||
real(8) :: global_temp(N_GLOBAL_TALLIES)
|
||||
#endif
|
||||
|
||||
message = "Calculate cycle keff..."
|
||||
call write_message(8)
|
||||
|
|
|
|||
|
|
@ -942,22 +942,31 @@ contains
|
|||
write(ou,100) "Total time for finalization", time_finalize % elapsed
|
||||
write(ou,100) "Total time elapsed", time_total % elapsed
|
||||
|
||||
! display header block
|
||||
call header("Run Statistics")
|
||||
|
||||
! display calculate rate and final keff
|
||||
total_particles = n_particles * n_cycles
|
||||
speed = real(total_particles) / (time_inactive % elapsed + &
|
||||
time_active % elapsed)
|
||||
string = to_str(speed)
|
||||
write(ou,101) "Calculation Rate", trim(string)
|
||||
write(ou,102) "Final Keff", keff, keff_std
|
||||
|
||||
! display header block for results
|
||||
call header("Results")
|
||||
|
||||
! write global tallies
|
||||
write(ou,102) "k-effective (Analog)", global_tallies(K_ANALOG) % sum, &
|
||||
global_tallies(K_ANALOG) % sum_sq
|
||||
write(ou,102) "k-effective (Collision)", global_tallies(K_COLLISION) % sum, &
|
||||
global_tallies(K_COLLISION) % sum_sq
|
||||
write(ou,102) "k-effective (Track-length)", global_tallies(K_TRACKLENGTH) % sum, &
|
||||
global_tallies(K_TRACKLENGTH) % sum_sq
|
||||
write(ou,102) "Leakage Fraction", global_tallies(LEAKAGE) % sum, &
|
||||
global_tallies(LEAKAGE) % sum_sq
|
||||
write(ou,*)
|
||||
|
||||
! format for write statements
|
||||
100 format (1X,A,T35,"= ",ES11.4," seconds")
|
||||
101 format (1X,A,T20,"= ",A," neutrons/second")
|
||||
102 format (1X,A,T20,"= ",F8.5," +/- ",F8.5)
|
||||
101 format (1X,A,T35,"= ",A," neutrons/second")
|
||||
102 format (1X,A,T30,"= ",F8.5," +/- ",F8.5)
|
||||
|
||||
end subroutine print_runtime
|
||||
|
||||
|
|
|
|||
|
|
@ -1546,12 +1546,16 @@ contains
|
|||
integer :: i ! index in tallies array
|
||||
type(TallyObject), pointer :: t => null()
|
||||
|
||||
! Calculate statistics for user-defined tallies
|
||||
do i = 1, n_tallies
|
||||
t => tallies(i)
|
||||
|
||||
call calculate_statistics(t % scores)
|
||||
end do
|
||||
|
||||
! Calculate statistics for global tallies
|
||||
call calculate_statistics(global_tallies)
|
||||
|
||||
end subroutine tally_statistics
|
||||
|
||||
end module tally
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue