Skip to content

Commit 83c6118

Browse files
authored
Merge branch 'development' into vode_success_normalization
2 parents 5e1de1e + 485aaa0 commit 83c6118

File tree

13 files changed

+214
-169
lines changed

13 files changed

+214
-169
lines changed

Docs/source/ode_integrators.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fractions. Looser than this can produce large errors.
248248
Controlling Species $\sum_k X_k = 1$
249249
====================================
250250

251-
.. index:: integrator.renormalize_abundances, integrator.SMALL_X_SAFE, integrator.do_species_clip
251+
.. index:: integrator.renormalize_abundances, integrator.SMALL_X_SAFE, integrator.do_species_clip, integrator.do_corrector_validation
252252

253253
The ODE integrators don't know about the constraint that
254254

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

277277
* ``integrator.do_species_clip`` : this enforces that the mass fractions
278-
all in $[\mathtt{SMALL\_X\_SAFE}, 1.0]$.
279-
280-
This is enabled by default.
281-
278+
all in $[\mathtt{SMALL\_X\_SAFE}, 1.0]$ before calling the network righthand
279+
side function.
280+
281+
This is off by default. Turning this on can sometimes make the integrator
282+
work a lot harder.
283+
284+
* ``integrator.do_corrector_validation`` : in the nonlinear solve
285+
corrector loop, when we get a corrected integration state, do we
286+
check to make sure the mass fractions are valid before calling the
287+
righthand function? This is needed in some cases if
288+
``integrator.do_species_clip`` is disabled. Note: this is not
289+
implemented for every integrator.
282290

283291

284292
Retry Mechanism

EOS/helmholtz/actual_eos.H

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <iostream>
77
#include <fstream>
88
#include <sstream>
9+
#include <numbers>
10+
911
#include <AMReX.H>
1012
#include <AMReX_REAL.H>
1113
#include <AMReX_ParallelDescriptor.H>

integration/VODE/vode_dvnlsd.H

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,36 @@ amrex::Real dvnlsd (int& NFLAG, BurnT& state, DvodeT& vstate)
145145
vstate.y(i) = vstate.yh(i,1) + vstate.acor(i);
146146
}
147147

148+
// sometime VODE goes way off tangent. If these mass fractions
149+
// are really bad, then let's just bail now
150+
151+
if (integrator_rp::do_corrector_validation && !integrator_rp::use_number_densities) {
152+
#ifdef SDC
153+
const amrex::Real rho_current = state.rho_orig + vstate.tn * state.ydot_a[SRHO];
154+
const amrex::Real thresh = species_failure_tolerance * rho_current;
155+
#else
156+
const amrex::Real thresh = species_failure_tolerance;
157+
#endif
158+
bool fail{};
159+
for (int i = 1; i <= NumSpec; ++i) {
160+
if (vstate.y(i) < -thresh) {
161+
fail = true;
162+
break;
163+
}
164+
}
165+
166+
// this resets the flags in the same fashion as is done above
167+
// for a singular matrix. ICF = 2 means "unrecoverable error",
168+
// IPUP = 1 forces a Jacobian reevaluation. The return value,
169+
// ACNRM is ignored in this case (since NFLAG != 0)
170+
if (fail) {
171+
NFLAG = -1;
172+
vstate.ICF = 2;
173+
vstate.IPUP = 1;
174+
return ACNRM;
175+
}
176+
}
177+
148178
// Test for convergence. If M > 0, an estimate of the convergence
149179
// rate constant is stored in CRATE, and this is used in the test.
150180

integration/_parameters

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ retry_atol_enuc real -1
9191

9292
# in the clean_state process, do we clip the species such that they
9393
# are in [0, 1]?
94-
do_species_clip bool 1
94+
do_species_clip bool 0
95+
96+
# in the corrector loop, do we check if the predicted state is
97+
# valid (X > 0) before calling the RHS?
98+
do_corrector_validation bool 1
9599

96100
# flag for turning on the use of number densities for all species
97101
use_number_densities bool 0

