Merge remote-tracking branch 'upstream/master' into PnInput

This commit is contained in:
Adam Nelson 2012-12-05 15:01:32 -05:00
commit f2bec91b14
23 changed files with 532 additions and 245 deletions

View file

@ -4,6 +4,227 @@
State Point Binary File Specifications
======================================
----------
Revision 6
----------
**integer(4) REVISION_STATEPOINT**
Revision of the binary state point file. Any time a change is made in the
format of the state-point file, this integer is incremented.
**integer(4) VERSION_MAJOR**
Major version number for OpenMC
**integer(4) VERSION_MINOR**
Minor version number for OpenMC
**integer(4) VERSION_RELEASE**
Release version number for OpenMC
**character(19) time_stamp**
Date and time the state point was written.
**character(255) path**
Absolute path to directory containing input files.
**integer(8) seed**
Pseudo-random number generator seed.
**integer(4) run_mode**
run mode used. The modes are described in constants.F90.
**integer(8) n_particles**
Number of particles used per generation.
**integer(4) n_batches**
Total number of batches (active + inactive).
**integer(4) current_batch**
The number of batches already simulated.
if (run_mode == MODE_CRITICALITY)
**integer(4) n_inactive**
Number of inactive batches
**integer(4) gen_per_batch**
Number of generations per batch for criticality calculations
*do i = 1, current_batch*
**real(8) k_batch(i)**
k-effective for the i-th batch
*do i = 1, current_batch*
**real(8) entropy(i)**
Shannon entropy for the i-th batch
**integer(4) n_meshes**
Number of meshes in tallies.xml file
*do i = 1, n_meshes*
**integer(4) meshes(i) % id**
Unique ID of mesh.
**integer(4) meshes(i) % type**
Type of mesh.
**integer(4) meshes(i) % n_dimension**
Number of dimensions for mesh (2 or 3).
**integer(4) meshes(i) % dimension(:)**
Number of mesh cells in each dimension.
**real(8) meshes(i) % lower_left(:)**
Coordinates of lower-left corner of mesh.
**real(8) meshes(i) % upper_right(:)**
Coordinates of upper-right corner of mesh.
**real(8) meshes(i) % width(:)**
Width of each mesh cell in each dimension.
**integer(4) n_tallies**
*do i = 1, n_tallies*
**integer(4) tallies(i) % id**
Unique ID of tally.
**integer(4) tallies(i) % n_realizations**
Number of realizations for the i-th tally.
**integer(4) size(tallies(i) % scores, 1)**
Total number of score bins for the i-th tally
**integer(4) size(tallies(i) % scores, 2)**
Total number of filter bins for the i-th tally
**integer(4) tallies(i) % n_filters**
*do j = 1, tallies(i) % n_filters*
**integer(4) tallies(i) % filter(j) % type**
Type of tally filter.
**integer(4) tallies(i) % filter(j) % n_bins**
Number of bins for filter.
**integer(4)/real(8) tallies(i) % filter(j) % bins(:)**
Value for each filter bin of this type.
**integer(4) tallies(i) % n_nuclide_bins**
Number of nuclide bins. If none are specified, this is just one.
*do j = 1, tallies(i) % n_nuclide_bins*
**integer(4) tallies(i) % nuclide_bins(j)**
Values of specified nuclide bins
**integer(4) tallies(i) % n_score_bins**
Number of scoring bins.
*do j = 1, tallies(i) % n_score_bins*
**integer(4) tallies(i) % score_bins(j)**
Values of specified scoring bins (e.g. SCORE_FLUX).
**integer(4) n_realizations**
Number of realizations for global tallies.
**integer(4) N_GLOBAL_TALLIES**
Number of global tally scores
*do i = 1, N_GLOBAL_TALLIES*
**real(8) global_tallies(i) % sum**
Accumulated sum for the i-th global tally
**real(8) global_tallies(i) % sum_sq**
Accumulated sum of squares for the i-th global tally
**integer(4) tallies_on**
Flag indicated if tallies are present in the file.
if (tallies_on > 0)
*do i = 1, n_tallies*
*do k = 1, size(tallies(i) % scores, 2)*
*do j = 1, size(tallies(i) % scores, 1)*
**real(8) tallies(i) % scores(j,k) % sum**
Accumulated sum for the j-th score and k-th filter of the
i-th tally
**real(8) tallies(i) % scores(j,k) % sum_sq**
Accumulated sum of squares for the j-th score and k-th
filter of the i-th tally
if (run_mode == MODE_CRITICALITY)
*do i = 1, n_particles*
**real(8) source_bank(i) % wgt**
Weight of the i-th source particle
**real(8) source_bank(i) % xyz(1:3)**
Coordinates of the i-th source particle.
**real(8) source_bank(i) % uvw(1:3)**
Direction of the i-th source particle
**real(8) source_bank(i) % E**
Energy of the i-th source particle.
----------
Revision 5
----------

View file

@ -21,6 +21,9 @@ the problem at hand (mostly on the number of nuclides in the problem).
New Features
------------
- All user input options that formerly accepted "off" or "on" should now be
"false" or "true" (the proper XML schema datatype).
- The <criticality> element is deprecated and was replaced with <eigenvalue>.
- Added 'events' score that returns number of events that scored to a tally.
- Restructured tally filter implementation and user input.
- Source convergence acceleration via CMFD (implemented with PETSc).

View file

