mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 20:45:35 -04:00
Merge pull request #834 from nelsonag/mgxslib_version
Added version information to MGXS Library format and files
This commit is contained in:
commit
6cecccec56
8 changed files with 47 additions and 9 deletions
|
|
@ -19,6 +19,8 @@ energy groups, delayed groups, and the energy group structure, etc.) as
|
|||
well as the actual cross section data itself for each of the necessary
|
||||
nuclides or materials.
|
||||
|
||||
The current version of the multi-group library file format is 1.0.
|
||||
|
||||
.. _HDF5: http://www.hdfgroup.org/HDF5/
|
||||
|
||||
.. _mgxs_lib_spec:
|
||||
|
|
@ -29,7 +31,11 @@ MGXS Library Specification
|
|||
|
||||
**/**
|
||||
|
||||
:Attributes: - **energy_groups** (*int*) -- Number of energy groups
|
||||
:Attributes: - **filetype** (*char[]*) -- String indicating the type of file;
|
||||
for this library it will be 'mgxs'.
|
||||
- **version** (*int[2]*) -- Major and minor version of the
|
||||
multi-group library file format.
|
||||
- **energy_groups** (*int*) -- Number of energy groups
|
||||
- **delayed_groups** (*int*) -- Number of delayed groups (optional)
|
||||
- **group structure** (*double[]*) -- Monotonically increasing
|
||||
list of group boundaries, in units of eV. The length of this
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" name="cell 1" region="-1" universe="0" />
|
||||
<cell id="2" material="2" name="cell 2" region="((((1 4) -5) 6) -7)" universe="0" />
|
||||
<cell id="2" material="2" name="cell 2" region="1 4 -5 6 -7" universe="0" />
|
||||
<surface coeffs="0 0 0.54" id="1" name="Fuel OR" type="z-cylinder" />
|
||||
<surface boundary="reflective" coeffs="-0.63" id="4" name="left" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.63" id="5" name="right" type="x-plane" />
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>1000</particles>
|
||||
<batches>100</batches>
|
||||
<inactive>10</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ _XS_SHAPES = ["[G][G'][Order]", "[G]", "[G']", "[G][G']", "[DG]", "[DG][G]",
|
|||
# Number of mu points for conversion between scattering formats
|
||||
_NMU = 257
|
||||
|
||||
# Filetype name of the MGXS Library
|
||||
_FILETYPE_MGXS_LIBRARY = 'mgxs'
|
||||
|
||||
# Current version of the MGXS Library Format
|
||||
_VERSION_MGXS_LIBRARY = 1
|
||||
|
||||
|
||||
class XSdata(object):
|
||||
"""A multi-group cross section data set providing all the
|
||||
|
|
@ -2513,6 +2519,8 @@ class MGXSLibrary(object):
|
|||
|
||||
# Create and write to the HDF5 file
|
||||
file = h5py.File(filename, "w")
|
||||
file.attrs['filetype'] = np.string_(_FILETYPE_MGXS_LIBRARY)
|
||||
file.attrs['version'] = [_VERSION_MGXS_LIBRARY, 0]
|
||||
file.attrs['energy_groups'] = self.energy_groups.num_groups
|
||||
file.attrs['delayed_groups'] = self.num_delayed_groups
|
||||
file.attrs['group structure'] = self.energy_groups.group_edges
|
||||
|
|
@ -2552,6 +2560,10 @@ class MGXSLibrary(object):
|
|||
check_type('filename', filename, str)
|
||||
file = h5py.File(filename, 'r')
|
||||
|
||||
# Check filetype and version
|
||||
cv.check_filetype_version(file, _FILETYPE_MGXS_LIBRARY,
|
||||
_VERSION_MGXS_LIBRARY)
|
||||
|
||||
group_structure = file.attrs['group structure']
|
||||
num_delayed_groups = file.attrs['delayed_groups']
|
||||
energy_groups = openmc.mgxs.EnergyGroups(group_structure)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ module constants
|
|||
integer, parameter :: VERSION_SUMMARY(2) = [5, 0]
|
||||
integer, parameter :: VERSION_VOLUME(2) = [1, 0]
|
||||
integer, parameter :: VERSION_VOXEL(2) = [1, 0]
|
||||
integer, parameter :: VERSION_MGXS_LIBRARY(2) = [1, 0]
|
||||
character(10), parameter :: VERSION_MULTIPOLE = "v0.2"
|
||||
|
||||
! ============================================================================
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ contains
|
|||
logical :: file_exists
|
||||
type(DictCharInt) :: xsdata_dict
|
||||
type(VectorReal), allocatable :: temps(:)
|
||||
character(MAX_WORD_LEN) :: word
|
||||
integer, allocatable :: array(:)
|
||||
|
||||
! Check if MGXS Library exists
|
||||
inquire(FILE=path_cross_sections, EXIST=file_exists)
|
||||
|
|
@ -55,6 +57,20 @@ contains
|
|||
! Open file for reading
|
||||
file_id = file_open(path_cross_sections, 'r', parallel=.true.)
|
||||
|
||||
! Read filetype
|
||||
call read_attribute(word, file_id, "filetype")
|
||||
if (word /= 'mgxs') then
|
||||
call fatal_error("Provided MGXS Library is not a MGXS Library file.")
|
||||
end if
|
||||
|
||||
! Read revision number for the MGXS Library file and make sure it matches
|
||||
! with the current version
|
||||
call read_attribute(array, file_id, "version")
|
||||
if (any(array /= VERSION_MGXS_LIBRARY)) then
|
||||
call fatal_error("MGXS Library file version does not match current &
|
||||
&version supported by OpenMC.")
|
||||
end if
|
||||
|
||||
! allocate arrays for MGXS storage and cross section cache
|
||||
allocate(nuclides_MG(n_nuclides_total))
|
||||
!$omp parallel
|
||||
|
|
|
|||
BIN
tests/1d_mgxs.h5
BIN
tests/1d_mgxs.h5
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue