converted CMFD output writing to new output interface and allowed statepoint python file to read in > 1-D arrays

This commit is contained in:
Bryan Herman 2013-09-09 08:56:47 -04:00
parent b6208998b5
commit d020954a5d
2 changed files with 52 additions and 43 deletions

View file

@ -20,6 +20,10 @@ module state_point
use output_interface
use tally_header, only: TallyObject
#ifdef MPI
use mpi
#endif
implicit none
type(BinaryOutput) :: sp ! statepoint/source output file
@ -91,32 +95,32 @@ contains
call sp % write_data(gen_per_batch, "gen_per_batch")
call sp % write_data(k_generation, "k_generation", &
length=current_batch*gen_per_batch)
call write_data(entropy, "entropy", length=current_batch*gen_per_batch)
call write_data(k_col_abs, "k_col_abs")
call write_data(k_col_tra, "k_col_tra")
call write_data(k_abs_tra, "k_abs_tra")
call write_data(k_combined, "k_combined", length=2)
call sp % write_data(entropy, "entropy", length=current_batch*gen_per_batch)
call sp % write_data(k_col_abs, "k_col_abs")
call sp % write_data(k_col_tra, "k_col_tra")
call sp % write_data(k_abs_tra, "k_abs_tra")
call sp % write_data(k_combined, "k_combined", length=2)
! Write out CMFD info
if (cmfd_on) then
call write_data(1, "cmfd_on")
call write_data(cmfd % indices, "indicies", length=4, group="cmfd")
call write_data(cmfd % k_cmfd, "k_cmfd", length=current_batch, &
call sp % write_data(1, "cmfd_on")
call sp % write_data(cmfd % indices, "indicies", length=4, group="cmfd")
call sp % write_data(cmfd % k_cmfd, "k_cmfd", length=current_batch, &
group="cmfd")
call write_data(cmfd % cmfd_src, "cmfd_src", &
call sp % write_data(cmfd % cmfd_src, "cmfd_src", &
length=(/cmfd % indices(4), cmfd % indices(1), &
cmfd % indices(2), cmfd % indices(3)/), &
group="cmfd")
call write_data(cmfd % entropy, "cmfd_entropy", &
call sp % write_data(cmfd % entropy, "cmfd_entropy", &
length=current_batch, group="cmfd")
call write_data(cmfd % balance, "cmfd_balance", &
call sp % write_data(cmfd % balance, "cmfd_balance", &
length=current_batch, group="cmfd")
call write_data(cmfd % dom, "cmfd_dominance", &
call sp % write_data(cmfd % dom, "cmfd_dominance", &
length = current_batch, group="cmfd")
call write_data(cmfd % src_cmp, "cmfd_srccmp", &
call sp % write_data(cmfd % src_cmp, "cmfd_srccmp", &
length = current_batch, group="cmfd")
else
call write_data(0, "cmfd_on")
call sp % write_data(0, "cmfd_on")
end if
end if
@ -531,27 +535,25 @@ contains
n_inactive = max(n_inactive, int_array(1))
! Read in to see if CMFD was on
call read_data(int_array(1), "cmfd_on", option="collective")
call sp % read_data(int_array(1), "cmfd_on")
! Write out CMFD info
if (int_array(1) == 1) then
call read_data(cmfd % indices, "indicies", length=4, group="cmfd", &
option="collective")
call read_data(cmfd % k_cmfd, "k_cmfd", length=restart_batch, &
group="cmfd", option="collective")
call read_data(cmfd % cmfd_src, "cmfd_src", &
call sp % read_data(cmfd % indices, "indicies", length=4, group="cmfd")
call sp % read_data(cmfd % k_cmfd, "k_cmfd", length=restart_batch, &
group="cmfd")
call sp % read_data(cmfd % cmfd_src, "cmfd_src", &
length=(/cmfd % indices(4), cmfd % indices(1), &
cmfd % indices(2), cmfd % indices(3)/), &
group="cmfd", option="collective")
call read_data(cmfd % entropy, "cmfd_entropy", &
length=restart_batch, group="cmfd", &
option="collective")
call read_data(cmfd % balance, "cmfd_balance", &
length=restart_batch, group="cmfd", option="collective")
call read_data(cmfd % dom, "cmfd_dominance", &
length = restart_batch, group="cmfd", option="collective")
call read_data(cmfd % src_cmp, "cmfd_srccmp", &
length = restart_batch, group="cmfd", option="collective")
group="cmfd")
call sp % read_data(cmfd % entropy, "cmfd_entropy", &
length=restart_batch, group="cmfd")
call sp % read_data(cmfd % balance, "cmfd_balance", &
length=restart_batch, group="cmfd")
call sp % read_data(cmfd % dom, "cmfd_dominance", &
length = restart_batch, group="cmfd")
call sp % read_data(cmfd % src_cmp, "cmfd_srccmp", &
length = restart_batch, group="cmfd")
end if
end if

View file

@ -152,6 +152,8 @@ class StatePoint(object):
# Read statepoint revision
self.revision = self._get_int(path='revision')[0]
if self.revision != 10:
raise Exception('Statepoint Revision is not consistent.')
# Read OpenMC version
if self._hdf5:
@ -186,28 +188,27 @@ class StatePoint(object):
self.current_batch*self.gen_per_batch, path='k_generation')
self.entropy = self._get_double(
self.current_batch*self.gen_per_batch, path='entropy')
if self.revision >= 8:
self.k_col_abs = self._get_double(path='k_col_abs')[0]
self.k_col_tra = self._get_double(path='k_col_tra')[0]
self.k_abs_tra = self._get_double(path='k_abs_tra')[0]
self.k_combined = self._get_double(2, path='k_combined')
self.k_col_abs = self._get_double(path='k_col_abs')[0]
self.k_col_tra = self._get_double(path='k_col_tra')[0]
self.k_abs_tra = self._get_double(path='k_abs_tra')[0]
self.k_combined = self._get_double(2, path='k_combined')
# Read CMFD information
cmfd_present = self._get_int(path='cmfd_on')[0]
if cmfd_present == 1:
self.cmfd_indices = self._get_double(4, path='cmfd/indicies')
self.cmfd_indices = self._get_int(4, path='cmfd/indicies')
self.k_cmfd = self._get_double(self.current_batch,
path='cmfd/k_cmfd')
self.cmfd_src = self._get_double(np.product(self.cmfd_indices,
path='cmfd/cmfd_src'))
path='cmfd/k_cmfd')
self.cmfd_src = self._get_double(np.product(self.cmfd_indices),
path='cmfd/cmfd_src')
self.cmfd_entropy = self._get_double(self.current_batch,
path='cmfd/cmfd_entropy')
path='cmfd/cmfd_entropy')
self.cmfd_balance = self._get_double(self.current_batch,
path='cmfd/cmfd_balance')
path='cmfd/cmfd_balance')
self.cmfd_dominance = self._get_double(self.current_batch,
path='cmfd/cmfd_dominance')
path='cmfd/cmfd_dominance')
self.cmfd_srccmp = self._get_double(self.current_batch,
path='cmfd/cmfd_srccmp')
path='cmfd/cmfd_srccmp')
# Read number of meshes
n_meshes = self._get_int(path='tallies/n_meshes')[0]
@ -597,6 +598,12 @@ class StatePoint(object):
else:
return [float(v) for v in self._get_data(n, 'd', 8)]
def _get_double(self, n=1, path=None):
if self._hdf5:
return self._f[path].value
else:
return self._get_data(n, 'd', 8)
def _get_string(self, n=1, path=None):
if self._hdf5:
return str(self._f[path].value)