Passing ace to make_ace is not supported. Use acer instead.
The acer argument now signals if the acer njoy module should
be run and where to save the output file. xsdir defaults to
None now, rather than "xsdir". This change allows the xsdir
file to be written to the same directory as acer, or a user
supplied location potentially separate from ace file.
This reverts d81aaeca9 and 81c625928 in the following ways.
Fission heating data, MT318, is pulled from the heatr file
produced when running NJOY. Reaction data that is potentially
temperature dependent is set onto the IncidentNeutron object
by scaling MT318 by the ratio of the fission cross section
used in HEATR and other fission cross sections stored on the
object. This produces potentially many MT318 fission heating
KERMA coefficients on the nuclide.
The fission-less heating coefficient, MT999, if computed by
subtracting MT318 from MT301, total heating coefficients. This
reaction is marked as redundant, as it can easily be reconstructed.
MT318 is allowed to be written to the HDF5 file, while 999 is not.
When reading back in the library, MT999 is rebuilt in exactly
the same manner.
The test_heating test in tests/unit_tests/test_data_neutron.py
has been updated given the changes in this commit.
It is worth noting that the heating coefficients computed in
NJOY only contain prompt neutrons, as
k_{i,j}(E) = sigma_{i,j}(E) * (E + Q - \bar{E})
where k_{i,j} is the kerma coefficient for reaction j of material
i, sigma_{i,j} is the corresponding reaction cross section, E
is the energy of incident particle, Q is the mass-difference
Q value, and \bar{E} is the average energy of secondary particles.
Source: NJOY16 Manual on HEATR
IncidentNeutron.from_ace now computes the fission heating
and a fission-less heating coefficient. The fission heating
is the product of the heating number and the fission cross
section, and stored as MT318.
The fission-less heating is the heating from all reactions
except fission, computed as heating_number * (total_xs - fission_xs).
The MT number for this is taken to be 999 as a temporary value.
A test is added for Am244 in test_data_neutron.py to examine the
new heating values
Remove copy method.
__contains__ and __getitem__ now take advantage of the
ordering of products. This can improve time searching
for fission products and retrieving yields.
radd and rmul methods defer to their left counterparts, e.g.
x * fy => fy * x. Return NotImplemented types if addition is
not done with another set of fission yields and multiplication
is not done with a scalar.
Improve/expand special methods for FissionYield
Remove copy method.
__contains__ and __getitem__ now take advantage of the
ordering of products. This can improve time searching
for fission products and retrieving yields.
radd and rmul methods defer to their left counterparts, e.g.
x * fy => fy * x. Return NotImplemented types if addition is
not done with another set of fission yields and multiplication
is not done with a scalar.
The FissionYieldCutoffHelper will always find a set of yields
to use for all nuclides with yield data now, rather than raise
an error. Previously, if the cutoff was outside the provided
bounds, an error was raised because there wasn't a clear set of
"fast" and "thermal" yields to use. However, this caused issues
with nuclides that are missing a set of lower yields, like
Th232 with yields at 5e5 and 6e6 per ENDF/B-VII.1 data.
Now, if the cutoff energy is outside the bounds of provided
yield data, the closet set of yields to the cutoff is taken to
be constant. These nuclides will not be tallied during the
transport routine.
Removed unit test files for test_deplete_*py that pertained to a
single integrator type only. Similarly removed tests where the
integrators are used to perform simple restart analysis.
These tests are still present, but done with two parametrized tests.
Each of the integrators has the exact same solution in the unit tests
with and without restarting,by nature of their design.
This and the near-fixture like way the tests
are structured allowed these tests to be easily parametrized provided
1) integrator, 2) reference solutions for atoms 1 and 2.
Exact results for each integrator in the unit test are contained
inside a collections.namedtuple, along with the Integrator class.
These named tuples are placed in a dictionary in
tests/dummy_operator.py that can be easily iterated over to provide
access to a name of the scheme, e.g. "predictor", and the tuple of
integrator, results for atom 1, and results for atom 2.
Exact results for atoms 1 and 2 should be provided using the depletion
matrix produced by the tests.dummy_operator.DummyOperator for two
time steps of 0.75 seconds.
Reconfigure tests/unit_tests/test_deplete_chain.py and
tests/unit_tests/test_deplete_nuclide.py to use the new
dictionary-like representation of fission yields.
Provide a module-scoped fixture that creates a temporary
directory, adds simple settings, geometry, and material files,
and initializes the openmc C API. This fixture also provides
two empty openmc.capi.Material objects to help the helpers
generate meaningful tallies.
The main tests for AveragedFissionYieldHelper and
FissionYieldCutoffHelper now go through the built tallies
and examine the filters, nuclides, and scores. A helper
function produces mocked-like tally data based on filters,
nuclides, and scores found on a tally.
Pu239 with 0.0253 eV, 500 keV, and 2 MeV yields is included in
the nuclide_bundle fixture. This provides some additional
heterogeneity in the results, as the 2 MeV data is not present
on U235.
- Change Operator attribute name for fission yield helper
- Use copy.deepcopy for constant_yields, fast_yields, and thermal_yields
- Change import location of openmc in tests
- Use bisect.bisect_left to find replacement fission yields on
FissionYieldCutoffHelper if thermal or fast energies not found
In an (n, alpha) reaction, the branching ratio for helium should
always be one, as it is produced for every reaction.
It is the branching ratio of the other targets that must be modified.
He4 is treated as a secondary particle for this case, and its
reaction is not modified nor removed from the parent.
Generalized method that allows the modification of branching
ratios for an arbitrary reaction. A similar replacement has been
made with the companion get_capture_branches -> get_branch_ratios.
Both of the new methods accept an additional reaction argument,
which defaults to "(n,gamma)", indicating what reaction to
modify/retrieve.
Also added a tolerance argument, defaults to 1e-5, for checking
the sum of user-supplied branching ratios. This tolerance is
used as 1 - tolerance < sum_br < 1 + tolerance. Additional
logic is included if the user has not specified the ground
state, which can be inferred. For this case, the lower end
is allowed to be less than 1 - tolerance, as the ground state will
have a branch ratio such the sum of ratios is unity.
Products are not checked for consistency, that is left up to the user.
tests/unit_test/test_deplete_chain.py has been modified with the
new notation, and also with a variety of calls with and without
the optional reaction argument. A minor test is added that modifies
(n,alpha) and (n,2n) reactions just to ensure that arbitrary reactions
can be used.
Minor changes:
* Internal variables changed to reflect the generality of the method
* Added documentation on what exceptions are raised in
set_branch_ratios
Related: openmc issue #1237
Renamed update_nuclides_from_operator -> update_tally_nuclides
to be more general.
The base method TalliedFissionYieldHelper.update_tally_nuclides will
raise an AttributeError if this method is called before the tallies
are generated. The inner logic for setting the tallied nuclides can
be streamlined given the assumption that the tally exists.
AveragedFissionYieldHelper.update_tally_nuclides has been improved
to set the nuclides for the weighted tally now. This was not captured
prior because the nuclides were copied over from the fission rate
tally during tally generation, prior to when nuclides were set.
Base class TalliedFissionYieldHelper and AveragedFissionYieldHelper
instances do not need to know the number of burnable materials,
and thus it is no longer a required input argument.
Changes propagated into the from_operator methods and
tests/unit_tests/test_deplete_fission_yields.py
Removed explicit TalliedFissionYieldHelper.from_operator
method as it is identical and now inherited from the
base FissionYieldHelper.from_operator method
Computes the effective fission yields for nuclides
with multiple sets of yields by
1) Tallying fission rate and energy-weighted fission rate
2) Determining average energy at which fission events occur
3) Interpolating [lin-lin] between adjacent fission yields based
on this average energy
Uses a second tally with an EnergyFunctionFilter to tally
E * sigma_f * phi.
Added unit tests with the proxy-style class that doesn't use the
C API to generate tallies but tests all other aspects of the
implementation. Tests cover three possible average energies
(below minimum supplied yield energy, above max supplied yield energy,
and between two)
The Operator uses fission_yield_mode="average" to select this helper.
The helper also has a from_operator class method.
For consistency across the various fission yield helpers, the
Nuclide object now sets the yield data to always be a
FissionYieldDistribution or an empty dictionary.
Nuclide.yield_energies is now a property that returns the
energies from the FissionYieldDistribution.
When setting the yield_data, the Nuclide enforces the object
to be a Mapping instance. If the incoming yield_data is a
FissionYieldDistribution, no conversions are made. Otherwise,
a new distribution is created with the from_dict method.
The Chain.from_xml method now creates the yield_data for
nuclides using FissionYieldDistribution.from_dict
Changes were made to some unit tests that attempted to set
the yield_energies, which do not have a setter.
If the fission yields are a single entry, then
itertools.repeat is used to apply the fission yields to all
burnable materials. Otherwise, check that the number of
fission yield libraries is equal to the number of materials
to be burned.
The user is allowed to pass a single dictionary of yields to be applied
to all materials. Otherwise, each element in the iterable
should correspond to a material ordered by the TransportOperator.
Sparse checking is performed on the supplied input.
Validation is possible, but could become a burden for potentially
many burnable materials representing a lengthy list of
nested dictionaries to dig through and validate.
This helper performs the following tasks to weight fission yields:
1) Determine a set of "fast" and "thermal" yields
based on a user specified cutoff energy,
2) Tally fission rates above and below the cutoff, and
3) Compute the effective yield by weighting the fast and
thermal yields by the fraction of fast and thermal fissions
for all nuclides in all burnable materials.
The user is allowed to specify the cutoff energy and energies
preferred for the fast and thermal yields. By default, the
cutoff is 112 eV, chosen as it is the logarithmic mean of
0.0253 eV and 500 keV. These two values are the default energies
for thermal and fast yields.
Tests are added to check for failure in constructing this
helper (thermal energy > cutoff, non-real values passed, etc.),
selection of yields given a range of user data, and
a proxy class that emulates a variety of thermal and fast splits
to check the eventual computed yield libraries.