Skip to content

Commit 894ea9c

Browse files
committed
add corrector validation to BackwardEuler
1 parent ff6af32 commit 894ea9c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

integration/BackwardEuler/be_integrator.H

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,27 @@ int single_step (BurnT& state, BeT& be, const amrex::Real dt)
5757

5858
// work with the current guess
5959

60+
if (integrator_rp::do_corrector_validation) {
61+
#ifdef SDC
62+
const amrex::Real rho_current = state.rho_orig + be.t * state.ydot_a[SRHO];
63+
const amrex::Real thresh = species_failure_tolerance * rho_current;
64+
#else
65+
const amrex::Real thresh = species_failure_tolerance;
66+
#endif
67+
bool fail{};
68+
for (int i = 1; i <= NumSpec; ++i) {
69+
if (be.y(i) < -thresh) {
70+
fail = true;
71+
break;
72+
}
73+
}
74+
75+
if (fail) {
76+
ierr = IERR_BAD_STATE_IN_CORRECTOR;
77+
break;
78+
}
79+
}
80+
6081
// get the ydots for our current guess of y
6182

6283
rhs(be.t, state, be, ydot);

integration/integrator_data.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ enum integrator_errors : std::int8_t {
3232
IERR_TOO_MUCH_ACCURACY_REQUESTED = -5,
3333
IERR_CORRECTOR_CONVERGENCE = -6,
3434
IERR_LU_DECOMPOSITION_ERROR = -7,
35+
IERR_BAD_STATE_IN_CORRECTOR = -8,
3536
IERR_ENTERED_NSE = -100
3637
};
3738

0 commit comments

Comments
 (0)