Commit graph

9978 commits

Author SHA1 Message Date
Paul Romano
e4e824fe4d Skip tests that require NJOY if it's not installed 2019-09-04 14:46:45 -05:00
Andrew Johnson
c7a8b6606e
Better collection of fission heating at temperatures
Use openmc.data.endf.get_evaluations to read in potentially
many 318 evaluations from the heatr file. The evaluated
temperatures are pulled using the target attribute, rounded
to the nearest integer for consistency, e.g. 293.6K -> 294K.
2019-09-04 14:46:32 -05:00
Andrew Johnson
6b23c21327
Pass output_dir to make_ace to collect files
The user can now pass a single argument indicating where output
tapes for each njoy module should be written. The default argument
is the current working directory, useful for removing any temporary
files created during testing.

 The pendf, broadr, heatr, gaspr, and purr arguments can either
be booleans or strings. A boolean value indicates the module output
should be written into a file named after the module, e.g. heatr output
written to <output_dir>/heatr.

ace and xsdir can be None or strings. A value of None means the
final ace and xsdir files will be written to
<output_dir>/ace and <output_dir>/xsdir, respectively. The temporary
temperature-dependent ace and xsdir files are now always named
"ace_<temp>" and "xsdir_<temp>", as the ace and xsdir arguments can
be more than "ace" and "xsdir".

openmc.data.IncidentNeutron.from_njoy knows to use this output_dir
argument to ensure all created tape files are written into the
temporary directory or the user requested directory, if applicable.
This commit was written because simply writing the broadr, gaspr,
and purr output files to "broadr", "gaspr", and "purr" resulted
in left over files after running tests.
2019-09-04 14:31:06 -05:00
Andrew Johnson
a0bac56ebd
Add fission-heating and non-fission-heating to reactions
MT318 and MT999 for fission heating and non-fission heating
have been added to the reactions supported in
openmc/data/reaction.py and src/reaction.cpp

Changed internal language from fission-less heating to
non-fission heating
2019-09-04 14:29:24 -05:00
Paul Romano
33d7166aef Various fixes for building documentation (esp. latexpdf) 2019-09-04 10:35:55 -05:00
Paul Romano
1134b18cb9 Set CMake policy CMP0079 when version >= 3.13 2019-09-03 22:30:22 -05:00
Paul Romano
56322b9b3f Make sure capi.init is called with intracomm in tests when MPI is enabled 2019-09-03 21:50:16 -05:00
Paul Romano
bbe5b7ba5e Make sure MPI_Type_free is not called if MPI hasn't been initialized 2019-09-03 21:49:32 -05:00
Andrew Johnson
2675ebc2c6
Compute fission heating and fission-less heating with njoy
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
2019-09-03 17:09:15 -05:00
Andrew Johnson
7badc48c22
Instruct njoy interface to retain heatr output
HEATR contains the 318 fission heating data needed to
construct the energy deposition tally. Until now, the output
tape was left in the njoy temporary directory with the other
output tapes. This commit instructs openmc.data.njoy to move
the heatr output from the running directory used in njoy.run
to the working directory used in njoy.make_ace

Removed unused imports argparse and sys
2019-09-03 16:16:13 -05:00
Andrew Johnson
d9c66fc13f
Merge pull request #1325 from paulromano/output-verbosity
Make sure output is always verbosity-limited
2019-09-03 15:18:15 -05:00
Paul Romano
d9e5249e8e Make sure output is always verbosity-limited 2019-09-03 12:40:36 -05:00
Paul Romano
6eba9841b5
Merge pull request #1323 from drewejohnson/data-temp-verbosity
Use level for neutron data temperature messages
2019-09-03 10:46:23 -05:00
Andrew Johnson
f2e14dc6be
Separate fission-q scoring into separate function
In order to reduce the amount of duplicated code in building
the energy deposition tally, the logic for scoring SCORE_FISS_Q_PROMPT
and SCORE_FISS_Q_RECOV has been pulled into a new function,
score_fission_q. The code is almost entirely copied over, with some
minor cleanup operations.
2019-09-03 08:57:32 -05:00
Andrew Johnson
99bff4f231
Use helper function when scoring fission_q_*
Add a brief helper function get_nuc_fission_q in
src/tallies/tally_scoring.cpp that is responsible for
returning the correct fission q value for a given
score. The two allowed scores are SCORE_FISS_Q_PROMPT and
SCORE_FISS_Q_RECOV. The helper function examines the correct
dataset on the nuclide object and evaluates the function given
the incident particle energy or returns zero.
The default value of zero is returned if the fission_q_prompt_ or
fission_q_recov_ datasets are empty, or the score is not
one of the expected types.
2019-09-03 08:57:29 -05:00
Paul Romano
d4782d5719
Merge pull request #1313 from drewejohnson/chain-fission-yields
Use energy-dependent fission yields when constructing depletion matrix
2019-09-03 04:53:52 -07:00
Andrew Johnson
d8c3b8a015
Use level for neutron data temperature messages
By setting a level, the messages will be printed only if the
verbosity setting allows it. This reduces some of the noise printed
in testing. Related output from travis:
https://travis-ci.org/openmc-dev/openmc/jobs/574867362#L1666-L1683

