mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge remote-tracking branch 'upstream/develop' into multipole
This commit is contained in:
commit
2ea00d23b1
12 changed files with 822 additions and 781 deletions
|
|
@ -171,9 +171,9 @@ attributes/sub-elements required to describe the meta-data:
|
|||
provided via the ``scatt_type`` element above, is represented and thus used
|
||||
during the scattering process. Specifically, the options are to either
|
||||
convert the Legendre expansion to a tabular representation or leave it as
|
||||
a set of Legendre coefficients. Converting to a tabular representation will
|
||||
cost memory but can allow for a decrease in runtime compared to leaving as a
|
||||
set of Legendre coefficients. This element has the following
|
||||
a set of Legendre coefficients. Converting to a tabular representation
|
||||
will cost memory but can allow for a decrease in runtime compared to
|
||||
leaving as a set of Legendre coefficients. This element has the following
|
||||
attributes/sub-elements:
|
||||
|
||||
:enable:
|
||||
|
|
@ -181,7 +181,7 @@ attributes/sub-elements required to describe the meta-data:
|
|||
tabular format should be performed or not. A value of "true" means
|
||||
the conversion should be performed, "false" means it should not.
|
||||
|
||||
*Default*: "false"
|
||||
*Default*: "true"
|
||||
|
||||
:num_points:
|
||||
If the conversion is to take place the number of tabular points is
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -753,7 +753,8 @@ class Library(object):
|
|||
return pickle.load(open(full_filename, 'rb'))
|
||||
|
||||
def get_xsdata(self, domain, xsdata_name, nuclide='total', xs_type='macro',
|
||||
xs_id='1m', order=None):
|
||||
xs_id='1m', order=None, tabular_legendre=None,
|
||||
tabular_points=33):
|
||||
"""Generates an openmc.XSdata object describing a multi-group cross section
|
||||
data set for eventual combination in to an openmc.MGXSLibrary object
|
||||
(i.e., the library).
|
||||
|
|
@ -773,9 +774,22 @@ class Library(object):
|
|||
nuclide this will be set to 'macro' regardless.
|
||||
xs_ids : str
|
||||
Cross section set identifier. Defaults to '1m'.
|
||||
order : Scattering order for this data entry. Default is None,
|
||||
order : int
|
||||
Scattering order for this data entry. Default is None,
|
||||
which will set the XSdata object to use the order of the
|
||||
Library.
|
||||
tabular_legendre : None or bool
|
||||
Flag to denote whether or not the Legendre expansion of the
|
||||
scattering angular distribution is to be converted to a tabular
|
||||
representation by OpenMC. A value of `True` means that it is to be
|
||||
converted while a value of `False` means that it will not be.
|
||||
Defaults to `None` which leaves the default behavior of OpenMC in
|
||||
place (the distribution is converted to a tabular representation).
|
||||
tabular_points : int
|
||||
This parameter is not used unless the ``tabular_legendre``
|
||||
parameter is set to `True`. In this case, this parameter sets the
|
||||
number of equally-spaced points in the domain of [-1,1] to be used
|
||||
in building the tabular distribution. Default is `33`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -804,6 +818,10 @@ class Library(object):
|
|||
if order is not None:
|
||||
cv.check_greater_than('order', order, 0, equality=True)
|
||||
cv.check_less_than('order', order, 10, equality=True)
|
||||
cv.check_type('tabular_legendre', tabular_legendre,
|
||||
(type(None), bool))
|
||||
if tabular_points is not None:
|
||||
cv.check_greater_than('tabular_points', tabular_points, 1)
|
||||
|
||||
# Make sure statepoint has been loaded
|
||||
if self._sp_filename is None:
|
||||
|
|
@ -830,6 +848,11 @@ class Library(object):
|
|||
# the provided order or the Library's order.
|
||||
xsdata.order = min(order, self.legendre_order)
|
||||
|
||||
# Set the tabular_legendre option if needed
|
||||
if tabular_legendre is not None:
|
||||
xsdata.tabular_legendre = {'enable': tabular_legendre,
|
||||
'num_points': tabular_points}
|
||||
|
||||
if nuclide is not 'total':
|
||||
xsdata.zaid = self._nuclides[nuclide][0]
|
||||
xsdata.awr = self._nuclides[nuclide][1]
|
||||
|
|
@ -906,7 +929,8 @@ class Library(object):
|
|||
return xsdata
|
||||
|
||||
def create_mg_library(self, xs_type='macro', xsdata_names=None,
|
||||
xs_ids=None):
|
||||
xs_ids=None, tabular_legendre=None,
|
||||
tabular_points=33):
|
||||
"""Creates an openmc.MGXSLibrary object to contain the MGXS data for the
|
||||
Multi-Group mode of OpenMC.
|
||||
|
||||
|
|
@ -923,6 +947,18 @@ class Library(object):
|
|||
Cross section set identifier (i.e., '71c') for all
|
||||
data sets (if only str) or for each individual one
|
||||
(if iterable of str). Defaults to '1m'.
|
||||
tabular_legendre : None or bool
|
||||
Flag to denote whether or not the Legendre expansion of the
|
||||
scattering angular distribution is to be converted to a tabular
|
||||
representation by OpenMC. A value of `True` means that it is to be
|
||||
converted while a value of `False` means that it will not be.
|
||||
Defaults to `None` which leaves the default behavior of OpenMC in
|
||||
place (the distribution is converted to a tabular representation).
|
||||
tabular_points : int
|
||||
This parameter is not used unless the ``tabular_legendre``
|
||||
parameter is set to `True`. In this case, this parameter sets the
|
||||
number of equally-spaced points in the domain of [-1,1] to be used
|
||||
in building the tabular distribution. Default is `33`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -983,13 +1019,16 @@ class Library(object):
|
|||
xsdata_name += '_' + nuclide
|
||||
|
||||
xsdata = self.get_xsdata(domain, xsdata_name, nuclide=nuclide,
|
||||
xs_type=xs_type, xs_id=xs_ids[i])
|
||||
xs_type=xs_type, xs_id=xs_ids[i],
|
||||
tabular_legendre=tabular_legendre,
|
||||
tabular_points=tabular_points)
|
||||
|
||||
mgxs_file.add_xsdata(xsdata)
|
||||
|
||||
return mgxs_file
|
||||
|
||||
def create_mg_mode(self, xsdata_names=None, xs_ids=None):
|
||||
def create_mg_mode(self, xsdata_names=None, xs_ids=None,
|
||||
tabular_legendre=None, tabular_points=33):
|
||||
"""Creates an openmc.MGXSLibrary object to contain the MGXS data for the
|
||||
Multi-Group mode of OpenMC as well as the associated openmc.Materials
|
||||
and openmc.Geometry objects. The created Geometry is the same as that
|
||||
|
|
@ -1007,6 +1046,18 @@ class Library(object):
|
|||
Cross section set identifier (i.e., '71c') for all
|
||||
data sets (if only str) or for each individual one
|
||||
(if iterable of str). Defaults to '1m'.
|
||||
tabular_legendre : None or bool
|
||||
Flag to denote whether or not the Legendre expansion of the
|
||||
scattering angular distribution is to be converted to a tabular
|
||||
representation by OpenMC. A value of `True` means that it is to be
|
||||
converted while a value of `False` means that it will not be.
|
||||
Defaults to `None` which leaves the default behavior of OpenMC in
|
||||
place (the distribution is converted to a tabular representation).
|
||||
tabular_points : int
|
||||
This parameter is not used unless the ``tabular_legendre``
|
||||
parameter is set to `True`. In this case, this parameter sets the
|
||||
number of equally-spaced points in the domain of [-1,1] to be used
|
||||
in building the tabular distribution. Default is `33`.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1071,7 +1122,9 @@ class Library(object):
|
|||
|
||||
# Create XSdata and Macroscopic for this domain
|
||||
xsdata = self.get_xsdata(domain, xsdata_name, nuclide='total',
|
||||
xs_type=xs_type, xs_id=xs_ids[i])
|
||||
xs_type=xs_type, xs_id=xs_ids[i],
|
||||
tabular_legendre=tabular_legendre,
|
||||
tabular_points=tabular_points)
|
||||
mgxs_file.add_xsdata(xsdata)
|
||||
macroscopic = openmc.Macroscopic(name=xsdata_name, xs=xs_ids[i])
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ class XSdata(object):
|
|||
raise ValueError(msg)
|
||||
if 'num_points' in tabular_legendre:
|
||||
num_points = tabular_legendre['num_points']
|
||||
check_value('num_points', num_points, Integral)
|
||||
check_type('num_points', num_points, Integral)
|
||||
check_greater_than('num_points', num_points, 0)
|
||||
else:
|
||||
if not enable:
|
||||
|
|
|
|||
|
|
@ -387,11 +387,13 @@ module mgxs_header
|
|||
|
||||
! Get scattering treatment information
|
||||
! Tabular_legendre tells us if we are to treat the provided
|
||||
! Legendre polynomials as tabular data (if enable is true) or leaving
|
||||
! them as Legendres (if enable is false, or the default)
|
||||
! Legendre polynomials as tabular data (if enable is true, default)
|
||||
! or leaving them as Legendres (if enable is false)
|
||||
|
||||
! Set the default (leave as Legendre polynomials)
|
||||
enable_leg_mu = .false.
|
||||
! Set the default (Convert to tabular format w/ 33 points)
|
||||
enable_leg_mu = .true.
|
||||
legendre_mu_points = 33
|
||||
! Get the user-provided values
|
||||
if (check_for_node(node_xsdata, "tabular_legendre")) then
|
||||
call get_node_ptr(node_xsdata, "tabular_legendre", node_legendre_mu)
|
||||
if (check_for_node(node_legendre_mu, "enable")) then
|
||||
|
|
|
|||
|
|
@ -398,29 +398,18 @@ contains
|
|||
end do
|
||||
|
||||
! Re-normalize fmu for numerical integration issues and in case
|
||||
! the negative fix-up introduced un-normalized data
|
||||
! the negative fix-up introduced un-normalized data while
|
||||
! accruing the CDF
|
||||
norm = ZERO
|
||||
do imu = 2, order
|
||||
norm = norm + HALF * this % dmu * &
|
||||
(this % fmu(gin) % data(imu - 1, gout) + &
|
||||
this % fmu(gin) % data(imu, gout))
|
||||
this % dist(gin) % data(imu, gout) = norm
|
||||
end do
|
||||
if (norm > ZERO) then
|
||||
this % fmu(gin) % data(:, gout) = &
|
||||
this % fmu(gin) % data(:, gout) / norm
|
||||
end if
|
||||
|
||||
! Now create CDF from fmu with trapezoidal rule
|
||||
this % dist(gin) % data(1, gout) = ZERO
|
||||
do imu = 2, order
|
||||
this % dist(gin) % data(imu, gout) = &
|
||||
this % dist(gin) % data(imu - 1, gout) + &
|
||||
HALF * this % dmu * (this % fmu(gin) % data(imu - 1, gout) + &
|
||||
this % fmu(gin) % data(imu, gout))
|
||||
end do
|
||||
! Ensure we normalize to 1 still
|
||||
norm = this % dist(gin) % data(order, gout)
|
||||
if (norm > ZERO) then
|
||||
this % dist(gin) % data(:, gout) = &
|
||||
this % dist(gin) % data(:, gout) / norm
|
||||
end if
|
||||
|
|
@ -628,11 +617,10 @@ contains
|
|||
p1 = this % fmu(gin) % data(k + 1, gout)
|
||||
mu1 = this % mu(k + 1)
|
||||
|
||||
frac = (p1 - p0) / (mu1 - mu0)
|
||||
|
||||
if (frac == ZERO) then
|
||||
if (p0 == p1) then
|
||||
mu = mu0 + (xi - c_k) / p0
|
||||
else
|
||||
frac = (p1 - p0) / (mu1 - mu0)
|
||||
mu = mu0 + &
|
||||
(sqrt(max(ZERO, p0 * p0 + TWO * frac * (xi - c_k))) - p0) / frac
|
||||
end if
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ contains
|
|||
real(8) :: atom_density_ ! atom/b-cm
|
||||
real(8) :: f ! interpolation factor
|
||||
real(8) :: score ! analog tally score
|
||||
real(8) :: macro_total ! material macro total xs
|
||||
real(8) :: macro_scatt ! material macro scatt xs
|
||||
real(8) :: E ! particle energy
|
||||
|
||||
i = 0
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.033731E+00 4.974463E-02
|
||||
1.047136E+00 2.765964E-02
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.055274E+00 1.715904E-02
|
||||
1.102093E+00 4.962190E-02
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.033731E+00 4.974463E-02
|
||||
1.047136E+00 2.765964E-02
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.094839E+00 1.203524E-02
|
||||
1.140804E+00 2.937150E-02
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue