Commit graph

20 commits

Author SHA1 Message Date
Paul Romano
f544d02e49
Don't write reaction rates in depletion results by default, remove per-stage data for multistage integrators (#3609) 2025-11-19 12:26:57 -05:00
Paul Romano
8bfb1889b9 Rename deplete.ResultsList -> deplete.Results 2022-06-03 09:04:00 -05:00
Paul Romano
0b77cc7edc Allow normal instantiation of ResultsList (instead of from_hdf5) 2022-06-03 09:03:57 -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
becda0c2c2
Merge branch 'develop' into bug-restart-mpi 2019-08-07 13:50:42 -05:00
Andrew Johnson
1bd663daf6
Rename integrator classes to be PEP8 complaint
Changes:
- EPC_RK4_Integrator -> EPCRK4Integrator
- SI_Integrator -> SIIntegrator
- SI_CELI_Integrator -> SICELIIntegrator
- SI_LEQI_Integrator -> SICELIIntegrator
2019-08-07 08:55:40 -05:00
Andrew Johnson
0fdef55d42
Create ResultsList from file using from_hdf5
The new class method ResultsList.from_hdf5 should be
used to load in results data, rather than passing
the file name into the __init__ method. __init__
passes directly to list.__init__ now.

The motivation for this is to resolve the depletion
restart with MPI bug #1275. To do this, each Operator
will create it's own ResultsList and distribute reaction
rates and densities according to what materials are burned
on this process. Rather than use a normal list, this Operator
expects the various accessor methods like get_atoms to be
present on self.prev_res
2019-08-05 16:09:49 -05:00
Andrew Johnson
a02feed171
Restrict depletion restart to schemes with common stages
Each scheme is capable of different amounts of concentration
and reaction data, depending on the number of intermediate
transport solutions of interest. The PredictorIntegrator
stores data from a single solution, while the CF4Integrator and
EPC_RK4_Integrator store four stages. This discrepancy can cause
issues when saving data in the depletion output file, as
either some data is calculated and thrown away [more stages going
to fewer stages] or excess space is not utilized [fewer stages
going in to a restart that previously used more stages].

Each subclass of Integrator is expected to declare a
_N_STAGES attribute that provides information on the number of
stages expected. Iterative schemes like SI_CELI_Integrator
only report two stages, for the initial concentration and
first prediction, rather than at each iteration point.

Logic that checks for consistent sizes is included in the
initialization of the Integrators, and has been removed
from Results.save
2019-07-30 14:19:56 -05:00
Andrew Johnson
d5fa7b5c00
Set correct index for final nuclides in restart tests
Many repetitions of the following change:

-    assert y1[3] == approx(s2[0])
-    assert y2[3] == approx(s2[1])
+    assert y1[2] == approx(s2[0])
+    assert y2[2] == approx(s2[1])

This causes many of the restart tests to fail, because all
schemes but the predictor save repeated data under restart conditions.
Performing one normal depletion event, non-restarted, and then
one restart event, as these tests do, should produce vectors for
time and densities like:
   t = [t0, t1, t2]
   a = [a0, a1, a2]
            |    ^ after restart
            ^ non-restart run
With this, the current tests would fail due to an IndexError, as
the atom vectors should only have three elements. Instead,
non-predictor schemes return vectors
   t = [t0, t1, t1, t2]
   a = [a0, a1, a1, a2]
and one can access a[3] to obtain the desired EOS concentrations.
2019-07-29 14:46:02 -05:00
Andrew Johnson
1f3e7fdac1
Remove si_leqi in favor of SI_LEQI_Integrator
The depletion function openmc.deplete.si_leqi has been
removed in favor of the SI_LEQI_Integrator class. The same
depletion scheme can be obtained with the following commands:

   >>> leqi = openmc.deplete.SI_LEQI_Integrator(operator, dt, power)
   >>> leqi.integrate()

The expression can be onlined for compactness.

The si_celi_inner function has been removed completely now,
as the SI_CELI iteration is performed by directly calling
SI_CELI_Integrator.__call__ through the SI_LEQI_Integrator.
This is similar to how the LEQIIntegrator handles the initial steps.

