Commit graph

21 commits

Author SHA1 Message Date
Paul Romano
ac941f79e0
Add RectangularPrism and HexagonalPrism composite surfaces (#2739)
Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
2023-11-01 09:13:40 -05:00
Paul Romano
0d83672544 Resolve a few TODOs related to Python 3.6 2021-07-27 22:50:28 -05:00
Paul Romano
06e598f38e Use tally mean in helpers rather than direct access to results 2020-08-03 07:38:36 -05:00
Paul Romano
bbb0b78383 Rename openmc.capi -> openmc.lib 2019-09-13 10:38:26 -05:00
Andrew Johnson
c486b4187f
Use python API for setup in test_deplete_fission_yields 2019-08-30 09:55:58 -05:00
Andrew Johnson
399b77e38f
Clean up internals for AveragedFissionYieldHelper
Respond to some other reviewer comments for #1313
2019-08-30 09:36:28 -05:00
Andrew Johnson
991a36df8d
Pass strings to os functions in test_deplete_fission_yields
os.remove and os.chdir support path-like objects only for
python 3.6+
2019-08-23 08:33:55 -05:00
Andrew Johnson
1e5cfe0961
Return list of str from FY helpers update_tally_nuclides 2019-08-23 08:32:48 -05:00
Andrew Johnson
7b175961fa
Use constant FY if cutoff energy outside provided yields
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.
2019-08-23 08:32:20 -05:00
Andrew Johnson
8e2bb0bbbc
Improve testing for FY helpers using C API
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.
2019-08-21 17:20:19 -05:00
Andrew Johnson
60f89794f6
Use dictionary to create FissionYieldDistribution
Removes the FissionYieldDistribution.from_dict method as the
most natural way to create such a distribution is with a dictionary.
2019-08-21 10:58:25 -05:00
Andrew Johnson
f977962113
Support passing nuclide name to Nuclide objects
Allow the creation of a Nuclide with
>>> n = Nuclide("U235")
2019-08-21 10:44:28 -05:00
Andrew Johnson
b19a2db0ee
Respond to reviewer comments on FY helpers
- 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
2019-08-21 10:24:09 -05:00
Andrew Johnson
2aa1849eda
Apply suggestions from code review
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
2019-08-21 08:46:55 -05:00
Andrew Johnson
0cf3ea3b16
Improve updating of nuclides on tallied FPY helpers
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.
2019-08-19 09:43:40 -05:00
Andrew Johnson
d8b5752b59
Make n_bmat required only for FissionYieldCutoffHelper
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
2019-08-15 11:20:04 -05:00
Andrew Johnson
454e6cc6b6
Add AveragedFissionYieldHelper operator helper
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.
2019-08-14 17:39:57 -05:00
Andrew Johnson
f2fa86fd52
Delegate Nuclide yield properties to FissionYieldDistribution
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.
2019-08-14 16:10:05 -05:00
Andrew Johnson
0931b58269
Fix wonky layout in test_deplete_fission_yields 2019-08-14 16:01:50 -05:00
Andrew Johnson
f82dc83473
Add FissionYieldCutoffHelper for weighting yields by a cutoff energy
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.
2019-08-13 16:38:24 -05:00
Andrew Johnson
d8b9f5db54
Add ConstantFissionYieldHelper concrete class
Given a requested energy, will take fission yields from that
energy on all nuclides and hold them as constant throughout
the simulation. If the requested energy is not found for a specific
nuclide, then the closest energy is used. The default is to
take the thermal 0.0253 eV yields.

This is now the helper attached to the Operator. The user can
select what energy of yields they would like to use.
2019-08-13 16:01:50 -05:00