From 093a22384fdf233728948db413619829ad6b6f98 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 14 Mar 2018 13:35:38 -0500 Subject: [PATCH] Make sure photon data gets cleared at end of simulation --- src/api.F90 | 6 +++++- src/photon_header.F90 | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/api.F90 b/src/api.F90 index d79a32d94..8f33e85e3 100644 --- a/src/api.F90 +++ b/src/api.F90 @@ -116,7 +116,8 @@ contains check_overlaps = .false. confidence_intervals = .false. create_fission_neutrons = .true. - energy_cutoff = ZERO + electron_treatment = ELECTRON_LED + energy_cutoff(:) = [ZERO, 1000.0_8, ZERO, ZERO] energy_max_neutron = INFINITY energy_min_neutron = ZERO entropy_on = .false. @@ -135,6 +136,7 @@ contains output_summary = .true. output_tallies = .true. particle_restart_run = .false. + photon_transport = .false. pred_batches = .false. reduce_tallies = .true. res_scat_on = .false. @@ -305,6 +307,7 @@ contains use cmfd_header use mgxs_header + use photon_header use plot_header use sab_header use settings @@ -321,6 +324,7 @@ contains call free_memory_volume() call free_memory_simulation() call free_memory_nuclide() + call free_memory_photon() call free_memory_settings() call free_memory_mgxs() call free_memory_sab() diff --git a/src/photon_header.F90 b/src/photon_header.F90 index e50a871d2..15203e4ff 100644 --- a/src/photon_header.F90 +++ b/src/photon_header.F90 @@ -434,4 +434,21 @@ contains end subroutine photon_calculate_xs +!=============================================================================== +! FREE_MEMORY_PHOTON deallocates/resets global variables in this module +!=============================================================================== + + subroutine free_memory_photon() + ! Deallocate photon cross section data + if (allocated(elements)) deallocate(elements) + if (allocated(compton_profile_pz)) deallocate(compton_profile_pz) + n_elements = 0 + call element_dict % clear() + + ! Clear TTB-related arrays + if (allocated(ttb_e_grid)) deallocate(ttb_e_grid) + if (allocated(ttb_k_grid)) deallocate(ttb_k_grid) + if (allocated(ttb)) deallocate(ttb) + end subroutine free_memory_photon + end module photon_header