@ -62,12 +62,12 @@ settings.xml file.
----------------------------------
The ``<confidence_intervals>`` element has no attributes and has an accepted
value of "on" or "off". If set to "on", uncertainties on tally results will be
reported as the half-width of the 95% two-sided confidence interval. If set to
"off", uncertainties on tally results will be reported as the sample standard
deviation.
value of "true" or "flase". If set to "true", uncertainties on tally results
will be reported as the half-width of the 95% two-sided confidence interval. If
set to "false", uncertainties on tally results will be reported as the sample
standard deviation.
*Default*: off
*Default*: false
.. _cross_sections:
@ -185,14 +185,14 @@ performed. It has the following attributes/sub-elements:
``<no_reduce>`` Element
-----------------------
The ``<no_reduce>`` element has no attributes and has an accepted value of "on"
or "off". If set to "on", all user-defined tallies and global tallies will not
be reduced across processors in a parallel calculation. This means that the
accumulate score in one batch on a single processor is considered as an
The ``<no_reduce>`` element has no attributes and has an accepted value of
"true" or "false". If set to "true", all user-defined tallies and global tallies
will not be reduced across processors in a parallel calculation. This means that
the accumulate score in one batch on a single processor is considered as an
independent realization for the tally random variable. For a problem with large
tally data, this option can significantly improve the parallel efficiency.
*Default*: off
*Default*: false
``<output>`` Element
--------------------
@ -217,9 +217,18 @@ sections summary file to be written, this element should be given as:
The ``<ptables>`` element determines whether probability tables should be used
in the unresolved resonance range if available. This element has no attributes
or sub-elements and can be set to either "off" or "on".
or sub-elements and can be set to either "false" or "true".
*Default*: on
*Default*: true
``<run_cmfd>`` Element
----------------------
The ``<run_cmfd>`` element indicates whether or not CMFD acceleration should be
turned on or off. This element has no attributes or sub-elements and can be set
to either "false" or "true".
*Defualt*: false
``<seed>`` Element
------------------
@ -340,20 +349,20 @@ attributes/sub-elements:
*Default*: None
:source_separate:
If this element is set to "on", a separate binary source file will be
If this element is set to "true", a separate binary source file will be
written. Otherwise, the source sites will be written in the state point
directly.
*Default*: "off"
*Default*: false
``<survival_biasing>`` Element
------------------------------
The ``<survival_biasing>`` element has no attributes and has an accepted value
of "on" or "off". If set to "on", this option will enable the use of survival
biasing, otherwise known as implicit capture or absorption.
of "true" or "false". If set to "true", this option will enable the use of
survival biasing, otherwise known as implicit capture or absorption.
*Default*: off
*Default*: false
.. _trace:
@ -990,14 +999,14 @@ sub-elements:
*Default*: None
--------------------------------------------
------------------------------
CMFD Specification -- cmfd.xml
--------------------------------------------
------------------------------
Coarse mesh finite difference acceleration method has been implemented in OpenMC.
Currently, it allows users to accelerate fission source convergence during
inactive neutron batches. To run CMFD, the ``<run_cmfd>`` element in
``settings.xml`` should be set to ``.true.``.
``settings.xml`` should be set to "true".
``<active_flush>`` Element
--------------------------
@ -1018,11 +1027,11 @@ The ``<begin>`` element controls what batch CMFD calculations should begin.
``<feedback>`` Element
----------------------
The ``<feedback>`` element controls whether or not the CMFD diffusion result is
used to adjust the weight of fission source neutrons on the next OpenMC batch.
It can be turned on with ".true." and off with ".false.".
The ``<feedback>`` element controls whether or not the CMFD diffusion result is
used to adjust the weight of fission source neutrons on the next OpenMC batch.
It can be turned on with "true" and off with "false".
*Default*: .false.
*Default*: false
``<inactive>`` Element
----------------------
@ -1030,9 +1039,9 @@ It can be turned on with ".true." and off with ".false.".
The ``<inactive>`` element controls if cmfd tallies should be accumulated
during inactive batches. For some applications, CMFD tallies may not be
needed until the start of active batches. This option can be turned on
with ".true." and off with ".false."
with "true" and off with "false"
*Default*: .true.
*Default*: true
``<keff_tol>`` Element
----------------------
@ -1047,11 +1056,11 @@ CMFD is allowed to modify source neutron weights.
-------------------------
The ``<ksp_monitor>`` element is used to view the convergence of linear GMRES
iterations in PETSc. This option can be turned on with ".true." and turned off
with ".false.".
iterations in PETSc. This option can be turned on with "true" and turned off
with "false".
*Default*: .false.
*Default*: false
``<mesh>`` Element
------------------
@ -1138,28 +1147,28 @@ processors used during OpenMC.
---------------------------
The ``<power_monitor>`` element is used to view the convergence of power iteration.
This option can be turned on with ".true." and turned off with ".false.".
This option can be turned on with "true" and turned off with "false".
*Default*: .false.
*Default*: false
``<write_balance>`` Element
---------------------------
The ``<write_balance>`` element is used to view the balance of OpenMC tally
residuals for every coarse mesh region and energy group. This option can be
turned on with ".true." and off with ".false.".
turned on with "true" and off with "false".
*Default*: .false.
*Default*: false
``<write_hdf5>`` Element
------------------------
The ``<write_hdf5>`` element can be turned on with ".true." to get an
The ``<write_hdf5>`` element can be turned on with "true" to get an
HDF5 output file of CMFD results.
*Default*: .false.
*Default*: false
``<write_matrices>`` Element
----------------------------
@ -1167,6 +1176,6 @@ HDF5 output file of CMFD results.
The ``<write_matrices>`` element is used to view the PETSc sparse matrices
created when solving CMFD equations. These binary output files can be imported
into MATLAB using PETSc-MATLAB utilities. This option can be
turned on with ".true." and off with ".false.".
turned on with "true" and off with "false".
*Default*: .false.
*Default*: false

View file

