Skip to content

Commit

Permalink
fix the scaling of the finite-difference approximation to the derivs
Browse files Browse the repository at this point in the history
and also make it tau factor able to be set at runtime
  • Loading branch information
zingale committed Dec 3, 2023
1 parent 224b96c commit 0974c92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions integration/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ scale_system integer 0
# for the NSE update predictor-corrector, how many iterations
# do we take to get the new time NSE state
nse_iters integer 3

# for SDC+NSE, when estimating the derivatives of the NSE table
# quantities, what fraction of dt do we use for the finite-difference
# estimate
nse_deriv_dt_factor real 0.05
10 changes: 6 additions & 4 deletions integration/nse_update_simplified_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void nse_derivs(const Real rho0, const Real rhoe0, const Real *rhoaux0,

// evolve for eps * dt;

Real tau = 0.05 * dt;
Real tau = integrator_rp::nse_deriv_dt_factor * dt;

Real rho1 = rho0 + tau * ydot_a[SRHO];
Real rhoe1 = rhoe0 + tau * ydot_a[SEINT] + tau * rhoe_source;
Expand Down Expand Up @@ -135,6 +135,8 @@ void nse_derivs(const Real rho0, const Real rhoe0, const Real *rhoaux0,
skip_X_fill);


// construct the finite-difference approximation to the derivatives

// note that abar, (B/A) here have already seen advection
// implicitly

Expand All @@ -144,12 +146,12 @@ void nse_derivs(const Real rho0, const Real rhoe0, const Real *rhoaux0,
Real rho_abar_tilde = rho1 * abar1_out - tau * ydot_a[SFX+iabar];
Real rho_dabar = rho_abar_tilde - rho0 * abar0_out; // this is MeV / nucleon * g / cm**3

drhoedt = rho_dBEA * C::MeV2eV * C::ev2erg * C::n_A / dt;
drhoedt = rho_dBEA * C::MeV2eV * C::ev2erg * C::n_A / tau;
drhoedt -= rho0 * (enu + snu);

drhoauxdt[iabar] = rho_dabar / dt;
drhoauxdt[iabar] = rho_dabar / tau;
drhoauxdt[iye] = rho0 * dyedt0;
drhoauxdt[ibea] = rho_dBEA / dt;
drhoauxdt[ibea] = rho_dBEA / tau;

}

Expand Down

0 comments on commit 0974c92

Please sign in to comment.