Tests have been updated to use this class, and the class has been
added to the documentation. No pure-function integration
schemes exist anymore.
2019-07-29 10:34:59 -05:00
Andrew Johnson
d28546bcd6
Add SI_Integrator, SI_CELI_Integrator classes; remove si_celi
The si_celi depletion function has been removed. The
SI-CELI method can be implemented with
    >>> from openmc.deplete import SI_CELI_Integrator
    >>> SI_CELI_Integrator(op, dt, power, stages).integrate()

The stages parameter is optional, and defaults to 10 to
be consistent with the previous default for si_celi.

The SI_CELI_Integrator inherits from the new abstract base class
SI_Integrator. There are a few differences in how the SI-based
methods perform the integration.

- The initial, t=0.0, i=0, no restart transport solution is scaled
  by the number of stages.
- The SI methods also do not perform a new transport solution at
  each successive iteration [t>0, i>0]. Instead, the reaction
  rates are pulled from the last stage of the previous step.
- There is no final transport solution once all the depletion
  steps have been taken. The final reaction rates are saved as
  those from the last stage of the last depletion step.

The si_celi function has been removed from documentation and testing,
and replaced with the SI_CELI_Integrator.
2019-07-26 16:58:51 -05:00
Andrew Johnson
e30e6e3f99
Use CF4Integrator in restart tests 2019-07-26 09:52:55 -05:00
Andrew Johnson
39b4d8a1fe
Remove epc_rk4 for EPC_RK4_Integrator class
The function openmc.deplete.epc_rk4 has been removed
in favor of openmc.deplete.EPC_RK4_Integrator. The scheme
can be used with::

    >>> from openmc.deplete import EPC_RK4_Integrator
    >>> EPC_RK4_Integrator(op, dt, power).integrate()

epc_rk4 has been removed from the documentation, and the
EPC_RK4_Integrator class has been added to the depletion
API documentation
2019-07-26 09:49:58 -05:00
Andrew Johnson
769f903dbc
Remove celi, leqi functions for CELIIntegrator, LEQIIntegrator
The depletion functions openmc.deplete.celi and
openmc.deplete.leqi hvae been removed in favor of a class-based
approach. The following syntax will replicate the behavior
of the integration schemes:

>>> from openmc.deplete import CELIIntegrator
>>> celi = CELIIntegrator(operator, time, power)
>>> celi.integrate()

The expression can be reduced to a single line:

>>> LEQIIntegrator(operator, time, power).integrate()
2019-07-17 16:46:30 -05:00
Andrew Johnson
f0bb600271
Remove predictor function for deplete.PredictorIntegrator
The depletion function openmc.deplete.predictor has been removed
in favor of a class-based approach. The following syntax will
replicate the behavior of the predictor integration scheme:

>>> from openmc.deplete import PredictorIntegrator
>>> predictor = PredictorIntegrator(operator, time, power)
>>> predictor.integrate()`

The expression can be reduced to a single line:

>>> PredictorIntegrator(operator, time, power).integrate()
2019-07-17 13:39:05 -05:00
Andrew Johnson
f432be0c05
Remove cecm function for deplete.CECMIntegrator
The cecm function has been removed from the python api.
In order to use the cecm integration scheme,
the following class based approach is now expected:

>>> from openmc.deplete import CECMIntegrator
>>> cecm = CECMIntegrator(operator, timesteps, power)
>>> cecm.integrate()

if the integrator is not needed, this above expression can be
one-lined with

>>> CECMIntegrator(operator, timesteps, power).integrate()

Unit tests have been updated to no longer use the cecm function,
and cecm has been removed from documentation.
The CECMIntegrator has been added to documentation.
2019-07-16 11:07:49 -05:00
liangjg
d65bdaac49 fix restart bug for LE/QI methods 2019-01-24 20:10:16 -05:00
liangjg
0f639937b7 added unit tests for CE/LI and LE/QI 2019-01-23 15:54:14 -05:00
liangjg
cddfbf41c0 updated test results 2019-01-21 00:00:06 -05:00
guillaume
b2c720b296 added unit tests for depletion restart capability 2018-06-02 16:34:41 -04:00