@ -9,8 +9,8 @@ Prerequisites
-------------
In order to compile OpenMC, you will need to have a Fortran compiler installed
on your machine. Since a number of Fortran 2003 features are used in the code,
it is recommended that you use the latest version of whatever compiler you
on your machine. Since a number of Fortran 2003/2008 features are used in the
code, it is recommended that you use the latest version of whatever compiler you
choose. For gfortran_, it is recommended that you use version 4.5.0 or above.
If you are using Debian or a Debian derivative such as Ubuntu, you can install
@ -21,9 +21,10 @@ the gfortran compiler using the following command::
To compile with support for parallel runs on a distributed-memory architecture,
you will need to have a valid implementation of MPI installed on your
machine. The code has been tested and is known to work with the latest versions
of both OpenMPI_ and MPICH2_. You may use older versions of MPI implementations
at your own risk. OpenMPI and/or MPICH2 can be installed on Debian derivatives
with::
of both OpenMPI_ and MPICH2_. Note that if using OpenMPI, make sure that
--with-mpi-f90-size is not set to medium or large since this may prevent MPI
calls from completing successfully in OpenMC. OpenMPI and/or MPICH2 can be
installed on Debian derivatives with::
sudo apt-get install mpich2
sudo apt-get install openmpi-bin
@ -75,7 +76,7 @@ Options sections in the Makefile:
COMPILER
This variable tells the Makefile which compiler to use. Valid options are
gfortran, intel, pgi, ibm, and cray.
gnu, intel, pgi, ibm, and cray. The default is gnu (gfortran).
DEBUG
Enables debugging when compiling. The flags added are dependent on which
@ -85,17 +86,21 @@ PROFILE
Enables profiling using the GNU profiler, gprof.
OPTIMIZE
Enables high-optimization using compiler-dependent flags. For gfortran,
this compiles with -O3. For Intel Fortran, this compiles with -O3 as well as
interprocedural optimization.
Enables high-optimization using compiler-dependent flags. For gfortran and
Intel Fortran, this compiles with -O3.
USE_MPI
Enables parallel runs using the Message Passing Interface. Users should also
set the MPI_ROOT directory further down in the Makefile.
MPI
Enables parallel runs using the Message Passing Interface. The MPI_DIR
variable should be set to the base directory of the MPI implementation.
USE_HDF5
Enables HDF5 output in addition to normal screen and text file output. Users
should also set the HDF5_ROOT directory further down in the Makefile.
HDF5
Enables HDF5 output in addition to normal screen and text file output. The
HDF5_DIR variable should be set to the base directory of the HDF5
installation.
PETSC
Enables PETSc for use in CMFD acceleration. The PETSC_DIR variable should be
set to the base directory of the PETSc installation.
It is also possible to change these options from the command line itself. For
example, if you want to compile with DEBUG turned on without actually change the

View file

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<settings>
<!-- Parameters for criticality calculation -->
<criticality>
<!-- Parameters for k-eigenvalue calculation -->
<eigenvalue>
<batches>15</batches>
<inactive>5</inactive>
<particles>10000</particles>
</criticality>
</eigenvalue>
<!-- Starting source -->
<source>

View file

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<settings>
<!-- Parameters for criticality calculation -->
<criticality>
<!-- Parameters for k-eigenvalue calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>10000</particles>
</criticality>
</eigenvalue>
<!-- Starting source -->
<source>

View file

@ -1,14 +1,12 @@
<?xml version="1.0"?>
<settings>
<!-- Parameters for criticality calculation -->
<criticality>
<!-- Parameters for k-eigenvalue calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>10000</particles>
</criticality>
<verbosity>7</verbosity>
</eigenvalue>
<!-- Starting source -->
<source>

View file

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<settings>
<!-- Parameters for criticality calculation -->
<criticality>
<!-- Parameters for k-eigenvalue calculation -->
<eigenvalue>
<batches>500</batches>
<inactive>10</inactive>
<particles>10000</particles>
</criticality>
</eigenvalue>
<!-- Starting source -->
<source>

View file

@ -17,9 +17,9 @@ Building the executable for OpenMC is as easy as going to the src directory and
running make. By default, the Makefile is set to use the GNU Fortran compiler,
gfortran. This can be changed by the F90 variable in the Makefile.
Compiling for multiple processors can be controlled with the USE_MPI and MPI
variables. The MPI variable should be set to the base directory of the MPI
implementation installed on your computer.
Compiling with support for distributed-memory parallelism can be controlled with
the MPI and MPI_DIR variables. The MPI_DIR variable should be set to the base
directory of the MPI implementation installed on your computer.
OpenMC has been tested on Linux, Mac, and Windows platforms with Intel, GNU,
IBM, Cray, and PGI compilers. It is recommended to use the latest version of

View file

