Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Docs/source/ode_integrators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fractions. Looser than this can produce large errors.
Controlling Species $\sum_k X_k = 1$
====================================

.. index:: integrator.renormalize_abundances, integrator.SMALL_X_SAFE, integrator.do_species_clip
.. index:: integrator.renormalize_abundances, integrator.SMALL_X_SAFE, integrator.do_species_clip, integrator.do_corrector_validation

The ODE integrators don't know about the constraint that

Expand All @@ -275,10 +275,18 @@ constraint on the intermediate states during the integration.
The default is ``1.e-30``.

* ``integrator.do_species_clip`` : this enforces that the mass fractions
all in $[\mathtt{SMALL\_X\_SAFE}, 1.0]$.

This is enabled by default.

all in $[\mathtt{SMALL\_X\_SAFE}, 1.0]$ before calling the network righthand
side function.

This is off by default. Turning this on can sometimes make the integrator
work a lot harder.

* ``integrator.do_corrector_validation`` : in the nonlinear solve
corrector loop, when we get a corrected integration state, do we
check to make sure the mass fractions are valid before calling the
righthand function? This is needed in some cases if
``integrator.do_species_clip`` is disabled. Note: this is not
implemented for every integrator.


Retry Mechanism
Expand Down
30 changes: 30 additions & 0 deletions integration/VODE/vode_dvnlsd.H
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,36 @@ amrex::Real dvnlsd (int& NFLAG, BurnT& state, DvodeT& vstate)
vstate.y(i) = vstate.yh(i,1) + vstate.acor(i);
}

// sometime VODE goes way off tangent. If these mass fractions
// are really bad, then let's just bail now

if (integrator_rp::do_corrector_validation && !integrator_rp::use_number_densities) {
#ifdef SDC
const amrex::Real rho_current = state.rho_orig + vstate.tn * state.ydot_a[SRHO];
const amrex::Real thresh = species_failure_tolerance * rho_current;
#else
const amrex::Real thresh = species_failure_tolerance;
#endif
bool fail{};
for (int i = 1; i <= NumSpec; ++i) {
if (vstate.y(i) < -thresh) {
fail = true;
break;
}
}

// this resets the flags in the same fashion as is done above
// for a singular matrix. ICF = 2 means "unrecoverable error",
// IPUP = 1 forces a Jacobian reevaluation. The return value,
// ACNRM is ignored in this case (since NFLAG != 0)
if (fail) {
NFLAG = -1;
vstate.ICF = 2;
vstate.IPUP = 1;
return ACNRM;
}
}

// Test for convergence. If M > 0, an estimate of the convergence
// rate constant is stored in CRATE, and this is used in the test.

Expand Down
6 changes: 5 additions & 1 deletion integration/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ retry_atol_enuc real -1

# in the clean_state process, do we clip the species such that they
# are in [0, 1]?
do_species_clip bool 1
do_species_clip bool 0

# in the corrector loop, do we check if the predicted state is
# valid (X > 0) before calling the RHS?
do_corrector_validation bool 1