unit_test/burn_cell/ci-benchmarks/aprox13_RKC_unit_test.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Initializing AMReX (23.05-658-g0165b6743355)...
2-
AMReX (23.05-658-g0165b6743355) initialized
1+
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
2+
AMReX (25.11-47-gc4fcda1fb2ea) initialized
33
starting the single zone burn...
44
Maximum Time (s): 0.01
55
State Density (g/cm^3): 1000000
@@ -70,4 +70,4 @@ omegadot(Cr48): 3.272104685e-12
7070
omegadot(Fe52): 7.126141581e-18
7171
omegadot(Ni56): 1.22471994e-24
7272
number of steps taken: 255
73-
AMReX (23.05-658-g0165b6743355) finalized
73+
AMReX (25.11-47-gc4fcda1fb2ea) finalized
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Initializing AMReX (25.12-25-g10b67a795031)...
2-
AMReX (25.12-25-g10b67a795031) initialized
1+
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
2+
AMReX (25.11-47-gc4fcda1fb2ea) initialized
33
starting the single zone burn...
44
reading in network electron-capture / beta-decay tables...
55
Maximum Time (s): 0.01
@@ -30,37 +30,37 @@ RHS at t = 0
3030
S32 1323519.174
3131
------------------------------------
3232
successful? 1
33-
- Hnuc = 4.572458836e+19
34-
- added e = 4.572458836e+17
35-
- final T = 6740499652
33+
- Hnuc = 4.397909277e+19
34+
- added e = 4.397909277e+17
35+
- final T = 6656291303
3636
------------------------------------
3737
e initial = 5.995956082e+17
38-
e final = 1.056841492e+18
38+
e final = 1.039386536e+18
3939
------------------------------------
4040
new mass fractions:
41-
H1 0.008875172349
42-
He4 9.999999998e-31
43-
O16 6.258606287e-07
44-
O20 0.009862665409
45-
F20 0.009861311457
46-
Ne20 8.532947059e-14
47-
Mg24 1.247632983e-06
48-
Al27 1.79296072e-18
49-
Si28 0.3055707459
50-
P31 9.999999998e-31
51-
S32 0.6658282314
41+
H1 0.009307048983
42+
He4 3.598820253e-13
43+
O16 6.945042998e-07
44+
O20 0.009997687144
45+
F20 0.009996314357
46+
Ne20 1.027891736e-13
47+
Mg24 1.24621466e-06
48+
Al27 1.645253981e-18
49+
Si28 0.3262434305
50+
P31 8.175490055e-14
51+
S32 0.6444535783
5252
------------------------------------
5353
species creation rates:
54-
omegadot(H1): -0.1124827651
54+
omegadot(H1): -0.06929510166
5555
omegadot(He4): -3
56-
omegadot(O16): -49.99993741
57-
omegadot(O20): -0.01373345906
58-
omegadot(F20): -0.01386885428
56+
omegadot(O16): -49.99993055
57+
omegadot(O20): -0.0002312855859
58+
omegadot(F20): -0.0003685642773
5959
omegadot(Ne20): -30
60-
omegadot(Mg24): -9.999875237
60+
omegadot(Mg24): -9.999875379
6161
omegadot(Al27): -1
62-
omegadot(Si28): 29.55707459
62+
omegadot(Si28): 31.62434305
6363
omegadot(P31): -1
64-
omegadot(S32): 65.58282314
65-
number of steps taken: 16498
66-
AMReX (25.12-25-g10b67a795031) finalized
64+
omegadot(S32): 63.44535783
65+
number of steps taken: 598
66+
AMReX (25.11-47-gc4fcda1fb2ea) finalized
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Initializing AMReX (23.05-1038-gbd922c6216e0)...
2-
AMReX (23.05-1038-gbd922c6216e0) initialized
1+
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
2+
AMReX (25.11-47-gc4fcda1fb2ea) initialized
33
starting the single zone burn...
44
reading in network electron-capture / beta-decay tables...
55
Maximum Time (s): 1e-05
@@ -46,53 +46,53 @@ RHS at t = 0
4646
Ni56 2.574224319e-29
4747
------------------------------------
4848
successful? 1
49-
- Hnuc = 1.324591682e+23
50-
- added e = 1.324591682e+18
51-
- final T = 3539838349
49+
- Hnuc = 1.324591986e+23
50+
- added e = 1.324591986e+18
51+
- final T = 3539838445
5252
------------------------------------
5353
e initial = 1.396711859e+18
54-
e final = 2.721303541e+18
54+
e final = 2.721303845e+18
5555
------------------------------------
5656
new mass fractions:
57-
H1 0.0614041578
58-
He4 0.001390967515
59-
C12 1.194150996e-07
60-
N13 7.948320928e-11
61-
N14 0.001132572545
62-
O16 6.939462514e-06
63-
Ne20 0.001268664041
64-
Na23 5.77734127e-09
65-
Mg24 0.001851928121
66-
Al27 1.100081874e-07
67-
Si28 0.3024482452
68-
P31 2.19817828e-06
69-
S32 0.3484511353
70-
Ar36 0.1639686458
71-
Ca40 0.1171367255
72-
Ti44 0.0008763032297
73-
Cr48 6.064947631e-05
74-
Fe52 6.31118656e-07
75-
Ni56 1.361868236e-09
57+
H1 0.06140416809
58+
He4 0.001390777362
59+
C12 1.194102635e-07
60+
N13 7.947998734e-11
61+
N14 0.001132527207
62+
O16 6.938893863e-06
63+
Ne20 0.001268559515
64+
Na23 5.77607584e-09
65+
Mg24 0.001851806271
66+
Al27 1.099859099e-07
67+
Si28 0.3024474385
68+
P31 2.197872323e-06
69+
S32 0.3484525859
70+
Ar36 0.1639692923
71+
Ca40 0.117135911
72+
Ti44 0.0008762828478
73+
Cr48 6.064662425e-05
74+
Fe52 6.310696052e-07
75+
Ni56 1.36171123e-09
7676
------------------------------------
7777
species creation rates:
78-
omegadot(H1): -3859.58422
79-
omegadot(He4): -49860.90325
80-
omegadot(C12): -9999.988058
78+
omegadot(H1): -3859.583191
79+
omegadot(He4): -49860.92226
80+
omegadot(C12): -9999.988059
8181
omegadot(N13): -9999.999992
82-
omegadot(N14): -9886.742745
83-
omegadot(O16): -9999.306054
84-
omegadot(Ne20): 126.8664041
85-
omegadot(Na23): 0.000577734127
86-
omegadot(Mg24): 185.1928121
87-
omegadot(Al27): 0.01100081874
88-
omegadot(Si28): 30244.82452
89-
omegadot(P31): 0.219817828
90-
omegadot(S32): 34845.11353
91-
omegadot(Ar36): 16396.86458
92-
omegadot(Ca40): 11713.67255
93-
omegadot(Ti44): 87.63032297
94-
omegadot(Cr48): 6.064947631
95-
omegadot(Fe52): 0.0631118656
96-
omegadot(Ni56): 0.0001361868236
97-
number of steps taken: 9720
98-
AMReX (23.05-1038-gbd922c6216e0) finalized
82+
omegadot(N14): -9886.747279
83+
omegadot(O16): -9999.306111
84+
omegadot(Ne20): 126.8559515
85+
omegadot(Na23): 0.000577607584
86+
omegadot(Mg24): 185.1806271
87+
omegadot(Al27): 0.01099859099
88+
omegadot(Si28): 30244.74385
89+
omegadot(P31): 0.2197872323
90+
omegadot(S32): 34845.25859
91+
omegadot(Ar36): 16396.92923
92+
omegadot(Ca40): 11713.5911
93+
omegadot(Ti44): 87.62828478
94+
omegadot(Cr48): 6.064662425
95+
omegadot(Fe52): 0.06310696052
96+
omegadot(Ni56): 0.000136171123
97+
number of steps taken: 9678
98+
AMReX (25.11-47-gc4fcda1fb2ea) finalized
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Initializing AMReX (23.05-1038-gbd922c6216e0)...
2-
AMReX (23.05-1038-gbd922c6216e0) initialized
1+
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
2+
AMReX (25.11-47-gc4fcda1fb2ea) initialized
33
starting the single zone burn...
44
reading in network electron-capture / beta-decay tables...
55
Maximum Time (s): 1e-05
@@ -46,53 +46,53 @@ RHS at t = 0
4646
Ni56 2.574224319e-29
4747
------------------------------------
4848
successful? 1
49-
- Hnuc = 1.324552639e+23
50-
- added e = 1.324552639e+18
51-
- final T = 3539825699
49+
- Hnuc = 1.324544896e+23
50+
- added e = 1.324544896e+18
51+
- final T = 3539823486
5252
------------------------------------
5353
e initial = 1.396711859e+18
54-
e final = 2.721264498e+18
54+
e final = 2.721256755e+18
5555
------------------------------------
5656
new mass fractions:
57-
H1 0.06140805092
58-
He4 0.001406317534
59-
C12 1.188197119e-07
60-
N13 7.909402052e-11
61-
N14 0.001127053623
62-
O16 6.931646535e-06
63-
Ne20 0.001267408673
64-
Na23 5.838358901e-09
65-
Mg24 0.001846400897
66-
Al27 1.108967039e-07
67-
Si28 0.3024943162
68-
P31 2.222585402e-06
69-
S32 0.3485154437
70-
Ar36 0.1639550483
71-
Ca40 0.1170346558
72-
Ti44 0.0008747967244
73-
Cr48 6.048749462e-05
74-
Fe52 6.288550582e-07
75-
Ni56 1.355779724e-09
57+
H1 0.06140746232
58+
He4 0.001405438558
59+
C12 1.188941922e-07
60+
N13 7.914334437e-11
61+
N14 0.001127796195
62+
O16 6.936214993e-06
63+
Ne20 0.001268241136
64+
Na23 5.834920863e-09
65+
Mg24 0.001847642975
66+
Al27 1.10886506e-07
67+
Si28 0.3024939412
68+
P31 2.221172998e-06
69+
S32 0.3484994557
70+
Ar36 0.1639525261
71+
Ca40 0.1170518309
72+
Ti44 0.0008751143826
73+
Cr48 6.0526545e-05
74+
Fe52 6.29481464e-07
75+
Ni56 1.357689393e-09
7676
------------------------------------
7777
species creation rates:
78-
omegadot(H1): -3859.194908
79-
omegadot(He4): -49859.36825
80-
omegadot(C12): -9999.988118
78+
omegadot(H1): -3859.253768
79+
omegadot(He4): -49859.45614
80+
omegadot(C12): -9999.988111
8181
omegadot(N13): -9999.999992
82-
omegadot(N14): -9887.294638
83-
omegadot(O16): -9999.306835
84-
omegadot(Ne20): 126.7408673
85-
omegadot(Na23): 0.0005838358901
86-
omegadot(Mg24): 184.6400897
87-
omegadot(Al27): 0.01108967039
88-
omegadot(Si28): 30249.43162
89-
omegadot(P31): 0.2222585402
90-
omegadot(S32): 34851.54437
91-
omegadot(Ar36): 16395.50483
92-
omegadot(Ca40): 11703.46558
93-
omegadot(Ti44): 87.47967244
94-
omegadot(Cr48): 6.048749462
95-
omegadot(Fe52): 0.06288550582
96-
omegadot(Ni56): 0.0001355779724
97-
number of steps taken: 733
98-
AMReX (23.05-1038-gbd922c6216e0) finalized
82+
omegadot(N14): -9887.220381
83+
omegadot(O16): -9999.306379
84+
omegadot(Ne20): 126.8241136
85+
omegadot(Na23): 0.0005834920863
86+
omegadot(Mg24): 184.7642975
87+
omegadot(Al27): 0.0110886506
88+
omegadot(Si28): 30249.39412
89+
omegadot(P31): 0.2221172998
90+
omegadot(S32): 34849.94557
91+
omegadot(Ar36): 16395.25261
92+
omegadot(Ca40): 11705.18309
93+
omegadot(Ti44): 87.51143826
94+
omegadot(Cr48): 6.0526545
95+
omegadot(Fe52): 0.0629481464
96+
omegadot(Ni56): 0.0001357689393
97+
number of steps taken: 679
98+
AMReX (25.11-47-gc4fcda1fb2ea) finalized

unit_test/burn_cell/ci-benchmarks/triple_alpha_plus_cago_FE_unit_test.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
AMReX (23.07-7-g88f03408f18a) initialized
1+
Initializing AMReX (25.11-47-gc4fcda1fb2ea)...
2+
AMReX (25.11-47-gc4fcda1fb2ea) initialized
23
starting the single zone burn...
34
Maximum Time (s): 0.001
45
State Density (g/cm^3): 1000000
@@ -33,4 +34,4 @@ omegadot(C12): 0.01497617246
3334
omegadot(O16): 0.5494210118
3435
omegadot(Fe56): 0
3536
number of steps taken: 85669
36-
AMReX (23.07-7-g88f03408f18a) finalized
37+
AMReX (25.11-47-gc4fcda1fb2ea) finalized

0 commit comments

Comments
 (0)