@ -35,6 +35,7 @@ contains
use error, only: fatal_error
use global
use output, only: write_message
use string, only: lower_case
use xml_data_cmfd_t
use, intrinsic :: ISO_FORTRAN_ENV
@ -103,38 +104,58 @@ contains
cmfd % norm = norm_
! set feedback logical
cmfd_feedback = feedback_
call lower_case(feedback_)
if (feedback_ == 'true' .or. feedback_ == '1') cmfd_feedback = .true.
! set balance logical
! cmfd_balance = balance_
! call lower_case(balance_)
! if (balance_ == 'true' .or. balance == '1') cmfd_balance = .true.
! set downscatter logical
! cmfd_downscatter = downscatter_
! call lower_case(downscatter_)
! if (downscatter_ == 'true' .or. downscatter == '1') &
! cmfd_downscatter = downscatter_
! set 2 group fix
cmfd_run_2grp = run_2grp_
call lower_case(run_2grp_)
if (run_2grp_ == 'true' .or. run_2grp_ == '1') cmfd_run_2grp = .true.
! set the solver type
cmfd_solver_type = solver_
! set monitoring
cmfd_snes_monitor = snes_monitor_
cmfd_ksp_monitor = ksp_monitor_
cmfd_power_monitor = power_monitor_
call lower_case(snes_monitor_)
call lower_case(ksp_monitor_)
call lower_case(power_monitor_)
if (snes_monitor_ == 'true' .or. snes_monitor_ == '1') &
cmfd_snes_monitor = .true.
if (ksp_monitor_ == 'true' .or. ksp_monitor_ == '1') &
cmfd_ksp_monitor = .true.
if (power_monitor_ == 'true' .or. power_monitor_ == '1') &
cmfd_power_monitor = .true.
! output logicals
cmfd_write_balance = write_balance_
cmfd_write_matrices = write_matrices_
! cmfd_write_hdf5 = write_hdf5_
call lower_case(write_balance_)
call lower_case(write_matrices_)
! call lower_case(write_hdf5_)
if (write_balance_ == 'true' .or. write_balance_ == '1') &
cmfd_write_balance = .true.
if (write_matrices_ == 'true' .or. write_matrices_ == '1') &
cmfd_write_matrices = .true.
! if (write_hdf5_ == 'true' .or. write_hdf5_ == '1') &
! cmfd_write_hdf5 = .true.
! run an adjoint calc
cmfd_run_adjoint = run_adjoint_
call lower_case(run_adjoint_)
if (run_adjoint_ == 'true' .or. run_adjoint_ == '1') &
cmfd_run_adjoint = .true.
! batch to begin cmfd
cmfd_begin = begin_
! tally during inactive batches
cmfd_tally_on = inactive_
call lower_case(inactive_)
if (inactive_ == 'false' .or. inactive_ == '0') cmfd_tally_on = .false.
! inactive batch flush window
cmfd_inact_flush(1) = inactive_flush_
@ -321,7 +342,8 @@ contains
t => tallies(i)
! set reset property
if (reset_) t % reset = .true.
call lower_case(reset_)
if (reset_ == 'true' .or. reset_ == '1') t % reset = .true.
! set up mesh filter
n_filters = 1

View file

@ -12,7 +12,7 @@ module constants
! Revision numbers for binary files
integer, parameter :: REVISION_SOURCE = 1
integer, parameter :: REVISION_STATEPOINT = 5
integer, parameter :: REVISION_STATEPOINT = 6
! ============================================================================
! ADJUSTABLE PARAMETERS
@ -303,10 +303,9 @@ module constants
! Global tallY parameters
integer, parameter :: N_GLOBAL_TALLIES = 4
integer, parameter :: &
K_ANALOG = 1, &
K_COLLISION = 2, &
K_TRACKLENGTH = 3, &
LEAKAGE = 4
K_COLLISION = 1, &
K_TRACKLENGTH = 2, &
LEAKAGE = 3
! ============================================================================
! EXTERNAL SOURCE PARAMETERS

View file