# flag for turning on the use of number densities for all species
use_number_densities bool 0
Expand Down
6 changes: 3 additions & 3 deletions unit_test/burn_cell/ci-benchmarks/aprox13_RKC_unit_test.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Initializing AMReX (23.05-658-g0165b6743355)...
AMReX (23.05-658-g0165b6743355) initialized
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
AMReX (25.11-47-gc4fcda1fb2ea) initialized
starting the single zone burn...
Maximum Time (s): 0.01
State Density (g/cm^3): 1000000
Expand Down Expand Up @@ -70,4 +70,4 @@ omegadot(Cr48): 3.272104685e-12
omegadot(Fe52): 7.126141581e-18
omegadot(Ni56): 1.22471994e-24
number of steps taken: 255
AMReX (23.05-658-g0165b6743355) finalized
AMReX (25.11-47-gc4fcda1fb2ea) finalized
52 changes: 26 additions & 26 deletions unit_test/burn_cell/ci-benchmarks/ecsn_unit_test.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Initializing AMReX (25.12-25-g10b67a795031)...
AMReX (25.12-25-g10b67a795031) initialized
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
AMReX (25.11-47-gc4fcda1fb2ea) initialized
starting the single zone burn...
reading in network electron-capture / beta-decay tables...
Maximum Time (s): 0.01
Expand Down Expand Up @@ -30,37 +30,37 @@ RHS at t = 0
S32 1323519.174
------------------------------------
successful? 1
- Hnuc = 4.572458836e+19
- added e = 4.572458836e+17
- final T = 6740499652
- Hnuc = 4.397909277e+19
- added e = 4.397909277e+17
- final T = 6656291303
------------------------------------
e initial = 5.995956082e+17
e final = 1.056841492e+18
e final = 1.039386536e+18
------------------------------------
new mass fractions:
H1 0.008875172349
He4 9.999999998e-31
O16 6.258606287e-07
O20 0.009862665409
F20 0.009861311457
Ne20 8.532947059e-14
Mg24 1.247632983e-06
Al27 1.79296072e-18
Si28 0.3055707459
P31 9.999999998e-31
S32 0.6658282314
H1 0.009307048983
He4 3.598820253e-13
O16 6.945042998e-07
O20 0.009997687144
F20 0.009996314357
Ne20 1.027891736e-13
Mg24 1.24621466e-06
Al27 1.645253981e-18
Si28 0.3262434305
P31 8.175490055e-14
S32 0.6444535783
------------------------------------
species creation rates:
omegadot(H1): -0.1124827651
omegadot(H1): -0.06929510166
omegadot(He4): -3
omegadot(O16): -49.99993741
omegadot(O20): -0.01373345906
omegadot(F20): -0.01386885428
omegadot(O16): -49.99993055
omegadot(O20): -0.0002312855859
omegadot(F20): -0.0003685642773
omegadot(Ne20): -30
omegadot(Mg24): -9.999875237
omegadot(Mg24): -9.999875379
omegadot(Al27): -1
omegadot(Si28): 29.55707459
omegadot(Si28): 31.62434305
omegadot(P31): -1
omegadot(S32): 65.58282314
number of steps taken: 16498
AMReX (25.12-25-g10b67a795031) finalized
omegadot(S32): 63.44535783
number of steps taken: 598
AMReX (25.11-47-gc4fcda1fb2ea) finalized
90 changes: 45 additions & 45 deletions unit_test/burn_cell/ci-benchmarks/he-burn-19am_BE_unit_test.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Initializing AMReX (23.05-1038-gbd922c6216e0)...
AMReX (23.05-1038-gbd922c6216e0) initialized
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
AMReX (25.11-47-gc4fcda1fb2ea) initialized
starting the single zone burn...
reading in network electron-capture / beta-decay tables...
Maximum Time (s): 1e-05
Expand Down Expand Up @@ -46,53 +46,53 @@ RHS at t = 0
Ni56 2.574224319e-29
------------------------------------
successful? 1
- Hnuc = 1.324591682e+23
- added e = 1.324591682e+18
- final T = 3539838349
- Hnuc = 1.324591986e+23
- added e = 1.324591986e+18
- final T = 3539838445
------------------------------------
e initial = 1.396711859e+18
e final = 2.721303541e+18
e final = 2.721303845e+18
------------------------------------
new mass fractions:
H1 0.0614041578
He4 0.001390967515
C12 1.194150996e-07
N13 7.948320928e-11
N14 0.001132572545
O16 6.939462514e-06
Ne20 0.001268664041
Na23 5.77734127e-09
Mg24 0.001851928121
Al27 1.100081874e-07
Si28 0.3024482452
P31 2.19817828e-06
S32 0.3484511353
Ar36 0.1639686458
Ca40 0.1171367255
Ti44 0.0008763032297
Cr48 6.064947631e-05
Fe52 6.31118656e-07
Ni56 1.361868236e-09
H1 0.06140416809
He4 0.001390777362
C12 1.194102635e-07
N13 7.947998734e-11
N14 0.001132527207
O16 6.938893863e-06
Ne20 0.001268559515
Na23 5.77607584e-09
Mg24 0.001851806271
Al27 1.099859099e-07
Si28 0.3024474385
P31 2.197872323e-06
S32 0.3484525859
Ar36 0.1639692923
Ca40 0.117135911
Ti44 0.0008762828478
Cr48 6.064662425e-05
Fe52 6.310696052e-07
Ni56 1.36171123e-09
------------------------------------
species creation rates:
omegadot(H1): -3859.58422
omegadot(He4): -49860.90325
omegadot(C12): -9999.988058
omegadot(H1): -3859.583191
omegadot(He4): -49860.92226
omegadot(C12): -9999.988059
omegadot(N13): -9999.999992
omegadot(N14): -9886.742745
omegadot(O16): -9999.306054
omegadot(Ne20): 126.8664041
omegadot(Na23): 0.000577734127
omegadot(Mg24): 185.1928121
omegadot(Al27): 0.01100081874
omegadot(Si28): 30244.82452
omegadot(P31): 0.219817828
omegadot(S32): 34845.11353
omegadot(Ar36): 16396.86458
omegadot(Ca40): 11713.67255
omegadot(Ti44): 87.63032297
omegadot(Cr48): 6.064947631
omegadot(Fe52): 0.0631118656
omegadot(Ni56): 0.0001361868236
number of steps taken: 9720
AMReX (23.05-1038-gbd922c6216e0) finalized
omegadot(N14): -9886.747279
omegadot(O16): -9999.306111
omegadot(Ne20): 126.8559515
omegadot(Na23): 0.000577607584
omegadot(Mg24): 185.1806271
omegadot(Al27): 0.01099859099
omegadot(Si28): 30244.74385
omegadot(P31): 0.2197872323
omegadot(S32): 34845.25859
omegadot(Ar36): 16396.92923
omegadot(Ca40): 11713.5911
omegadot(Ti44): 87.62828478
omegadot(Cr48): 6.064662425
omegadot(Fe52): 0.06310696052
omegadot(Ni56): 0.000136171123
number of steps taken: 9678
AMReX (25.11-47-gc4fcda1fb2ea) finalized
90 changes: 45 additions & 45 deletions unit_test/burn_cell/ci-benchmarks/he-burn-19am_unit_test.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Initializing AMReX (23.05-1038-gbd922c6216e0)...
AMReX (23.05-1038-gbd922c6216e0) initialized
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
AMReX (25.11-47-gc4fcda1fb2ea) initialized
starting the single zone burn...
reading in network electron-capture / beta-decay tables...
Maximum Time (s): 1e-05
Expand Down Expand Up @@ -46,53 +46,53 @@ RHS at t = 0
Ni56 2.574224319e-29
------------------------------------
successful? 1
- Hnuc = 1.324552639e+23
- added e = 1.324552639e+18
- final T = 3539825699
- Hnuc = 1.324544896e+23
- added e = 1.324544896e+18
- final T = 3539823486
------------------------------------
e initial = 1.396711859e+18
e final = 2.721264498e+18
e final = 2.721256755e+18
------------------------------------
new mass fractions:
H1 0.06140805092
He4 0.001406317534
C12 1.188197119e-07
N13 7.909402052e-11
N14 0.001127053623
O16 6.931646535e-06
Ne20 0.001267408673
Na23 5.838358901e-09
Mg24 0.001846400897
Al27 1.108967039e-07
Si28 0.3024943162
P31 2.222585402e-06
S32 0.3485154437
Ar36 0.1639550483
Ca40 0.1170346558
Ti44 0.0008747967244
Cr48 6.048749462e-05
Fe52 6.288550582e-07
Ni56 1.355779724e-09
H1 0.06140746232
He4 0.001405438558
C12 1.188941922e-07
N13 7.914334437e-11
N14 0.001127796195
O16 6.936214993e-06
Ne20 0.001268241136
Na23 5.834920863e-09
Mg24 0.001847642975
Al27 1.10886506e-07
Si28 0.3024939412
P31 2.221172998e-06
S32 0.3484994557
Ar36 0.1639525261
Ca40 0.1170518309
Ti44 0.0008751143826
Cr48 6.0526545e-05
Fe52 6.29481464e-07
Ni56 1.357689393e-09
------------------------------------
species creation rates:
omegadot(H1): -3859.194908
omegadot(He4): -49859.36825
omegadot(C12): -9999.988118
omegadot(H1): -3859.253768
omegadot(He4): -49859.45614
omegadot(C12): -9999.988111
omegadot(N13): -9999.999992
omegadot(N14): -9887.294638
omegadot(O16): -9999.306835
omegadot(Ne20): 126.7408673
omegadot(Na23): 0.0005838358901
omegadot(Mg24): 184.6400897
omegadot(Al27): 0.01108967039
omegadot(Si28): 30249.43162
omegadot(P31): 0.2222585402
omegadot(S32): 34851.54437
omegadot(Ar36): 16395.50483
omegadot(Ca40): 11703.46558
omegadot(Ti44): 87.47967244
omegadot(Cr48): 6.048749462
omegadot(Fe52): 0.06288550582
omegadot(Ni56): 0.0001355779724
number of steps taken: 733
AMReX (23.05-1038-gbd922c6216e0) finalized
omegadot(N14): -9887.220381
omegadot(O16): -9999.306379
omegadot(Ne20): 126.8241136
omegadot(Na23): 0.0005834920863
omegadot(Mg24): 184.7642975
omegadot(Al27): 0.0110886506
omegadot(Si28): 30249.39412
omegadot(P31): 0.2221172998
omegadot(S32): 34849.94557
omegadot(Ar36): 16395.25261
omegadot(Ca40): 11705.18309
omegadot(Ti44): 87.51143826
omegadot(Cr48): 6.0526545
omegadot(Fe52): 0.0629481464
omegadot(Ni56): 0.0001357689393
number of steps taken: 679
AMReX (25.11-47-gc4fcda1fb2ea) finalized
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AMReX (23.07-7-g88f03408f18a) initialized
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
AMReX (25.11-47-gc4fcda1fb2ea) initialized
starting the single zone burn...
Maximum Time (s): 0.001
State Density (g/cm^3): 1000000
Expand Down Expand Up @@ -33,4 +34,4 @@ omegadot(C12): 0.01497617246
omegadot(O16): 0.5494210118
omegadot(Fe56): 0
number of steps taken: 85669
AMReX (23.07-7-g88f03408f18a) finalized
AMReX (25.11-47-gc4fcda1fb2ea) finalized
Loading
Loading