From 399694ed825713e2aef93f054bae8439053a531d Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 20 Mar 2013 13:32:58 -0400 Subject: [PATCH] Added source_write option to inhibit writing source sites in state points. Closes #153. --- docs/source/usersguide/input.rst | 6 ++++++ src/global.F90 | 1 + src/hdf5_interface.F90 | 18 ++++++++++-------- src/input_xml.F90 | 3 +++ src/state_point.F90 | 16 ++++++++++------ src/templates/settings.rnc | 4 +++- src/templates/settings_t.xml | 1 + 7 files changed, 34 insertions(+), 15 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index d6406671ad..30dd030f1a 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -355,6 +355,12 @@ attributes/sub-elements: *Default*: false + :source_write: If this element is set to "false", source sites are not written + to the state point file. This can substantially reduce the size of state + points if large numbers of particles per batch are used. + + *Default*: true + ```` Element ------------------------------ diff --git a/src/global.F90 b/src/global.F90 index d5ce1ebd06..87e07de261 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -189,6 +189,7 @@ module global ! Write source at end of simulation logical :: source_separate = .false. + logical :: source_write = .true. ! ============================================================================ ! PARALLEL PROCESSING VARIABLES diff --git a/src/hdf5_interface.F90 b/src/hdf5_interface.F90 index 5ca2b0c682..4340e30aaa 100644 --- a/src/hdf5_interface.F90 +++ b/src/hdf5_interface.F90 @@ -1104,14 +1104,16 @@ contains ! TODO: Use parallel HDF5 to write source bank ! Write source bank - dims(1) = work - call h5screate_simple_f(1, dims, dspace, hdf5_err) - call h5dcreate_f(hdf5_state_point, "source_bank", hdf5_bank_t, & - dspace, dset, hdf5_err) - f_ptr = c_loc(source_bank(1)) - CALL h5dwrite_f(dset, hdf5_bank_t, f_ptr, hdf5_err) - call h5dclose_f(dset, hdf5_err) - call h5sclose_f(dspace, hdf5_err) + if (source_write) then + dims(1) = work + call h5screate_simple_f(1, dims, dspace, hdf5_err) + call h5dcreate_f(hdf5_state_point, "source_bank", hdf5_bank_t, & + dspace, dset, hdf5_err) + f_ptr = c_loc(source_bank(1)) + CALL h5dwrite_f(dset, hdf5_bank_t, f_ptr, hdf5_err) + call h5dclose_f(dset, hdf5_err) + call h5sclose_f(dspace, hdf5_err) + end if ! Write out CMFD info if active if (cmfd_on) then diff --git a/src/input_xml.F90 b/src/input_xml.F90 index daa6489078..941ec43b56 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -507,8 +507,11 @@ contains ! Check if the user has specified to write binary source file call lower_case(state_point_(1) % source_separate) + call lower_case(state_point_(1) % source_write) if (state_point_(1) % source_separate == 'true' .or. & state_point_(1) % source_separate == '1') source_separate = .true. + if (state_point_(1) % source_write == 'false' .or. & + state_point_(1) % source_write == '0') source_write = .false. else ! If no tag was present, by default write state point at ! last batch only diff --git a/src/state_point.F90 b/src/state_point.F90 index b3dbbc3018..ef2a899bbe 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -126,9 +126,11 @@ contains ! a separate file, we make a call to the appropriate subroutine to ! write it separately - path_source = "source." // trim(to_str(current_batch)) // ".binary" - call write_source_binary() - else + if (source_write) then + path_source = "source." // trim(to_str(current_batch)) // ".binary" + call write_source_binary() + end if + elseif (source_write) then ! Otherwise, write the source sites in the state point file ! Get current offset for master @@ -302,9 +304,11 @@ contains ! a separate file, we make a call to the appropriate subroutine to ! write it separately - path_source = "source." // trim(to_str(current_batch)) // ".binary" - call write_source_binary() - else + if (source_write) then + path_source = "source." // trim(to_str(current_batch)) // ".binary" + call write_source_binary() + end if + elseif (source_write) then ! Otherwise, write the source sites in the state point file write(UNIT_STATE) source_bank diff --git a/src/templates/settings.rnc b/src/templates/settings.rnc index 49950e5154..a83bb6b778 100644 --- a/src/templates/settings.rnc +++ b/src/templates/settings.rnc @@ -88,7 +88,9 @@ element settings { attribute interval { xsd:positiveInteger }) ) & (element source_separate { xsd:boolean } | - attribute source_separate { xsd:boolean })? + attribute source_separate { xsd:boolean })? & + (element source_write { xsd:boolean } | + attribute source_write { xsd:boolean })? }? & element survival_biasing { xsd:boolean }? & diff --git a/src/templates/settings_t.xml b/src/templates/settings_t.xml index 2c4b64460e..48dc494aff 100644 --- a/src/templates/settings_t.xml +++ b/src/templates/settings_t.xml @@ -39,6 +39,7 @@ +