A level of 4 was chosen, indicating this should be printed with
the OpenMC logo, headers, and results.
2019-08-30 10:38:08 -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
6c5dfd69c2
Merge branch 'develop' into chain-fission-yields 2019-08-30 09:19:42 -05:00
Paul Romano
83028b8dcd
Merge pull request #1317 from drewejohnson/chain-set-branches-general
Chain set branches general
2019-08-25 08:58:20 -05:00
Andrew Johnson
81cce55df8
Merge pull request #1320 from paulromano/reduce-test-time
Reduce number of nuclides in some regression test
2019-08-23 18:18:22 -05:00
Paul Romano
12ec18796a Respond to @drewejohnson comments on #1320 2019-08-23 13:17:03 -05:00
Andrew Johnson
81c6259289
Write neutron fission-less heating coefficient to HDF5
Mark reaction 999 as one to be kept during the export process
2019-08-23 11:52:25 -05:00
Andrew Johnson
d81aaeca98
Store fission heating IncidentNeutron.from_ace
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
2019-08-23 11:51:09 -05:00
Andrew Johnson
c8e205aff8
Update dictionary of secondary particles for Chain 2019-08-23 11:43:19 -05:00
Andrew Johnson
129ee7e941
Merge branch 'develop' into chain-fission-yields 2019-08-23 11:24:06 -05:00
Paul Romano
0b42d2c298
Merge pull request #1319 from drewejohnson/refactor-depletion-tests
Refactor depletion unit tests with parametrization
2019-08-23 11:14:42 -05:00
Andrew Johnson
49ffda2ee6
Merge pull request #1318 from paulromano/real8-bugfix
Get rid of MPI_REAL8 in state_point.cpp
2019-08-23 08:36:51 -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
61232248df
Update documentation for FissionYieldDistribution 2019-08-23 08:32:38 -05:00
Andrew Johnson
91c08ef323
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.

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.
2019-08-23 08:32:32 -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
dbd24035a3
Refactor depletion unit tests with parametrization
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.
2019-08-22 10:05:23 -05:00
Andrew Johnson
6c25dbf33b
Merge branch 'develop' into chain-set-branches-general 2019-08-22 10:02:07 -05:00
Andrew Johnson
9287db4a26
Support more secondary nuclides in Chain.set_branch_ratios
Reactions are pulled from reaction scores table on
https://docs.openmc.org/en/latest/usersguide/tallies.html#scores
for reactions that produce hydrogen and helium isotopes
2019-08-22 09:55:14 -05:00
Andrew Johnson
4f46aa895c
Teach deplete.Nuclide.validate about new fission yields
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.
2019-08-21 17:46:51 -05:00
Andrew Johnson
93d68a24df
Merge branch 'develop' into chain-fission-yields 2019-08-21 17:32:14 -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
687d287b24
Allow Nuclide.yield_data to be None
Had to guard against some cases where it was assumed
that yield_data would be a dictionary. For the most part,
the fission yield helpers act on nuclides that have yield data
already.
The previous default state was to use an empty dictionary.
This has been removed. A value of None for nuclide.yield_data
indicates there is no yield data.
2019-08-21 11:45:57 -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
Paul Romano
37c0fff7ed Update filter_mesh test to cover a few cases in mesh.cpp that were missed 2019-08-21 10:42:35 -05:00
Paul Romano
da18820a88 Add a nuclide with Maxwell fission spectrum to energy_laws test 2019-08-21 10:42:35 -05:00
Paul Romano
36bfa08eae Update filter_energyfun test 2019-08-21 10:42:35 -05:00
Paul Romano
92433b255c Update filter_mesh test 2019-08-21 10:42:35 -05:00
Paul Romano
c245f78148 Update mgxs_library_mesh test 2019-08-21 10:42:35 -05:00
Paul Romano
e1d2a9d802 Update tally_arithmetic test 2019-08-21 10:42:35 -05:00
Paul Romano
7bc96c822c Update tally_aggregation test 2019-08-21 10:42:35 -05:00