From 3c94f7ca83f24f5070d0083dcf14ea76f6ce70c8 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 24 Aug 2017 12:20:59 -0500 Subject: [PATCH] Move remaining global variables into simulation_header and bank_header --- CMakeLists.txt | 1 + src/bank_header.F90 | 11 ++++++ src/global.F90 | 83 ++------------------------------------- src/simulation_header.F90 | 70 +++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 80 deletions(-) create mode 100644 src/simulation_header.F90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 168663110..7fbaf3c2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,6 +360,7 @@ set(LIBOPENMC_FORTRAN_SRC src/secondary_uncorrelated.F90 src/set_header.F90 src/settings.F90 + src/simulation_header.F90 src/simulation.F90 src/source.F90 src/source_header.F90 diff --git a/src/bank_header.F90 b/src/bank_header.F90 index 97fb1f11f..f20c67385 100644 --- a/src/bank_header.F90 +++ b/src/bank_header.F90 @@ -18,4 +18,15 @@ module bank_header integer(C_INT) :: delayed_group ! delayed group end type Bank + ! Source and fission bank + type(Bank), allocatable, target :: source_bank(:) + type(Bank), allocatable, target :: fission_bank(:) +#ifdef _OPENMP + type(Bank), allocatable, target :: master_fission_bank(:) +#endif + + integer(8) :: n_bank ! # of sites in fission bank + +!$omp threadprivate(fission_bank, n_bank) + end module bank_header diff --git a/src/global.F90 b/src/global.F90 index 013a519a1..28b035e4b 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -2,15 +2,8 @@ module global use, intrinsic :: ISO_C_BINDING -#ifdef MPIF08 - use mpi_f08 -#endif - - use bank_header, only: Bank - use cmfd_header - use constants - ! Inherit module variables from other modules + use cmfd_header use geometry_header use material_header use mesh_header @@ -18,6 +11,8 @@ module global use nuclide_header use plot_header use sab_header + use settings + use simulation_header use surface_header use tally_filter_header use tally_header @@ -25,80 +20,8 @@ module global use trigger_header use volume_header - ! Inherit settings - use settings - implicit none - ! ============================================================================ - ! GEOMETRY-RELATED VARIABLES - - ! Number of lost particles - integer :: n_lost_particles - - real(8) :: log_spacing ! spacing on logarithmic grid - - ! ============================================================================ - ! EIGENVALUE SIMULATION VARIABLES - - integer :: current_batch ! current batch - integer :: current_gen ! current generation within a batch - integer :: total_gen = 0 ! total number of generations simulated - - ! ============================================================================ - ! TALLY PRECISION TRIGGER VARIABLES - - logical :: satisfy_triggers = .false. ! whether triggers are satisfied - - ! Source and fission bank - type(Bank), allocatable, target :: source_bank(:) - type(Bank), allocatable, target :: fission_bank(:) -#ifdef _OPENMP - type(Bank), allocatable, target :: master_fission_bank(:) -#endif - integer(8) :: n_bank ! # of sites in fission bank - integer(8) :: work ! number of particles per processor - integer(8), allocatable :: work_index(:) ! starting index in source bank for each process - integer(8) :: current_work ! index in source bank of current history simulated - - ! Temporary k-effective values - real(8), allocatable :: k_generation(:) ! single-generation estimates of k - real(8) :: keff = ONE ! average k over active batches - real(8) :: keff_std ! standard deviation of average k - real(8) :: k_col_abs = ZERO ! sum over batches of k_collision * k_absorption - real(8) :: k_col_tra = ZERO ! sum over batches of k_collision * k_tracklength - real(8) :: k_abs_tra = ZERO ! sum over batches of k_absorption * k_tracklength - - ! Shannon entropy - real(8), allocatable :: entropy(:) ! shannon entropy at each generation - real(8), allocatable :: entropy_p(:,:) ! % of source sites in each cell - - ! Uniform fission source weighting - real(8), allocatable :: source_frac(:,:) - - ! ============================================================================ - ! PARALLEL PROCESSING VARIABLES - -#ifdef _OPENMP - integer :: n_threads = NONE ! number of OpenMP threads - integer :: thread_id ! ID of a given thread -#endif - - ! ============================================================================ - ! MISCELLANEOUS VARIABLES - - integer :: restart_batch - - ! Flag for enabling cell overlap checking during transport - integer(8), allocatable :: overlap_check_cnt(:) - - logical :: trace - - ! Number of distribcell maps - integer :: n_maps - -!$omp threadprivate(fission_bank, n_bank, trace, thread_id, current_work) - contains !=============================================================================== diff --git a/src/simulation_header.F90 b/src/simulation_header.F90 new file mode 100644 index 000000000..e47c2dd04 --- /dev/null +++ b/src/simulation_header.F90 @@ -0,0 +1,70 @@ +module simulation_header + + use bank_header + use constants + + implicit none + + ! ============================================================================ + ! GEOMETRY-RELATED VARIABLES + + ! Number of lost particles + integer :: n_lost_particles + + real(8) :: log_spacing ! spacing on logarithmic grid + + ! ============================================================================ + ! EIGENVALUE SIMULATION VARIABLES + + integer :: current_batch ! current batch + integer :: current_gen ! current generation within a batch + integer :: total_gen = 0 ! total number of generations simulated + + ! ============================================================================ + ! TALLY PRECISION TRIGGER VARIABLES + + logical :: satisfy_triggers = .false. ! whether triggers are satisfied + + integer(8) :: work ! number of particles per processor + integer(8), allocatable :: work_index(:) ! starting index in source bank for each process + integer(8) :: current_work ! index in source bank of current history simulated + + ! Temporary k-effective values + real(8), allocatable :: k_generation(:) ! single-generation estimates of k + real(8) :: keff = ONE ! average k over active batches + real(8) :: keff_std ! standard deviation of average k + real(8) :: k_col_abs = ZERO ! sum over batches of k_collision * k_absorption + real(8) :: k_col_tra = ZERO ! sum over batches of k_collision * k_tracklength + real(8) :: k_abs_tra = ZERO ! sum over batches of k_absorption * k_tracklength + + ! Shannon entropy + real(8), allocatable :: entropy(:) ! shannon entropy at each generation + real(8), allocatable :: entropy_p(:,:) ! % of source sites in each cell + + ! Uniform fission source weighting + real(8), allocatable :: source_frac(:,:) + + ! ============================================================================ + ! PARALLEL PROCESSING VARIABLES + +#ifdef _OPENMP + integer :: n_threads = NONE ! number of OpenMP threads + integer :: thread_id ! ID of a given thread +#endif + + ! ============================================================================ + ! MISCELLANEOUS VARIABLES + + integer :: restart_batch + + ! Flag for enabling cell overlap checking during transport + integer(8), allocatable :: overlap_check_cnt(:) + + logical :: trace + + ! Number of distribcell maps + integer :: n_maps + +!$omp threadprivate(trace, thread_id, current_work) + +end module simulation_header