@ -19,7 +19,8 @@ module eigenvalue
use source, only: get_source_particle
use state_point, only: write_state_point, replay_batch_history
use string, only: to_str
use tally, only: synchronize_tallies, setup_active_usertallies
use tally, only: synchronize_tallies, setup_active_usertallies, &
reset_result
use timing, only: timer_start, timer_stop
#ifdef HDF5
@ -162,11 +163,9 @@ contains
integer :: i ! loop index for state point batches
! Collect tallies
if (tallies_on) then
call timer_start(time_tallies)
call synchronize_tallies()
call timer_stop(time_tallies)
end if
call timer_start(time_tallies)
call synchronize_tallies()
call timer_stop(time_tallies)
! Calculate shannon entropy
if (entropy_on) call shannon_entropy()
@ -545,10 +544,8 @@ contains
! =========================================================================
! SINGLE-BATCH ESTIMATE OF K-EFFECTIVE
if (.not. active_batches) k_batch(current_batch) = global_tallies(K_ANALOG) % value
#ifdef MPI
if ((.not. active_batches) .or. (.not. reduce_tallies)) then
if (.not. reduce_tallies) then
! Reduce value of k_batch if running in parallel
if (master) then
call MPI_REDUCE(MPI_IN_PLACE, k_batch(current_batch), 1, MPI_REAL8, &
@ -567,71 +564,59 @@ contains
(n_particles * gen_per_batch)
end if
if (active_batches) then
! =======================================================================
! ACTIVE BATCHES
! =========================================================================
! ACCUMULATED K-EFFECTIVE AND ITS VARIANCE
if (reduce_tallies) then
! In this case, global_tallies has already been reduced, so we don't
! need to perform any more reductions and just take the values from
! global_tallies directly
if (reduce_tallies) then
! In this case, global_tallies has already been reduced, so we don't
! need to perform any more reductions and just take the values from
! global_tallies directly
! Sample mean of keff
keff = global_tallies(K_ANALOG) % sum / n_realizations
! Sample mean of keff
keff = global_tallies(K_TRACKLENGTH) % sum / n_realizations
if (n_realizations > 1) then
if (confidence_intervals) then
! Calculate t-value for confidence intervals
alpha = ONE - CONFIDENCE_LEVEL
t_value = t_percentile(ONE - alpha/TWO, n_realizations - 1)
else
t_value = ONE
end if
! Standard deviation of the sample mean of k
keff_std = t_value * sqrt((global_tallies(K_ANALOG) % sum_sq / &
n_realizations - keff * keff) / (n_realizations - 1))
if (n_realizations > 1) then
if (confidence_intervals) then
! Calculate t-value for confidence intervals
alpha = ONE - CONFIDENCE_LEVEL
t_value = t_percentile(ONE - alpha/TWO, n_realizations - 1)
else
t_value = ONE
end if
else
! In this case, no reduce was ever done on global_tallies. Thus, we
! need to reduce the values in sum and sum^2 to get the sample mean
! and its standard deviation
! Standard deviation of the sample mean of k
keff_std = t_value * sqrt((global_tallies(K_TRACKLENGTH) % sum_sq / &
n_realizations - keff * keff) / (n_realizations - 1))
end if
else
! In this case, no reduce was ever done on global_tallies. Thus, we need
! to reduce the values in sum and sum^2 to get the sample mean and its
! standard deviation
#ifdef MPI
call MPI_REDUCE(global_tallies(K_ANALOG) % sum, temp, 2, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
call MPI_REDUCE(global_tallies(K_TRACKLENGTH) % sum, temp, 2, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
#else
temp(1) = global_tallies(K_ANALOG) % sum
temp(2) = global_tallies(K_ANALOG) % sum_sq
temp(1) = global_tallies(K_TRACKLENGTH) % sum
temp(2) = global_tallies(K_TRACKLENGTH) % sum_sq
#endif
! Sample mean of k
keff = temp(1) / n_realizations
! Sample mean of k
keff = temp(1) / n_realizations
if (n_realizations > 1) then
if (confidence_intervals) then
! Calculate t-value for confidence intervals
alpha = ONE - CONFIDENCE_LEVEL
t_value = t_percentile(ONE - alpha/TWO, n_realizations - 1)
else
t_value = ONE
end if
! Standard deviation of the sample mean of k
keff_std = t_value * sqrt((temp(2)/n_realizations - keff*keff) / &
(n_realizations - 1))
if (n_realizations > 1) then
if (confidence_intervals) then
! Calculate t-value for confidence intervals
alpha = ONE - CONFIDENCE_LEVEL
t_value = t_percentile(ONE - alpha/TWO, n_realizations - 1)
else
t_value = ONE
end if
! Standard deviation of the sample mean of k
keff_std = t_value * sqrt((temp(2)/n_realizations - keff*keff) / &
(n_realizations - 1))
end if
else
! =======================================================================
! INACTIVE BATCHES
! Set keff
keff = k_batch(current_batch)
! Reset tally values
global_tallies(:) % value = ZERO
end if
#ifdef MPI
@ -639,6 +624,12 @@ contains
call MPI_BCAST(keff, 1, MPI_REAL8, 0, MPI_COMM_WORLD, mpi_err)
#endif
! Reset global tally results
if (.not. active_batches) then
call reset_result(global_tallies)
n_realizations = 0
end if
end subroutine calculate_keff
!===============================================================================

View file

@ -854,6 +854,10 @@ contains
call h5ltmake_dataset_string_f(hdf5_state_point, "date_and_time", &
time_stamp(), hdf5_err)
! Write path to input
call h5ltmake_dataset_string_f(hdf5_state_point, "path", &
path_input, hdf5_err)
! Write out random number seed
call hdf5_write_long(hdf5_state_point, "seed", seed)
@ -890,7 +894,8 @@ contains
call h5gcreate_f(tallies_group, "mesh " // to_str(meshes(i) % id), &
temp_group, hdf5_err)
! Write type and number of dimensions
! Write id, type, and number of dimensions
call hdf5_write_integer(temp_group, "id", meshes(i) % id)
call hdf5_write_integer(temp_group, "type", meshes(i) % type)
call hdf5_write_integer(temp_group, "n_dimension", &
meshes(i) % n_dimension)
@ -921,6 +926,9 @@ contains
call h5gcreate_f(tallies_group, "tally " // to_str(t % id), &
temp_group, hdf5_err)
! Write id
call hdf5_write_integer(temp_group, "id", t % id)
! Write number of realizations
call hdf5_write_integer(temp_group, "n_realizations", &
t % n_realizations)

View file

@ -69,11 +69,10 @@ contains
end if
! Initialize XML scalar variables
cross_sections_ = ""
cross_sections_ = ''
verbosity_ = 0
energy_grid_ = "union"
energy_grid_ = 'union'
seed_ = 0_8
no_reduce_ = ""
source_ % file = ''
source_ % space % type = ''
source_ % angle % type = ''
@ -353,10 +352,12 @@ contains
end if
! Survival biasing
if (trim(survival_) == 'on') survival_biasing = .true.
call lower_case(survival_)
if (survival_ == 'true' .or. survival_ == '1') survival_biasing = .true.
! Probability tables
if (ptables_ == 'off') urr_ptables_on = .false.
call lower_case(ptables_)
if (ptables_ == 'false' .or. ptables_ == '0') urr_ptables_on = .false.
! Cutoffs
if (size(cutoff_) > 0) then
@ -503,8 +504,9 @@ contains
end if
! Check if the user has specified to write binary source file
if (trim(state_point_(1) % source_separate) == 'on') &
source_separate = .true.
call lower_case(state_point_(1) % source_separate)
if (state_point_(1) % source_separate == 'true' .or. &
state_point_(1) % source_separate == '1') source_separate = .true.
else
! If no <state_point> tag was present, by default write state point at
! last batch only
@ -515,11 +517,14 @@ contains
! Check if the user has specified to not reduce tallies at the end of every
! batch
if (trim(no_reduce_) == 'on') reduce_tallies = .false.
call lower_case(no_reduce_)
if (no_reduce_ == 'true' .or. no_reduce_ == '1') reduce_tallies = .false.
! Check if the user has specified to use confidence intervals for
! uncertainties rather than standard deviations
if (trim(confidence_intervals_) == 'on') confidence_intervals = .true.
call lower_case(confidence_intervals_)
if (confidence_intervals_ == 'true' .or. &
confidence_intervals_ == '1') confidence_intervals = .true.
! Check for output options
if (associated(output_)) then
@ -537,7 +542,8 @@ contains
end if
! check for cmfd run
if (run_cmfd_) then
call lower_case(run_cmfd_)
if (run_cmfd_ == 'true' .or. run_cmfd_ == '1') then
cmfd_run = .true.
#ifndef PETSC
if (master) then

View file

@ -1367,8 +1367,6 @@ contains
end if
! 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, &

View file

@ -104,7 +104,7 @@ contains
call score_tracklength_tally(distance)
! Score track-length estimate of k-eff
if (tallies_on) global_tallies(K_TRACKLENGTH) % value = &
global_tallies(K_TRACKLENGTH) % value = &
global_tallies(K_TRACKLENGTH) % value + p % wgt * distance * &
material_xs % nu_fission
@ -130,7 +130,7 @@ contains
! PARTICLE HAS COLLISION
! Score collision estimate of keff
if (tallies_on) global_tallies(K_COLLISION) % value = &
global_tallies(K_COLLISION) % value = &
global_tallies(K_COLLISION) % value + p % wgt * &
material_xs % nu_fission / material_xs % total
@ -904,10 +904,6 @@ contains
nu = int(nu_t) + 1
end if
! Add to analog estimate of keff
global_tallies(K_ANALOG) % value = &
global_tallies(K_ANALOG) % value + nu/weight * keff
! Bank source neutrons
if (nu == 0 .or. n_bank == 3*work) return
do i = int(n_bank,4) + 1, int(min(n_bank + nu, 3*work),4)

View file

@ -170,6 +170,9 @@ contains
! Write current date and time
write(UNIT_STATE) time_stamp()
! Write path to input
write(UNIT_STATE) path_input
! Write out random number seed
write(UNIT_STATE) seed
@ -191,6 +194,7 @@ contains
! Write information for meshes
MESH_LOOP: do i = 1, n_meshes
write(UNIT_STATE) meshes(i) % id
write(UNIT_STATE) meshes(i) % type
write(UNIT_STATE) meshes(i) % n_dimension
write(UNIT_STATE) meshes(i) % dimension
@ -206,6 +210,9 @@ contains
! Get pointer to tally
t => tallies(i)
! Write id
write(UNIT_STATE) t % id
! Number of realizations
write(UNIT_STATE) t % n_realizations
@ -336,6 +343,10 @@ contains
call MPI_FILE_WRITE(fh, time_stamp(), 19, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpi_err)
! Write path to input
call MPI_FILE_WRITE(fh, path_input, MAX_FILE_LEN, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpi_err)
! Write out random number seed
call MPI_FILE_WRITE(fh, seed, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpi_err)
@ -370,6 +381,8 @@ contains
! Write information for meshes
MESH_LOOP: do i = 1, n_meshes
call MPI_FILE_WRITE(fh, meshes(i) % id, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_WRITE(fh, meshes(i) % type, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_WRITE(fh, meshes(i) % n_dimension, 1, MPI_INTEGER, &
@ -394,6 +407,10 @@ contains
! Get pointer to tally
t => tallies(i)
! Write id
call MPI_FILE_WRITE(fh, t % id, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
! Write number of realizations
call MPI_FILE_WRITE(fh, t % n_realizations, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
@ -591,6 +608,7 @@ contains
integer, allocatable :: int_array(:)
real(8), allocatable :: real_array(:)
character(19) :: current_time ! current date and time
character(MAX_FILE_LEN) :: path_temp
#ifdef MPI
integer :: fh ! file handle
@ -636,6 +654,10 @@ contains
call MPI_FILE_READ_ALL(fh, current_time, 19, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpi_err)
! Read path to input
call MPI_FILE_READ_ALL(fh, path_temp, MAX_FILE_LEN, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpi_err)
! Read and overwrite random number seed
call MPI_FILE_READ_ALL(fh, seed, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpi_err)
@ -673,13 +695,13 @@ contains
end if
MESH_LOOP: do i = 1, n_meshes
! Read type of mesh and dimension
call MPI_FILE_READ(fh, temp, 2, MPI_INTEGER, MPI_STATUS_IGNORE, &
! Read id, mesh type, and dimension
call MPI_FILE_READ(fh, temp, 3, MPI_INTEGER, MPI_STATUS_IGNORE, &
mpi_err)
! Skip mesh data
call MPI_FILE_GET_POSITION(fh, offset, mpi_err)
offset = offset + temp(2)*(4 + 3*8)
offset = offset + temp(3)*(4 + 3*8)
call MPI_FILE_SEEK(fh, offset, MPI_SEEK_SET, mpi_err)
end do MESH_LOOP
@ -691,6 +713,10 @@ contains
end if
TALLY_METADATA: do i = 1, n_tallies
! Read tally id
call MPI_FILE_READ(fh, tallies(i) % id, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
! Read number of realizations for global tallies
call MPI_FILE_READ(fh, tallies(i) % n_realizations, 1, &
MPI_INTEGER, MPI_STATUS_IGNORE, mpi_err)
@ -848,6 +874,9 @@ contains
! Read date and time
read(UNIT_STATE) current_time
! Read path
read(UNIT_STATE) path_temp
! Read and overwrite random number seed
read(UNIT_STATE) seed
@ -873,12 +902,12 @@ contains
end if
MESH_LOOP: do i = 1, n_meshes
! Read type of mesh and dimension
read(UNIT_STATE) temp(1:2)
! Read id, mesh type, and dimension
read(UNIT_STATE) temp(1:3)
! Allocate temporary arrays
allocate(int_array(temp(2)))
allocate(real_array(temp(2)))
allocate(int_array(temp(3)))
allocate(real_array(temp(3)))
! Read dimension, lower_left, upper_right, width
read(UNIT_STATE) int_array
@ -899,6 +928,9 @@ contains
end if
TALLY_METADATA: do i = 1, n_tallies
! Read id
read(UNIT_STATE) temp(1)
! Read number of realizations
read(UNIT_STATE) tallies(i) % n_realizations

View file

@ -1481,16 +1481,15 @@ contains
type(ListInt), pointer :: curr_ptr => null()
#ifdef MPI
if (reduce_tallies) call reduce_tally_values()
! Combine tally results onto master process
if (reduce_tallies) call reduce_tally_results()
#endif
! Increase number of realizations (only used for global tallies)
if (active_batches) then
if (reduce_tallies) then
n_realizations = n_realizations + 1
else
n_realizations = n_realizations + n_procs
end if
if (reduce_tallies) then
n_realizations = n_realizations + 1
else
n_realizations = n_realizations + n_procs
end if
! Accumulate on master only unless run is not reduced then do it on all
@ -1507,11 +1506,11 @@ contains
! --- this has to be performed after reduce_tally_values and before
! accumulate_result
k_batch(current_batch) = global_tallies(K_ANALOG) % value
k_batch(current_batch) = global_tallies(K_TRACKLENGTH) % value
end if
! Accumulate results for global tallies
if (active_batches) call accumulate_result(global_tallies)
call accumulate_result(global_tallies)
end if
if (associated(curr_ptr)) nullify(curr_ptr)
@ -1519,11 +1518,11 @@ contains
end subroutine synchronize_tallies
!===============================================================================
! REDUCE_TALLY_VALUES collects all the results from tallies onto one processor
! REDUCE_TALLY_RESULTS collects all the results from tallies onto one processor
!===============================================================================
#ifdef MPI
subroutine reduce_tally_values()
subroutine reduce_tally_results()
integer :: n ! number of filter bins
integer :: m ! number of score bins
@ -1568,23 +1567,21 @@ contains
end do
! Copy global tallies into array to be reduced
if (active_batches) then
global_temp = global_tallies(:) % value
global_temp = global_tallies(:) % value
if (master) then
call MPI_REDUCE(MPI_IN_PLACE, global_temp, N_GLOBAL_TALLIES, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
if (master) then
call MPI_REDUCE(MPI_IN_PLACE, global_temp, N_GLOBAL_TALLIES, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
! Transfer values back to global_tallies on master
global_tallies(:) % value = global_temp
else
! Receive buffer not significant at other processors
call MPI_REDUCE(global_temp, dummy, N_GLOBAL_TALLIES, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
! Transfer values back to global_tallies on master
global_tallies(:) % value = global_temp
else
! Receive buffer not significant at other processors
call MPI_REDUCE(global_temp, dummy, N_GLOBAL_TALLIES, &
MPI_REAL8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
! Reset value on other processors
global_tallies(:) % value = ZERO
end if
! Reset value on other processors
global_tallies(:) % value = ZERO
end if
! We also need to determine the total starting weight of particles from the
@ -1600,7 +1597,7 @@ contains
if (associated(curr_ptr)) nullify(curr_ptr)
end subroutine reduce_tally_values
end subroutine reduce_tally_results
#endif
!===============================================================================

View file

@ -20,37 +20,37 @@ element cmfd {
element norm { xsd:double }? &
element feedback { ".true." | ".false." }? &
element feedback { xsd:boolean }? &
element n_cmfd_procs { xsd:int }? &
element reset { ".true." | ".false." }? &
element reset { xsd:boolean }? &
element balance { ".true." | ".false." }? &
element balance { xsd:boolean }? &
element downscatter { ".true." | ".false." }? &
element downscatter { xsd:boolean }? &
element run_2grp { ".true." | ".false." }? &
element run_2grp { xsd:boolean }? &
element solver { xsd:string }? &
element snes_monitor { ".true." | ".false." }? &
element snes_monitor { xsd:boolean }? &
element ksp_monitor { ".true." | ".false." }? &
element ksp_monitor { xsd:boolean }? &
element power_monitor { ".true." | ".false." }? &
element power_monitor { xsd:boolean }? &
element write_balance { ".true." | ".false." }? &
element write_balance { xsd:boolean }? &
element write_matrices { ".true." | ".false." }? &
element write_matrices { xsd:boolean }? &
element run_adjoint { ".true." | ".false." }? &
element run_adjoint { xsd:boolean }? &
element write_hdf5 { ".true." | ".false." }? &
element write_hdf5 { xsd:boolean }? &
element begin { xsd:int }? &
element inactive { ".true." | ".false." }? &
element inactive { xsd:boolean }? &
element active_flush { xsd:int }? &

View file

@ -15,22 +15,22 @@
<variable name="mesh_" tag="mesh" type="mesh_xml" />
<variable name="norm_" tag="norm" type="double" default="1.0" />
<variable name="feedback_" tag="feedback" type="logical" default=".false." />
<variable name="feedback_" tag="feedback" type="word" length="5" />
<variable name="n_cmfd_procs_" tag="n_procs" type="integer" default="1" />
<variable name="reset_" tag="reset" type="logical" default=".false." />
<variable name="balance_" tag="balance" type="logical" default=".false." />
<variable name="downscatter_" tag="downscatter" type="logical" default=".false." />
<variable name="run_2grp_" tag="run_2grp" type="logical" default=".false." />
<variable name="reset_" tag="reset" type="word" length="5" />
<variable name="balance_" tag="balance" type="word" length="5" />
<variable name="downscatter_" tag="downscatter" type="word" length="5" />
<variable name="run_2grp_" tag="run_2grp" type="word" length="5" />
<variable name="solver_" tag="solver" type="word" default="'power'" length="250" />
<variable name="snes_monitor_" tag="snes_monitor" type="logical" default=".false." />
<variable name="ksp_monitor_" tag="ksp_monitor" type="logical" default=".false." />
<variable name="power_monitor_" tag="power_monitor" type="logical" default=".false." />
<variable name="write_balance_" tag="write_balance" type="logical" default=".false." />
<variable name="write_matrices_" tag="write_matrices" type="logical" default=".false." />
<variable name="run_adjoint_" tag="run_adjoint" type="logical" default=".false." />
<variable name="write_hdf5_" tag="write_hdf5" type="logical" default=".false." />
<variable name="snes_monitor_" tag="snes_monitor" type="word" length="5" />
<variable name="ksp_monitor_" tag="ksp_monitor" type="word" length="5" />
<variable name="power_monitor_" tag="power_monitor" type="word" length="5" />
<variable name="write_balance_" tag="write_balance" type="word" length="5" />
<variable name="write_matrices_" tag="write_matrices" type="word" length="5" />
<variable name="run_adjoint_" tag="run_adjoint" type="word" length="5" />
<variable name="write_hdf5_" tag="write_hdf5" type="word" length="5" />
<variable name="begin_" tag="begin" type="integer" default="1" />
<variable name="inactive_" tag="inactive" type="logical" default=".true." />
<variable name="inactive_" tag="inactive" type="word" length="5" />
<variable name="active_flush_" tag="active_flush" type="integer" default="0" />
<variable name="keff_tol_" tag="keff_tol" type="double" default="0.005" />
<variable name="inactive_flush_" tag="inactive_flush" type="integer" default="9999" />

View file

@ -1,5 +1,5 @@
element settings {
element confidence_intervals { ( "on" | "off" ) }? &
element confidence_intervals { xsd:boolean }? &
(
element eigenvalue {
@ -38,14 +38,14 @@ element settings {
attribute upper_right { list { xsd:double+ } })
}? &
element no_reduce { ( "off" | "on" ) }? &
element no_reduce { xsd:boolean }? &
element output { list {
( "summary" | "cross_sections" | "tallies" )+ } }? &
element ptables { ( "off" | "on" ) }? &
element ptables { xsd:boolean }? &
element run_cmfd { ( ".false." | ".true." ) }? &
element run_cmfd { xsd:boolean }? &
element seed { xsd:positiveInteger }? &
@ -87,11 +87,11 @@ element settings {
(element interval { xsd:positiveInteger } |
attribute interval { xsd:positiveInteger })
) &
(element source_separate { ( "off" | "on" ) } |
attribute source_separate { ( "off" | "on" ) })?
(element source_separate { xsd:boolean } |
attribute source_separate { xsd:boolean })?
}? &
element survival_biasing { ( "off" | "on" ) }? &
element survival_biasing { xsd:boolean }? &
element trace { list { xsd:positiveInteger+ } }? &

View file

@ -38,24 +38,24 @@
<typedef name="statepoint_xml">
<component name="batches" type="integer-array" />
<component name="interval" type="integer" default="0" />
<component name="source_separate" type="word" length="3" default="''" />
<component name="source_separate" type="word" length="5" default="''" />
</typedef>
<variable name="confidence_intervals_" tag="confidence_intervals" type="word" length="3" />
<variable name="confidence_intervals_" tag="confidence_intervals" type="word" length="5" />
<variable name="cross_sections_" tag="cross_sections" type="word" length="255" />
<variable name="cutoff_" tag="cutoff" type="cutoff_xml" dimension="1" />
<variable name="eigenvalue_" tag="eigenvalue" type="run_parameters_xml" />
<variable name="energy_grid_" tag="energy_grid" type="word" length="7" />
<variable name="entropy_" tag="entropy" type="mesh_xml" dimension="1" />
<variable name="fixed_source_" tag="fixed_source" type="run_parameters_xml" />
<variable name="no_reduce_" tag="no_reduce" type="word" length="3" />
<variable name="no_reduce_" tag="no_reduce" type="word" length="5" />
<variable name="output_" tag="output" type="word-array" length="20" />
<variable name="ptables_" tag="ptables" type="word" length="3" />
<variable name="run_cmfd_" tag="run_cmfd" type="logical" default=".false." />
<variable name="ptables_" tag="ptables" type="word" length="5" />
<variable name="run_cmfd_" tag="run_cmfd" type="word" length="5" />
<variable name="seed_" tag="seed" type="integer" />
<variable name="source_" tag="source" type="source_xml" />
<variable name="state_point_" tag="state_point" type="statepoint_xml" dimension="1" />
<variable name="survival_" tag="survival_biasing" type="word" length="3" />
<variable name="survival_" tag="survival_biasing" type="word" length="5" />
<variable name="trace_" tag="trace" type="integer-array" />
<variable name="uniform_fs_" tag="uniform_fs" type="mesh_xml" dimension="1" />
<variable name="verbosity_" tag="verbosity" type="integer" />

View file

@ -102,6 +102,9 @@ class StatePoint(BinaryFile):
# Read date and time
self.date_and_time = self._get_string(19)[0]
# Read path
self.path = self._get_string(255)[0].strip()
# Read random number seed
self.seed = self._get_long()[0]
@ -127,9 +130,8 @@ class StatePoint(BinaryFile):
m = Mesh()
self.meshes.append(m)
# Read type of mesh and number of dimensions
m.type = self._get_int()[0]
n = self._get_int()[0]
# Read id, mesh type, and number of dimensions
m.id, m.type, n = self._get_int(3)
# Read mesh size, lower-left coordinates, upper-right coordinates,
# and width of each mesh cell
@ -146,8 +148,8 @@ class StatePoint(BinaryFile):
t = Tally()
self.tallies.append(t)
# Read number of realizations
t.n_realizations = self._get_int()[0]
# Read id and number of realizations
t.id, t.n_realizations = self._get_int(2)
# Read sizes of tallies
t.total_score_bins = self._get_int()[0]