Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update true-SDC to be in sync with upcoming Castro cleaning #1338

Merged
merged 5 commits into from
Sep 21, 2023
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
19 changes: 0 additions & 19 deletions integration/VODE/vode_dvhin.H
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,6 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
// Set an upper bound on h based on vstate.tout-vstate.t and the initial Y and YDOT.
Real HUB = PT1 * TDIST;

#ifdef TRUE_SDC
for (int i = 1; i <= int_neqs; ++i) {
Real atol;
if (i == 1) {
atol = vstate.atol_dens;
} else if (i == NumSpec+2) {
atol = vstate.atol_enuc;
} else {
atol = vstate.atol_spec;
}
Real DELYI = PT1 * std::abs(vstate.yh(i,1)) + atol;
Real AFI = std::abs(vstate.yh(i,2));
if (AFI * HUB > DELYI) {
HUB = DELYI / AFI;
}
}

#else
for (int i = 1; i <= int_neqs; ++i) {
Real atol = i <= NumSpec ? vstate.atol_spec : vstate.atol_enuc;
Real DELYI = PT1 * std::abs(vstate.yh(i,1)) + atol;
Expand All @@ -70,7 +52,6 @@ void dvhin (BurnT& state, DvodeT& vstate, Real& H0, int& NITER, int& IER)
HUB = DELYI / AFI;
}
}
#endif

// Set initial guess for h as geometric mean of upper and lower bounds.
int iter = 0;
Expand Down
24 changes: 0 additions & 24 deletions integration/VODE/vode_dvode.H
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,12 @@ int dvode (BurnT& state, DvodeT& vstate)
vstate.NQ = 1;
vstate.H = 1.0_rt;

#ifdef TRUE_SDC
vstate.ewt(1) = vstate.rtol_dens * std::abs(vstate.yh(1,1)) + vstate.atol_dens;
vstate.ewt(1) = 1.0_rt / vstate.ewt(1);

for (int i = 2; i <= NumSpec+1; ++i) {
vstate.ewt(i) = vstate.rtol_spec * std::abs(vstate.yh(i,1)) + vstate.atol_spec;
vstate.ewt(i) = 1.0_rt / vstate.ewt(i);
}
vstate.ewt(NumSpec+2) = vstate.rtol_enuc * std::abs(vstate.yh(NumSpec+2,1)) + vstate.atol_enuc;
vstate.ewt(NumSpec+2) = 1.0_rt / vstate.ewt(NumSpec+2);
#else
for (int i = 1; i <= NumSpec; ++i) {
vstate.ewt(i) = vstate.rtol_spec * std::abs(vstate.yh(i,1)) + vstate.atol_spec;
vstate.ewt(i) = 1.0_rt / vstate.ewt(i);
}
vstate.ewt(NumSpec+1) = vstate.rtol_enuc * std::abs(vstate.yh(NumSpec+1,1)) + vstate.atol_enuc;
vstate.ewt(NumSpec+1) = 1.0_rt / vstate.ewt(NumSpec+1);
#endif

// Call DVHIN to set initial step size H0 to be attempted.
H0 = 0.0_rt;
Expand Down Expand Up @@ -157,24 +145,12 @@ int dvode (BurnT& state, DvodeT& vstate)

}

#ifdef TRUE_SDC
vstate.ewt(1) = vstate.rtol_dens * std::abs(vstate.yh(1,1)) + vstate.atol_dens;
vstate.ewt(1) = 1.0_rt / vstate.ewt(1);

for (int i = 2; i <= NumSpec+1; ++i) {
vstate.ewt(i) = vstate.rtol_spec * std::abs(vstate.yh(i,1)) + vstate.atol_spec;
vstate.ewt(i) = 1.0_rt / vstate.ewt(i);
}
vstate.ewt(NumSpec+2) = vstate.rtol_enuc * std::abs(vstate.yh(NumSpec+2,1)) + vstate.atol_enuc;
vstate.ewt(NumSpec+2) = 1.0_rt / vstate.ewt(NumSpec+2);
#else
for (int i = 1; i <= NumSpec; ++i) {
vstate.ewt(i) = vstate.rtol_spec * std::abs(vstate.yh(i,1)) + vstate.atol_spec;
vstate.ewt(i) = 1.0_rt / vstate.ewt(i);
}
vstate.ewt(NumSpec+1) = vstate.rtol_enuc * std::abs(vstate.yh(NumSpec+1,1)) + vstate.atol_enuc;
vstate.ewt(NumSpec+1) = 1.0_rt / vstate.ewt(NumSpec+1);
#endif

}
else {
Expand Down
24 changes: 3 additions & 21 deletions integration/VODE/vode_dvstep.H
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int dvstep (BurnT& state, DvodeT& vstate)
y_save(i) = vstate.y(i);
}
#endif
#ifdef SIMPLIFIED_SDC
#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)
Real rho_old = state.rho_orig + TOLD * state.ydot_a[SRHO];
for (int i = 1; i <= int_neqs; ++i) {
y_save(i) = vstate.y(i);
Expand Down Expand Up @@ -224,7 +224,7 @@ int dvstep (BurnT& state, DvodeT& vstate)

bool valid_update = true;

#ifdef SIMPLIFIED_SDC
#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)
if (vstate.y(SEINT+1) < 0.0_rt) {
valid_update = false;
}
Expand Down Expand Up @@ -271,7 +271,7 @@ int dvstep (BurnT& state, DvodeT& vstate)

#endif

#ifdef SIMPLIFIED_SDC
#if defined(SIMPLIFIED_SDC) || defined(TRUE_SDC)

// these are basically the same checks as with Strang
// above, except now we are evolving rhoX instead of X.
Expand Down Expand Up @@ -303,24 +303,6 @@ int dvstep (BurnT& state, DvodeT& vstate)

#endif

#ifdef TRUE_SDC
// as above, we want to make sure that the mass fractions stay bounded, but we are
// evolving:
//
// y(1) = density
// y(2:2+NumSpec-1) = rho X
// y(NumSpec+2) = rho e

if (vstate.y(1+i) < -species_failure_tolerance * vstate.y(1)) {
valid_update = false;
}

if (vstate.y(1+i) > (1.0_rt + species_failure_tolerance) * vstate.y(1)) {
valid_update = false;
}
#endif


}

// The corrector has converged (NFLAG = 0). The local error test is
Expand Down
4 changes: 2 additions & 2 deletions integration/integrator_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const int INT_NEQS = SVAR_EVOLVE;
#endif

#ifdef TRUE_SDC
const int INT_NEQS = NumSpec + 2;
const int INT_NEQS = NumSpec + 1;
#endif


Expand Down Expand Up @@ -56,7 +56,7 @@ constexpr int integrator_neqs ()
#endif

#ifdef TRUE_SDC
int_neqs = NumSpec + 2;
int_neqs = NumSpec + 1;
#endif

return int_neqs;
Expand Down
6 changes: 0 additions & 6 deletions interfaces/burn_type.H
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ struct burn_t
// dx is useful for estimating timescales for equilibriation
Real dx;

#ifdef TRUE_SDC
Real E_var;
Real mom[3];
Real f_source[NumSpec+2];
#endif

Real mu;
Real mu_e;
Real y_e;
Expand Down