Skip to content

Commit 9fd4327

Browse files
committed
Merge branch 'development' into xrb_iginition
2 parents 6e20cca + 485aaa0 commit 9fd4327

32 files changed

+10525
-169
lines changed

.github/workflows/nse_net.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,23 @@ jobs:
6565
run: |
6666
cd unit_test/nse_net_cell/make_table
6767
diff -I "^Initializing AMReX" -I "^AMReX" -I "^reading in reaclib rates" test.out ci-benchmarks/nse_net_make_table_unit_test.out
68+
69+
- name: Compile, nse_compatibility (NSE_NET, ase-test, integration)
70+
run: |
71+
cd nse_solver/nse_compatibility
72+
make realclean
73+
make NETWORK_DIR=he-burn/ase-test -j 4
74+
75+
- name: Run nse_compatibility (NSE_NET, ase-test, integration)
76+
run: |
77+
cd nse_solver/nse_compatibility
78+
./main3d.gnu.ex inputs_nse_compatibility amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out
79+
80+
- name: Print backtrace
81+
if: ${{ failure() && hashFiles('nse_solver/nse_compatibility/Backtrace.0') != '' }}
82+
run: cat nse_solver/nse_compatibility/Backtrace.0
83+
84+
- name: Compare to stored output (NSE_NET, ase-test, integration)
85+
run: |
86+
cd nse_solver/nse_compatibility
87+
diff -I "^Initializing AMReX" -I "^AMReX" -I "^reading in reaclib rates" test.out ci-benchmarks/nse_net_integration_unit_test.out

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
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CEXE_headers += network_properties.H
2+
3+
ifeq ($(USE_REACT),TRUE)
4+
CEXE_sources += actual_network_data.cpp
5+
CEXE_headers += actual_network.H
6+
CEXE_headers += tfactors.H
7+
CEXE_headers += interp_tools.H
8+
CEXE_headers += partition_functions.H
9+
CEXE_sources += partition_functions_data.cpp
10+
CEXE_headers += actual_rhs.H
11+
CEXE_headers += reaclib_rates.H
12+
CEXE_headers += table_rates.H
13+
CEXE_sources += table_rates_data.cpp
14+
CEXE_headers += temperature_table_rates.H
15+
USE_SCREENING = TRUE
16+
USE_NEUTRINOS = TRUE
17+
endif
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@namespace: network
2+
3+
disable_p_C12_to_N13_reaclib int 0
4+
disable_He4_N13_to_p_O16_reaclib int 0

0 commit comments

Comments
 (0)