From 71b49aace8107fc618cccbcc757c358086181814 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 20 Feb 2017 09:03:50 -0600 Subject: [PATCH] Rewrite documentation for summary and statepoint files. Continue making a few changes. --- docs/source/io_formats/statepoint.rst | 532 +++++++++----------------- docs/source/io_formats/summary.rst | 384 +++++++------------ openmc/statepoint.py | 100 ++--- openmc/summary.py | 57 +-- src/state_point.F90 | 50 +-- src/summary.F90 | 45 +-- 6 files changed, 380 insertions(+), 788 deletions(-) diff --git a/docs/source/io_formats/statepoint.rst b/docs/source/io_formats/statepoint.rst index a93e2f26d1..63ca703003 100644 --- a/docs/source/io_formats/statepoint.rst +++ b/docs/source/io_formats/statepoint.rst @@ -4,358 +4,180 @@ State Point File Format ======================= -The current revision of the statepoint file format is 15. - -**/filetype** (*char[]*) - - String indicating the type of file. - -**/revision** (*int*) - - Revision of the state point file format. Any time a change is made in the - format, this integer is incremented. - -**/version_major** (*int*) - - Major version number for OpenMC - -**/version_minor** (*int*) - - Minor version number for OpenMC - -**/version_release** (*int*) - - Release version number for OpenMC - -**/git_sha1** (*char[40]*) - - Git commit SHA-1 hash - -**/date_and_time** (*char[]*) - - Date and time the state point was written. - -**/path** (*char[]*) - - Absolute path to directory containing input files. - -**/seed** (*int8_t*) - - Pseudo-random number generator seed. - -**/run_CE** (*int*) - - Flag to denote continuous-energy or multi-group mode. A value of 1 - indicates a continuous-energy run while a value of 0 indicates a - multi-group run. - -**/run_mode** (*char[]*) - - Run mode used. A value of 1 indicates a fixed-source run and a value of 2 - indicates an eigenvalue run. - -**/n_particles** (*int8_t*) - - Number of particles used per generation. - -**/n_batches** (*int*) - - Number of batches to simulate. - -**/current_batch** (*int*) - - The number of batches already simulated. - -if run_mode == 'k-eigenvalue': - - **/n_inactive** (*int*) - - Number of inactive batches. - - **/gen_per_batch** (*int*) - - Number of generations per batch. - - **/k_generation** (*double[]*) - - k-effective for each generation simulated. - - **/entropy** (*double[]*) - - Shannon entropy for each generation simulated - - **/k_col_abs** (*double*) - - Sum of product of collision/absorption estimates of k-effective - - **/k_col_tra** (*double*) - - Sum of product of collision/track-length estimates of k-effective - - **/k_abs_tra** (*double*) - - Sum of product of absorption/track-length estimates of k-effective - - **/k_combined** (*double[2]*) - - Mean and standard deviation of a combined estimate of k-effective - - **/cmfd_on** (*int*) - - Flag indicating whether CMFD is on (1) or off (0). - - if (cmfd_on) - - **/cmfd/indices** (*int[4]*) - - Indices for cmfd mesh (i,j,k,g) - - **/cmfd/k_cmfd** (*double[]*) - - CMFD eigenvalues - - **/cmfd/cmfd_src** (*double[][][][]*) - - CMFD fission source - - **/cmfd/cmfd_entropy** (*double[]*) - - CMFD estimate of Shannon entropy - - **/cmfd/cmfd_balance** (*double[]*) - - RMS of the residual neutron balance equation on CMFD mesh - - **/cmfd/cmfd_dominance** (*double[]*) - - CMFD estimate of dominance ratio - - **/cmfd/cmfd_srccmp** (*double[]*) - - RMS comparison of difference between OpenMC and CMFD fission source - -**/tallies/n_meshes** (*int*) - - Number of meshes in tallies.xml file - -**/tally/meshes/ids** (*int[]*) - - Internal unique ID of each mesh. - -**/tally/meshes/keys** (*int[]*) - - User-identified unique ID of each mesh. - -**/tallies/meshes/mesh /type** (*char[]*) - - Type of mesh. - -**/tallies/meshes/mesh /dimension** (*int*) - - Number of mesh cells in each dimension. - -**/tallies/meshes/mesh /lower_left** (*double[]*) - - Coordinates of lower-left corner of mesh. - -**/tallies/meshes/mesh /upper_right** (*double[]*) - - Coordinates of upper-right corner of mesh. - -**/tallies/meshes/mesh /width** (*double[]*) - - Width of each mesh cell in each dimension. - -**/tallies/derivatives/derivative /independent variable** (*char[]*) - - Independent variable of tally derivative - -**/tallies/derivatives/derivative /material** (*int*) - - ID of the perturbed material - -**/tallies/derivatives/derivative /nuclide** (*char[]*) - - Alias of the perturbed nuclide - -**/tallies/n_tallies** (*int*) - - Number of user-defined tallies. - -**/tallies/ids** (*int[]*) - - Internal unique ID of each tally. - -**/tallies/keys** (*int[]*) - - User-identified unique ID of each tally. - -**/tallies/tally /estimator** (*char[]*) - - Type of tally estimator, either 'analog', 'tracklength', or 'collision'. - -**/tallies/tally /n_realizations** (*int*) - - Number of realizations. - -**/tallies/tally /n_filters** (*int*) - - Number of filters used. - -**/tallies/tally /filter /type** (*char[]*) - - Type of the j-th filter. Can be 'universe', 'material', 'cell', 'cellborn', - 'surface', 'mesh', 'energy', 'energyout', 'distribcell', 'mu', 'polar', - 'azimuthal', 'delayedgroup', or 'energyfunction'. - -**/tallies/tally /filter /n_bins** (*int*) - - Number of bins for the j-th filter. Not present for 'energyfunction' - filters. - -**/tallies/tally /filter /bins** (*int[]* or *double[]*) - - Value for each filter bin of this type. Not present for 'energyfunction' - filters. - -**/tallies/tally /filter /energy** (*double[]*) - - Energy grid points for energyfunction interpolation. Only used for - 'energyfunction' filters. - -**/tallies/tally /filter /y** (*double[]*) - - Interpolant values for energyfunction interpolation. Only used for - 'energyfunction' filters. - -**/tallies/tally /nuclides** (*char[][]*) - - Array of nuclides to tally. Note that if no nuclide is specified in the user - input, a single 'total' nuclide appears here. - -**/tallies/tally /derivative** (*int*) - - ID of the derivative applied to the tally. - -**/tallies/tally /n_score_bins** (*int*) - - Number of scoring bins for a single nuclide. In general, this can be greater - than the number of user-specified scores since each score might have - multiple scoring bins, e.g., scatter-PN. - -**/tallies/tally /score_bins** (*char[][]*) - - Values of specified scores. - -**/tallies/tally /n_user_scores** (*int*) - - Number of scores without accounting for those added by expansions, - e.g. scatter-PN. - -**/tallies/tally /moment_orders** (*char[][]*) - - Tallying moment orders for Legendre and spherical harmonic tally expansions - (*e.g.*, 'P2', 'Y1,2', etc.). - -**/tallies/tally /results** (*double[][][2]*) - - Accumulated sum and sum-of-squares for each bin of the i-th tally. The first - dimension represents combinations of filter bins, the second dimensions - represents scoring bins, and the third dimension has two entries for the sum - and the sum-of-squares. - -**/source_present** (*int*) - - Flag indicated if source bank is present in the file - -**/n_realizations** (*int*) - - Number of realizations for global tallies. - -**/n_global_tallies** (*int*) - - Number of global tally scores. - -**/global_tallies** (Compound type) - - Accumulated sum and sum-of-squares for each global tally. The compound type - has fields named ``sum`` and ``sum_sq``. - -**/tallies_present** (*int*) - - Flag indicated if tallies are present in the file. - -if (run_mode == 'k-eigenvalue' and source_present > 0) - - **/source_bank** (Compound type) - - Source bank information for each particle. The compound type has fields - ``wgt``, ``xyz``, ``uvw``, ``E``, ``g``, and ``delayed_group``, which - represent the weight, position, direction, energy, energy group, and - delayed_group of the source particle, respectively. - -**/runtime/total initialization** (*double*) - - Time (in seconds on the master process) spent reading inputs, allocating - arrays, etc. - -**/runtime/reading cross sections** (*double*) - - Time (in seconds on the master process) spent loading cross section - libraries (this is a subset of initialization). - -**/runtime/simulation** (*double*) - - Time (in seconds on the master process) spent between initialization and - finalization. - -**/runtime/transport** (*double*) - - Time (in seconds on the master process) spent transporting particles. - -**/runtime/inactive batches** (*double*) - - Time (in seconds on the master process) spent in the inactive batches - (including non-transport activities like communcating sites). - -**/runtime/active batches** (*double*) - - Time (in seconds on the master process) spent in the active batches - (including non-transport activities like communicating sites). - -**/runtime/synchronizing fission bank** (*double*) - - Time (in seconds on the master process) spent sampling source particles - from fission sites and communicating them to other processes for load - balancing. - -**/runtime/sampling source sites** (*double*) - - Time (in seconds on the master process) spent sampling source particles - from fission sites. - -**/runtime/SEND-RECV source sites** (*double*) - - Time (in seconds on the master process) spent communicating source sites - between processes for load balancing. - -**/runtime/accumulating tallies** (*double*) - - Time (in seconds on the master process) spent communicating tally results - and evaluating their statistics. - -**/runtime/CMFD** (*double*) - - Time (in seconds on the master process) spent evaluating CMFD. - -**/runtime/CMFD building matrices** (*double*) - - Time (in seconds on the master process) spent buliding CMFD matrices. - -**/runtime/CMFD solving matrices** (*double*) - - Time (in seconds on the master process) spent solving CMFD matrices. - -**/runtime/total** (*double*) - - Total time spent (in seconds on the master process) in the program. +The current revision of the statepoint file format is 16.0. + +**/** + +:Attributes: - **filetype** (*char[]*) -- String indicating the type of file. + - **version** (*int[2]*) -- Major and minor version of the + statepoint file format. + - **openmc_version** (*int[3]*) -- Major, minor, and release + version number for OpenMC. + - **git_sha1** (*char[40]*) -- Git commit SHA-1 hash. + - **date_and_time** (*char[]*) -- Date and time the summary was + written. + - **path** (*char[]*) -- Path to directory containing input files. + - **cmfd_on** (*int*) -- Flag indicating whether CMFD is on (1) or + off (0). + - **tallies_present** (*int*) -- Flag indicating if tallies are + present in the file. + - **source_present** (*int*) -- Flag indicating if source bank is + present in the file. + +:Datasets: - **seed** (*int8_t*) -- Pseudo-random number generator seed. + - **energy_mode** (*char[]*) -- Energy mode of the run, either + 'continuous-energy' or 'multi-group'. + - **run_mode** (*char[]*) -- Run mode used, either 'eigenvalue' or + 'fixed source'. + - **n_particles** (*int8_t*) -- Number of particles used per generation. + - **n_batches** (*int*) -- Number of batches to simulate. + - **current_batch** (*int*) -- The number of batches already simulated. + - **n_inactive** (*int*) -- Number of inactive batches. Only present + when `run_mode` is 'eigenvalue'. + - **gen_per_batch** (*int*) -- Number of generations per batch. Only + present when `run_mode` is 'eigenvalue'. + - **k_generation** (*double[]*) -- k-effective for each generation + simulated. + - **entropy** (*double[]*) -- Shannon entropy for each generation + simulated. + - **k_col_abs** (*double*) -- Sum of product of collision/absorption + estimates of k-effective. + - **k_col_tra** (*double*) -- Sum of product of + collision/track-length estimates of k-effective. + - **k_abs_tra** (*double*) -- Sum of product of + absorption/track-length estimates of k-effective. + - **k_combined** (*double[2]*) -- Mean and standard deviation of a + combined estimate of k-effective. + - **n_realizations** (*int*) -- Number of realizations for global + tallies. + - **global_tallies** (*double[][2]*) -- Accumulated sum and + sum-of-squares for each global tally. + - **source_bank** (Compound type) -- Source bank information for each + particle. The compound type has fields ``wgt``, ``xyz``, ``uvw``, + ``E``, ``g``, and ``delayed_group``, which represent the weight, + position, direction, energy, energy group, and delayed_group of the + source particle, respectively. Only present when `run_mode` is + 'eigenvalue'. + +**/cmfd/** + +:Datasets: - **indices** (*int[4]*) -- Indices for cmfd mesh (i,j,k,g) + - **k_cmfd** (*double[]*) -- CMFD eigenvalues + - **cmfd_src** (*double[][][][]*) -- CMFD fission source + - **cmfd_entropy** (*double[]*) -- CMFD estimate of Shannon entropy + - **cmfd_balance** (*double[]*) -- RMS of the residual neutron + balance equation on CMFD mesh + - **cmfd_dominance** (*double[]*) -- CMFD estimate of dominance ratio + - **cmfd_srccmp** (*double[]*) -- RMS comparison of difference + between OpenMC and CMFD fission source + +**/tallies/** + +:Attributes: - **n_tallies** (*int*) -- Number of user-defined tallies. + +:Datasets: - **ids** (*int[]*) -- Internal unique ID of each tally. + - **keys** (*int[]*) -- User-defined unique ID of each tally. + +**/tallies/meshes/** + +:Attributes: - **n_meshes** (*int*) -- Number of meshes in the problem. + +:Datasets: - **ids** (*int[]*) -- Internal unique ID of each mesh. + - **keys** (*int[]*) -- User-identified unique ID of each mesh. + +**/tallies/meshes/mesh /** + +:Datasets: - **type** (*char[]*) -- Type of mesh. + - **dimension** (*int*) -- Number of mesh cells in each dimension. + - **lower_left** (*double[]*) -- Coordinates of lower-left corner of + mesh. + - **upper_right** (*double[]*) -- Coordinates of upper-right corner + of mesh. + - **width** (*double[]*) -- Width of each mesh cell in each + dimension. + +**/tallies/derivatives/derivative /** + +:Datasets: - **independent variable** (*char[]*) -- Independent variable of + tally derivative. + - **material** (*int*) -- ID of the perturbed material. + - **nuclide** (*char[]*) -- Alias of the perturbed nuclide. + - **estimator** (*char[]*) -- Type of tally estimator, either + 'analog', 'tracklength', or 'collision'. + +**/tallies/tally /** + +:Datasets: - **n_realizations** (*int*) -- Number of realizations. + - **n_filters** (*int*) -- Number of filters used. + - **nuclides** (*char[][]*) -- Array of nuclides to tally. Note that + if no nuclide is specified in the user input, a single 'total' + nuclide appears here. + - **derivative** (*int*) -- ID of the derivative applied to the + tally. + - **n_score_bins** (*int*) -- Number of scoring bins for a single + nuclide. In general, this can be greater than the number of + user-specified scores since each score might have multiple scoring + bins, e.g., scatter-PN. + - **score_bins** (*char[][]*) -- Values of specified scores. + - **n_user_scores** (*int*) -- Number of scores without accounting + for those added by expansions, e.g. scatter-PN. + - **moment_orders** (*char[][]*) -- Tallying moment orders for + Legendre and spherical harmonic tally expansions (e.g., 'P2', + 'Y1,2', etc.). + - **results** (*double[][][2]*) -- Accumulated sum and sum-of-squares + for each bin of the i-th tally. The first dimension represents + combinations of filter bins, the second dimensions represents + scoring bins, and the third dimension has two entries for the sum + and the sum-of-squares. + +**/tallies/tally /filter /** + +:Datasets: - **type** (*char[]*) -- Type of the j-th filter. Can be 'universe', + 'material', 'cell', 'cellborn', 'surface', 'mesh', 'energy', + 'energyout', 'distribcell', 'mu', 'polar', 'azimuthal', + 'delayedgroup', or 'energyfunction'. + - **n_bins** (*int*) -- Number of bins for the j-th filter. Not + present for 'energyfunction' filters. + - **bins** (*int[]* or *double[]*) -- Value for each filter bin of + this type. Not present for 'energyfunction' filters. + - **energy** (*double[]*) -- Energy grid points for energyfunction + interpolation. Only used for 'energyfunction' filters. + - **y** (*double[]*) -- Interpolant values for energyfunction + interpolation. Only used for 'energyfunction' filters. + +**/runtime/** + +:Datasets: - **total initialization** (*double*) -- Time (in seconds on the + master process) spent reading inputs, allocating arrays, etc. + - **reading cross sections** (*double*) -- Time (in seconds on the + master process) spent loading cross section libraries (this is a + subset of initialization). + - **simulation** (*double*) -- Time (in seconds on the master + process) spent between initialization and finalization. + - **transport** (*double*) -- Time (in seconds on the master process) + spent transporting particles. + - **inactive batches** (*double*) -- Time (in seconds on the master + process) spent in the inactive batches (including non-transport + activities like communcating sites). + - **active batches** (*double*) -- Time (in seconds on the master + process) spent in the active batches (including non-transport + activities like communicating sites). + - **synchronizing fission bank** (*double*) -- Time (in seconds on + the master process) spent sampling source particles from fission + sites and communicating them to other processes for load balancing. + - **sampling source sites** (*double*) -- Time (in seconds on the + master process) spent sampling source particles from fission sites. + - **SEND-RECV source sites** (*double*) -- Time (in seconds on the + master process) spent communicating source sites between processes + for load balancing. + - **accumulating tallies** (*double*) -- Time (in seconds on the + master process) spent communicating tally results and evaluating + their statistics. + - **CMFD** (*double*) -- Time (in seconds on the master process) + spent evaluating CMFD. + - **CMFD building matrices** (*double*) -- Time (in seconds on the + master process) spent buliding CMFD matrices. + - **CMFD solving matrices** (*double*) -- Time (in seconds on the + master process) spent solving CMFD matrices. + - **total** (*double*) -- Total time spent (in seconds on the master + process) in the program. diff --git a/docs/source/io_formats/summary.rst b/docs/source/io_formats/summary.rst index 3084c27383..28aca93498 100644 --- a/docs/source/io_formats/summary.rst +++ b/docs/source/io_formats/summary.rst @@ -4,259 +4,131 @@ Summary File Format =================== -The current revision of the summary file format is 4. - -**/filetype** (*char[]*) - - String indicating the type of file. - -**/revision** (*int*) - - Revision of the summary file format. Any time a change is made in the - format, this integer is incremented. - -**/version_major** (*int*) - - Major version number for OpenMC - -**/version_minor** (*int*) - - Minor version number for OpenMC - -**/version_release** (*int*) - - Release version number for OpenMC - -**/git_sha1** (*char[40]*) - - Git commit SHA-1 hash - -**/date_and_time** (*char[]*) - - Date and time the summary was written. - -**/n_procs** (*int*) - - Number of MPI processes used. - -**/n_particles** (*int8_t*) - - Number of particles used per generation. - -**/n_batches** (*int*) - - Number of batches to simulate. - -**/n_inactive** (*int*) - - Number of inactive batches. Only present if /run_mode is set to - 'k-eigenvalue'. - -**/n_active** (*int*) - - Number of active batches. Only present if /run_mode is set to - 'k-eigenvalue'. - -**/gen_per_batch** (*int*) - - Number of generations per batch. Only present if /run_mode is set to - 'k-eigenvalue'. - -**/geometry/n_cells** (*int*) - - Number of cells in the problem. - -**/geometry/n_surfaces** (*int*) - - Number of surfaces in the problem. - -**/geometry/n_universes** (*int*) - - Number of unique universes in the problem. - -**/geometry/n_lattices** (*int*) - - Number of lattices in the problem. - -**/geometry/cells/cell /index** (*int*) - - Index in cells array used internally in OpenMC. - -**/geometry/cells/cell /name** (*char[]*) - - Name of the cell. - -**/geometry/cells/cell /universe** (*int*) - - Universe assigned to the cell. If none is specified, the default - universe (0) is assigned. - -**/geometry/cells/cell /fill_type** (*char[]*) - - Type of fill for the cell. Can be 'normal', 'universe', or 'lattice'. - -**/geometry/cells/cell /material** (*int* or *int[]*) - - Unique ID of the material(s) assigned to the cell. This dataset is present - only if fill_type is set to 'normal'. The value '-1' signifies void - material. The data is an array if the cell uses distributed materials, - otherwise it is a scalar. - -**/geometry/cells/cell /temperature** (*double[]*) - - Temperature of the cell in Kelvin. - -**/geometry/cells/cell /offset** (*int[]*) - - Offsets used for distribcell tally filter. This dataset is present only if - fill_type is set to 'universe'. - -**/geometry/cells/cell /translation** (*double[3]*) - - Translation applied to the fill universe. This dataset is present only if - fill_type is set to 'universe'. - -**/geometry/cells/cell /rotation** (*double[3]*) - - Angles in degrees about the x-, y-, and z-axes for which the fill universe - should be rotated. This dataset is present only if fill_type is set to - 'universe'. - -**/geometry/cells/cell /lattice** (*int*) - - Unique ID of the lattice which fills the cell. Only present if fill_type is - set to 'lattice'. - -**/geometry/cells/cell /region** (*char[]*) - - Region specification for the cell. - -**/geometry/cells/cell /distribcell_index** (*int*) - - Index of this cell in distribcell arrays. Only present if this cell is - listed in a distribcell filter or if it uses distributed materials. - -**/geometry/cells/cell /paths** (*char[][]*) - - The paths traversed through the CSG tree to reach each distribcell - instance. This consists of the integer IDs for each universe, cell and - lattice delimited by '->'. Each lattice cell is specified by its (x,y) or - (x,y,z) indices. Only present if this cell is listed in a distribcell filter - or if it uses distributed materials. - -**/geometry/surfaces/surface /index** (*int*) - - Index in surfaces array used internally in OpenMC. - -**/geometry/surfaces/surface /name** (*char[]*) - - Name of the surface. - -**/geometry/surfaces/surface /type** (*char[]*) - - Type of the surface. Can be 'x-plane', 'y-plane', 'z-plane', 'plane', - 'x-cylinder', 'y-cylinder', 'sphere', 'x-cone', 'y-cone', 'z-cone', or - 'quadric'. - -**/geometry/surfaces/surface /coefficients** (*double[]*) - - Array of coefficients that define the surface. See :ref:`surface_element` - for what coefficients are defined for each surface type. - -**/geometry/surfaces/surface /boundary_condition** (*char[]*) - - Boundary condition applied to the surface. Can be 'transmission', 'vacuum', - 'reflective', or 'periodic'. - -**/geometry/universes/universe /index** (*int*) - - Index in the universes array used internally in OpenMC. - -**/geometry/universes/universe /cells** (*int[]*) - - Array of unique IDs of cells that appear in the universe. - -**/geometry/lattices/lattice /index** (*int*) - - Index in the lattices array used internally in OpenMC. - -**/geometry/lattices/lattice /name** (*char[]*) - - Name of the lattice. - -**/geometry/lattices/lattice /type** (*char[]*) - - Type of the lattice, either 'rectangular' or 'hexagonal'. - -**/geometry/lattices/lattice /pitch** (*double[]*) - - Pitch of the lattice. - -**/geometry/lattices/lattice /outer** (*int*) - - Outer universe assigned to lattice cells outside the defined range. - -**/geometry/lattices/lattice /offsets** (*int[]*) - - Offsets used for distribcell tally filter. - -**/geometry/lattices/lattice /universes** (*int[]*) - - Three-dimensional array of universes assigned to each cell of the lattice. - -**/geometry/lattices/lattice /dimension** (*int[]*) - - The number of lattice cells in each direction. This dataset is present only - when the 'type' dataset is set to 'rectangular'. - -**/geometry/lattices/lattice /lower_left** (*double[]*) - - The coordinates of the lower-left corner of the lattice. This dataset is - present only when the 'type' dataset is set to 'rectangular'. - -**/geometry/lattices/lattice /n_rings** (*int*) - - Number of radial ring positions in the xy-plane. This dataset is present - only when the 'type' dataset is set to 'hexagonal'. - -**/geometry/lattices/lattice /n_axial** (*int*) - - Number of lattice positions along the z-axis. This dataset is present only - when the 'type' dataset is set to 'hexagonal'. - -**/geometry/lattices/lattice /center** (*double[]*) - - Coordinates of the center of the lattice. This dataset is present only when - the 'type' dataset is set to 'hexagonal'. - -**/n_materials** (*int*) - - Number of materials in the problem. - -**/materials/material /index** (*int*) - - Index in materials array used internally in OpenMC. - -**/materials/material /name** (*char[]*) - - Name of the material. - -**/materials/material /atom_density** (*double[]*) - - Total atom density of the material in atom/b-cm. - -**/materials/material /nuclides** (*char[][]*) - - Array of nuclides present in the material, e.g., 'U-235.71c'. - -**/materials/material /nuclide_densities** (*double[]*) - - Atom density of each nuclide. - -**/materials/material /sab_names** (*char[][]*) - - Names of S(:math:`\alpha`,:math:`\beta`) tables assigned to the material. - -**/tallies/tally /name** (*char[]*) - - Name of the tally. +The current version of the summary file format is 5.0. + +**/** + +:Attributes: - **filetype** (*char[]*) -- String indicating the type of file. + - **version** (*int[2]*) -- Major and minor version of the summary + file format. + - **openmc_version** (*int[3]*) -- Major, minor, and release + version number for OpenMC. + - **git_sha1** (*char[40]*) -- Git commit SHA-1 hash. + - **date_and_time** (*char[]*) -- Date and time the summary was + written. + +**/geometry/** + +:Attributes: - **n_cells** (*int*) -- Number of cells in the problem. + - **n_surfaces** (*int*) -- Number of surfaces in the problem. + - **n_universes** (*int*) -- Number of unique universes in the + problem. + - **n_lattices** (*int*) -- Number of lattices in the problem. + +**/geometry/cells/cell /** + +:Datasets: - **name** (*char[]*) -- Name of the cell. + - **universe** (*int*) -- Universe assigned to the cell. If none is + specified, the default universe (0) is assigned. + - **fill_type** (*char[]*) -- Type of fill for the cell. Can be + 'normal', 'universe', or 'lattice'. + - **material** (*int* or *int[]*) -- Unique ID of the material(s) + assigned to the cell. This dataset is present only if fill_type is + set to 'normal'. The value '-1' signifies void material. The data + is an array if the cell uses distributed materials, otherwise it is + a scalar. + - **temperature** (*double[]*) -- Temperature of the cell in Kelvin. + - **offset** (*int[]*) -- Offsets used for distribcell tally + filter. This dataset is present only if fill_type is set to + 'universe'. + - **translation** (*double[3]*) -- Translation applied to the fill + universe. This dataset is present only if fill_type is set to + 'universe'. + - **rotation** (*double[3]*) -- Angles in degrees about the x-, y-, + and z-axes for which the fill universe should be rotated. This + dataset is present only if fill_type is set to 'universe'. + - **lattice** (*int*) -- Unique ID of the lattice which fills the + cell. Only present if fill_type is set to 'lattice'. + - **region** (*char[]*) -- Region specification for the cell. + - **distribcell_index** (*int*) -- Index of this cell in distribcell + arrays. Only present if this cell is listed in a distribcell filter + or if it uses distributed materials. + - **paths** (*char[][]*) -- The paths traversed through the CSG tree + to reach each distribcell instance. This consists of the integer + IDs for each universe, cell and lattice delimited by '->'. Each + lattice cell is specified by its (x,y) or (x,y,z) indices. Only + present if this cell is listed in a distribcell filter or if it + uses distributed materials. + +**/geometry/surfaces/surface /** + +:Datasets: - **name** (*char[]*) -- Name of the surface. + - **type** (*char[]*) -- Type of the surface. Can be 'x-plane', + 'y-plane', 'z-plane', 'plane', 'x-cylinder', 'y-cylinder', + 'z-cylinder', 'sphere', 'x-cone', 'y-cone', 'z-cone', or 'quadric'. + - **coefficients** (*double[]*) -- Array of coefficients that define + the surface. See :ref:`surface_element` for what coefficients are + defined for each surface type. + - **boundary_condition** (*char[]*) -- Boundary condition applied to + the surface. Can be 'transmission', 'vacuum', 'reflective', or + 'periodic'. + +**/geometry/universes/universe /** + +:Datasets: + - **cells** (*int[]*) -- Array of unique IDs of cells that appear in + the universe. + +**/geometry/lattices/lattice /** + +:Datasets: - **name** (*char[]*) -- Name of the lattice. + - **type** (*char[]*) -- Type of the lattice, either 'rectangular' or + 'hexagonal'. + - **pitch** (*double[]*) -- Pitch of the lattice in centimeters. + - **outer** (*int*) -- Outer universe assigned to lattice cells + outside the defined range. + - **offsets** (*int[]*) -- Offsets used for distribcell tally filter. + - **universes** (*int[][][]*) -- Three-dimensional array of universes + assigned to each cell of the lattice. + - **dimension** (*int[]*) -- The number of lattice cells in each + direction. This dataset is present only when the 'type' dataset is + set to 'rectangular'. + - **lower_left** (*double[]*) -- The coordinates of the lower-left + corner of the lattice. This dataset is present only when the 'type' + dataset is set to 'rectangular'. + - **n_rings** (*int*) -- Number of radial ring positions in the + xy-plane. This dataset is present only when the 'type' dataset is + set to 'hexagonal'. + - **n_axial** (*int*) -- Number of lattice positions along the + z-axis. This dataset is present only when the 'type' dataset is set + to 'hexagonal'. + - **center** (*double[]*) -- Coordinates of the center of the + lattice. This dataset is present only when the 'type' dataset is + set to 'hexagonal'. + +**/materials/** + +:Attributes: - **n_materials** (*int*) -- Number of materials in the problem. + + +**/materials/material /** + +:Datasets: - **name** (*char[]*) -- Name of the material. + - **atom_density** (*double[]*) -- Total atom density of the material + in atom/b-cm. + - **nuclides** (*char[][]*) -- Array of nuclides present in the + material, e.g., 'U235'. + - **nuclide_densities** (*double[]*) -- Atom density of each nuclide. + - **sab_names** (*char[][]*) -- Names of + S(:math:`\alpha`,:math:`\beta`) tables assigned to the material. + +**/nuclides/** + +:Attributes: - **n_nuclides** (*int*) -- Number of nuclides in the problem. + +:Datasets: - **names** (*char[][]*) -- Names of nuclides. + - **awrs** (*float[]*) -- Atomic weight ratio of each nuclide. + +**/tallies/tally /** + +:Datasets: - **name** (*char[]*) -- Name of the tally. diff --git a/openmc/statepoint.py b/openmc/statepoint.py index b8257f5197..c3436ceb57 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -138,7 +138,7 @@ class StatePoint(object): @property def cmfd_on(self): - return self._f['cmfd_on'].value > 0 + return self._f.attrs['cmfd_on'] > 0 @property def cmfd_balance(self): @@ -262,7 +262,7 @@ class StatePoint(object): self._meshes = {} # Read the number of Meshes - n_meshes = self._f['tallies/meshes/n_meshes'].value + n_meshes = self._f['tallies/meshes'].attrs['n_meshes'] # Read a list of the IDs for each Mesh if n_meshes > 0: @@ -271,28 +271,17 @@ class StatePoint(object): else: mesh_keys = [] - # Build dictionary of Meshes - base = 'tallies/meshes/mesh ' - # Iterate over all Meshes for mesh_key in mesh_keys: - # Read the mesh type - mesh_type = self._f['{0}{1}/type'.format(base, mesh_key)].value.decode() + group = self._f['tallies/meshes/mesh {}'.format(mesh_key)] - # Read the mesh dimensions, lower-left coordinates, - # upper-right coordinates, and width of each mesh cell - dimension = self._f['{0}{1}/dimension'.format(base, mesh_key)].value - lower_left = self._f['{0}{1}/lower_left'.format(base, mesh_key)].value - upper_right = self._f['{0}{1}/upper_right'.format(base, mesh_key)].value - width = self._f['{0}{1}/width'.format(base, mesh_key)].value - - # Create the Mesh and assign properties to it + # Read and assign mesh properties mesh = openmc.Mesh(mesh_key) - mesh.dimension = dimension - mesh.width = width - mesh.lower_left = lower_left - mesh.upper_right = upper_right - mesh.type = mesh_type + mesh.type = group['type'].value.decode() + mesh.dimension = group['dimension'].value + mesh.lower_left = group['lower_left'].value + mesh.upper_right = group['upper_right'].value + mesh.width = group['width'].value # Add mesh to the global dictionary of all Meshes self._meshes[mesh_key] = mesh @@ -343,7 +332,7 @@ class StatePoint(object): @property def source_present(self): - return self._f['source_present'].value > 0 + return self._f.attrs['source_present'] > 0 @property def sparse(self): @@ -356,7 +345,7 @@ class StatePoint(object): self._tallies = {} # Read the number of tallies - n_tallies = self._f['tallies/n_tallies'].value + n_tallies = self._f['tallies'].attrs['n_tallies'] # Read a list of the IDs for each Tally if n_tallies > 0: @@ -365,54 +354,44 @@ class StatePoint(object): else: tally_keys = [] - base = 'tallies/tally ' - # Iterate over all Tallies for tally_key in tally_keys: + group = self._f['tallies/tally {}'.format(tally_key)] + # Read the Tally size specifications - n_realizations = \ - self._f['{0}{1}/n_realizations'.format(base, tally_key)].value + n_realizations = group['n_realizations'].value # Create Tally object and assign basic properties tally = openmc.Tally(tally_id=tally_key) tally._sp_filename = self._f.filename - tally.estimator = self._f['{0}{1}/estimator'.format( - base, tally_key)].value.decode() + tally.name = group['name'].value.decode() + tally.estimator = group['estimator'].value.decode() tally.num_realizations = n_realizations # Read derivative information. - if 'derivative' in self._f['{0}{1}'.format(base, tally_key)]: - deriv_id = self._f['{0}{1}/derivative'.format( - base, tally_key)].value + if 'derivative' in group: + deriv_id = group['derivative'].value tally.derivative = self.tally_derivatives[deriv_id] - # Read the number of Filters - n_filters = \ - self._f['{0}{1}/n_filters'.format(base, tally_key)].value - - subbase = '{0}{1}/filter '.format(base, tally_key) - # Read all filters - for j in range(1, n_filters+1): - subsubbase = '{0}{1}'.format(subbase, j) - new_filter = openmc.Filter.from_hdf5(self._f[subsubbase], + n_filters = group['n_filters'].value + for j in range(1, n_filters + 1): + filter_group = group['filter {}'.format(j)] + new_filter = openmc.Filter.from_hdf5(filter_group, meshes=self.meshes) tally.filters.append(new_filter) - # Read Nuclide bins - nuclide_names = \ - self._f['{0}{1}/nuclides'.format(base, tally_key)].value + # Read nuclide bins + nuclide_names = group['nuclides'].value - # Add all Nuclides to the Tally + # Add all nuclides to the Tally for name in nuclide_names: nuclide = openmc.Nuclide(name.decode().strip()) tally.nuclides.append(nuclide) - scores = self._f['{0}{1}/score_bins'.format( - base, tally_key)].value - n_score_bins = self._f['{0}{1}/n_score_bins' - .format(base, tally_key)].value + scores = group['score_bins'].value + n_score_bins = group['n_score_bins'].value # Compute and set the filter strides for i in range(n_filters): @@ -423,8 +402,7 @@ class StatePoint(object): tally_filter.stride *= tally.filters[j].num_bins # Read scattering moment order strings (e.g., P3, Y1,2, etc.) - moments = self._f['{0}{1}/moment_orders'.format( - base, tally_key)].value + moments = group['moment_orders'].value # Add the scores to the Tally for j, score in enumerate(scores): @@ -446,7 +424,7 @@ class StatePoint(object): @property def tallies_present(self): - return self._f['tallies/tallies_present'].value + return self._f.attrs['tallies_present'] > 0 @property def tally_derivatives(self): @@ -464,21 +442,20 @@ class StatePoint(object): # Create each derivative object and add it to the dictionary. for d_id in deriv_ids: - base = 'tallies/derivatives/derivative {:d}'.format(d_id) + group = self._f['tallies/derivatives/derivative {}' + .format(d_id)] deriv = openmc.TallyDerivative(derivative_id=d_id) - deriv.variable = \ - self._f[base + '/independent variable'].value.decode() + deriv.variable = group['independent variable'].value.decode() if deriv.variable == 'density': - deriv.material = self._f[base + '/material'].value + deriv.material = group['material'].value elif deriv.variable == 'nuclide_density': - deriv.material = self._f[base + '/material'].value - deriv.nuclide = \ - self._f[base + '/nuclide'].value.decode() + deriv.material = group['material'].value + deriv.nuclide = group['nuclide'].value.decode() elif deriv.variable == 'temperature': - deriv.material = self._f[base + '/material'].value + deriv.material = group['material'].value else: - raise RuntimeError('Unrecognized tally differential ' - 'variable') + raise ValueError('Unrecognized tally differential ' + 'variable') self._derivs[d_id] = deriv self._derivs_read = True @@ -697,7 +674,6 @@ class StatePoint(object): cell_dict = {c.id: c for c in summary.geometry.get_all_cells()} for tally_id, tally in self.tallies.items(): - tally.name = summary.tally_names[tally_id] tally.with_summary = True for tally_filter in tally.filters: diff --git a/openmc/summary.py b/openmc/summary.py index 6563d4f27f..e11b05d456 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -25,8 +25,6 @@ class Summary(object): nuclides : dict Dictionary whose keys are nuclide names and values are atomic weight ratios. - tally_names : dict - Dictionary whose keys are tally IDs and values are tally names. version: tuple of int Version of OpenMC @@ -44,10 +42,10 @@ class Summary(object): self._geometry = openmc.Geometry() self._materials = openmc.Materials() + self._nuclides = {} self._read_nuclides() self._read_geometry() - self._read_tallies() @property def date_and_time(self): @@ -61,18 +59,19 @@ class Summary(object): def materials(self): return self._materials + @property + def nuclides(self): + return self._nuclides + @property def version(self): return tuple(self._f.attrs['openmc_version']) def _read_nuclides(self): - self.nuclides = {} - n_nuclides = self._f['nuclides/n_nuclides_total'].value names = self._f['nuclides/names'].value awrs = self._f['nuclides/awrs'].value - for n in range(n_nuclides): - name = names[n].decode() - self.nuclides[name] = awrs[n] + for name, awr in zip(names, awrs): + self._nuclides[name.decode()] = awr def _read_geometry(self): # Read in and initialize the Materials and Geometry @@ -84,12 +83,7 @@ class Summary(object): self._finalize_geometry(cells, cell_fills, universes, lattices) def _read_materials(self): - self.n_materials = self._f['n_materials'].value - for key, group in self._f['materials'].items(): - if key == 'n_materials': - continue - material_id = int(key.lstrip('material ')) name = group['name'].value.decode() @@ -129,9 +123,6 @@ class Summary(object): surfaces = {} for key, group in self._f['geometry/surfaces'].items(): - if key == 'n_surfaces': - continue - surface_id = int(key.lstrip('surface ')) name = group['name'].value.decode() surf_type = group['type'].value.decode() @@ -213,9 +204,6 @@ class Summary(object): cell_fills = {} for key, group in self._f['geometry/cells'].items(): - if key == 'n_cells': - continue - cell_id = int(key.lstrip('cell ')) name = group['name'].value.decode() fill_type = group['fill_type'].value.decode() @@ -280,9 +268,6 @@ class Summary(object): universes = {} for key in self._f['geometry/universes'].keys(): - if key == 'n_universes': - continue - universe_id = int(key.lstrip('universe ')) cell_ids = self._f['geometry/universes'][key]['cells'][...] @@ -305,9 +290,6 @@ class Summary(object): lattices = {} for key, group in self._f['geometry/lattices'].items(): - if key == 'n_lattices': - continue - lattice_id = int(key.lstrip('lattice ')) name = group['name'].value.decode() lattice_type = group['type'].value.decode() @@ -471,31 +453,6 @@ class Summary(object): # Set the root universe for the Geometry self.geometry.root_universe = universes[0] - def _read_tallies(self): - # Initialize a dictionary for the tally names - # Keys - Tally IDs - # Values - Tally names - self.tally_names = {} - - # Read the number of tallies - if 'tallies' not in self._f: - return - - # OpenMC Tally keys - all_keys = self._f['tallies/'].keys() - tally_keys = [key for key in all_keys if 'tally' in key] - - base = 'tallies/tally ' - - # Iterate over all Tallies - for tally_key in tally_keys: - tally_id = int(tally_key.strip('tally ')) - subbase = '{0}{1}'.format(base, tally_id) - - # Read Tally name metadata - tally_name = self._f['{0}/name'.format(subbase)].value.decode() - self.tally_names[tally_id] = tally_name - def add_volume_information(self, volume_calc): """Add volume information to the geometry within the summary file diff --git a/src/state_point.F90 b/src/state_point.F90 index cb4ae5157a..ee7c7bf528 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -108,9 +108,9 @@ contains ! Indicate whether source bank is stored in statepoint if (source_separate) then - call write_dataset(file_id, "source_present", 0) + call write_attribute(file_id, "source_present", 0) else - call write_dataset(file_id, "source_present", 1) + call write_attribute(file_id, "source_present", 1) end if ! Write out information for eigenvalue run @@ -126,7 +126,7 @@ contains ! Write out CMFD info if (cmfd_on) then - call write_dataset(file_id, "cmfd_on", 1) + call write_attribute(file_id, "cmfd_on", 1) cmfd_group = create_group(file_id, "cmfd") call write_dataset(cmfd_group, "indices", cmfd % indices) @@ -138,7 +138,7 @@ contains call write_dataset(cmfd_group, "cmfd_srccmp", cmfd % src_cmp) call close_group(cmfd_group) else - call write_dataset(file_id, "cmfd_on", 0) + call write_attribute(file_id, "cmfd_on", 0) end if end if @@ -146,7 +146,7 @@ contains ! Write number of meshes meshes_group = create_group(tallies_group, "meshes") - call write_dataset(meshes_group, "n_meshes", n_meshes) + call write_attribute(meshes_group, "n_meshes", n_meshes) if (n_meshes > 0) then @@ -229,7 +229,7 @@ contains end if ! Write number of tallies - call write_dataset(tallies_group, "n_tallies", n_tallies) + call write_attribute(tallies_group, "n_tallies", n_tallies) if (n_tallies > 0) then @@ -257,6 +257,9 @@ contains tally_group = create_group(tallies_group, "tally " // & trim(to_str(tally % id))) + ! Write the name for this tally + call write_dataset(tally_group, "name", tally % name) + select case(tally % estimator) case (ESTIMATOR_ANALOG) call write_dataset(tally_group, "estimator", "analog") @@ -373,14 +376,14 @@ contains call write_dataset(file_id, "n_realizations", n_realizations) ! Write global tallies - call write_dataset(file_id, "n_global_tallies", N_GLOBAL_TALLIES) call write_dataset(file_id, "global_tallies", global_tallies) ! Write tallies - tallies_group = open_group(file_id, "tallies") if (tallies_on) then ! Indicate that tallies are on - call write_dataset(tallies_group, "tallies_present", 1) + call write_attribute(file_id, "tallies_present", 1) + + tallies_group = open_group(file_id, "tallies") ! Write all tally results TALLY_RESULTS: do i = 1, n_tallies @@ -394,12 +397,12 @@ contains call close_group(tally_group) end do TALLY_RESULTS + call close_group(tallies_group) else ! Indicate tallies are off - call write_dataset(tallies_group, "tallies_present", 0) + call write_attribute(file_id, "tallies_present", 0) end if - call close_group(tallies_group) ! Write out the runtime metrics. runtime_group = create_group(file_id, "runtime") @@ -571,7 +574,7 @@ contains if (tallies_on) then ! Indicate that tallies are on if (master) then - call write_dataset(tallies_group, "tallies_present", 1) + call write_attribute(file_id, "tallies_present", 1) ! Build list of tally IDs current => tally_dict%keys() @@ -649,14 +652,12 @@ contains deallocate(id_array) + if (master) call close_group(tallies_group) else - if (master) then - ! Indicate that tallies are off - call write_dataset(tallies_group, "tallies_present", 0) - end if + ! Indicate that tallies are off + if (master) call write_dataset(file_id, "tallies_present", 0) end if - if (master) call close_group(tallies_group) end subroutine write_tally_results_nr @@ -731,7 +732,7 @@ contains call read_dataset(restart_batch, file_id, "current_batch") ! Check for source in statepoint if needed - call read_dataset(int_array(1), file_id, "source_present") + call read_attribute(int_array(1), file_id, "source_present") if (int_array(1) == 1) then source_present = .true. else @@ -760,7 +761,7 @@ contains n_inactive = max(n_inactive, int_array(1)) ! Read in to see if CMFD was on - call read_dataset(int_array(1), file_id, "cmfd_on") + call read_attribute(int_array(1), file_id, "cmfd_on") ! Read in CMFD info if (int_array(1) == 1) then @@ -801,12 +802,12 @@ contains call read_dataset(global_tallies, file_id, "global_tallies") ! Check if tally results are present - tallies_group = open_group(file_id, "tallies") - call read_dataset(int_array(1), tallies_group, "tallies_present", & - indep=.true.) + call read_attribute(int_array(1), file_id, "tallies_present") ! Read in sum and sum squared if (int_array(1) == 1) then + tallies_group = open_group(file_id, "tallies") + TALLY_RESULTS: do i = 1, n_tallies ! Set pointer to tally tally => tallies(i) @@ -819,12 +820,11 @@ contains "n_realizations") call close_group(tally_group) end do TALLY_RESULTS + + call close_group(tallies_group) end if - - call close_group(tallies_group) end if - ! Read source if in eigenvalue mode if (run_mode == MODE_EIGENVALUE) then diff --git a/src/summary.F90 b/src/summary.F90 index 638d232704..fa5681052f 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -36,15 +36,10 @@ contains ! Create a new file using default properties. file_id = file_create("summary.h5") - ! Write header information call write_header(file_id) - call write_nuclides(file_id) call write_geometry(file_id) call write_materials(file_id) - if (n_tallies > 0) then - call write_tallies(file_id) - end if ! Terminate access to the file. call file_close(file_id) @@ -84,7 +79,7 @@ contains ! Write useful data from nuclide objects nuclide_group = create_group(file_id, "nuclides") - call write_dataset(nuclide_group, "n_nuclides_total", n_nuclides_total) + call write_attribute(nuclide_group, "n_nuclides", n_nuclides_total) ! Build array of nuclide names and awrs allocate(nucnames(n_nuclides_total)) @@ -137,10 +132,10 @@ contains ! Use H5LT interface to write number of geometry objects geom_group = create_group(file_id, "geometry") - call write_dataset(geom_group, "n_cells", n_cells) - call write_dataset(geom_group, "n_surfaces", n_surfaces) - call write_dataset(geom_group, "n_universes", n_universes) - call write_dataset(geom_group, "n_lattices", n_lattices) + call write_attribute(geom_group, "n_cells", n_cells) + call write_attribute(geom_group, "n_surfaces", n_surfaces) + call write_attribute(geom_group, "n_universes", n_universes) + call write_attribute(geom_group, "n_lattices", n_lattices) ! ========================================================================== ! WRITE INFORMATION ON CELLS @@ -542,34 +537,4 @@ contains end subroutine write_materials -!=============================================================================== -! WRITE_TALLIES -!=============================================================================== - - subroutine write_tallies(file_id) - integer(HID_T), intent(in) :: file_id - - integer :: i - integer(HID_T) :: tallies_group - integer(HID_T) :: tally_group - type(TallyObject), pointer :: t - - tallies_group = create_group(file_id, "tallies") - - TALLY_METADATA: do i = 1, n_tallies - ! Get pointer to tally - t => tallies(i) - tally_group = create_group(tallies_group, "tally " & - // trim(to_str(t % id))) - - ! Write the name for this tally - call write_dataset(tally_group, "name", t % name) - - call close_group(tally_group) - end do TALLY_METADATA - - call close_group(tallies_group) - - end subroutine write_tallies - end module summary