Skip to content

Commit

Permalink
fix func name
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 12, 2025
1 parent 1488a9a commit 9e86735
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
10 changes: 5 additions & 5 deletions EOS/helmholtz/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ void apply_electrons (T& state)

// hash locate this temperature and density
int jat = int((std::log10(state.T) - tlo) * tstpi) + 1;
jat = amrex::clamp(jat, 1, jmax-1) - 1;
jat = amrex::Clamp(jat, 1, jmax-1) - 1;
int iat = int((std::log10(din) - dlo) * dstpi) + 1;
iat = amrex::clamp(iat, 1, imax-1) - 1;
iat = amrex::Clamp(iat, 1, imax-1) - 1;

amrex::Real fi[36];

Expand Down Expand Up @@ -1005,7 +1005,7 @@ void single_iter_update (T& state, int var, int dvar,
amrex::Real xnew = x - (v - v_want) / dvdx;

// Don't let the temperature/density change by more than a factor of two
xnew = amrex::clamp(xnew, 0.5_rt * x, 2.0_rt * x);
xnew = amrex::Clamp(xnew, 0.5_rt * x, 2.0_rt * x);

// Don't let us freeze/evacuate
xnew = amrex::max(smallx, xnew);
Expand Down Expand Up @@ -1120,8 +1120,8 @@ void double_iter_update (T& state, int var1, int var2,

// Don't let the temperature or density change by more
// than a factor of two
tnew = amrex::clamp(tnew, 0.5e0_rt * told, 2.0e0_rt * told);
rnew = amrex::clamp(rnew, 0.5e0_rt * rold, 2.0e0_rt * rold);
tnew = amrex::Clamp(tnew, 0.5e0_rt * told, 2.0e0_rt * told);
rnew = amrex::Clamp(rnew, 0.5e0_rt * rold, 2.0e0_rt * rold);

// Don't let us freeze or evacuate
tnew = amrex::max(EOSData::mintemp, tnew);
Expand Down
2 changes: 1 addition & 1 deletion integration/BackwardEuler/be_integrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int be_integrator (BurnT& state, BeT& be)
// backward-Euler has a local truncation error of dt**2

amrex::Real dt_new = dt_sub * std::sqrt(1.0_rt / rel_error);
dt_sub = amrex::clamp(dt_new, dt_sub / 2.0, 2.0 * dt_sub);
dt_sub = amrex::Clamp(dt_new, dt_sub / 2.0, 2.0 * dt_sub);

} else {

Expand Down
2 changes: 1 addition & 1 deletion integration/ForwardEuler/actual_integrator.H
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void clean_state (const amrex::Real time, IntT& int_state, BurnT& state)

// Ensure that the temperature always stays within reasonable limits.

state.T = amrex::clamp(state.T, EOSData::mintemp, integrator_rp::MAX_TEMP);
state.T = amrex::Clamp(state.T, EOSData::mintemp, integrator_rp::MAX_TEMP);

}

Expand Down
2 changes: 1 addition & 1 deletion integration/RKC/rkc.H
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ int rkclow (BurnT& state, RkcT& rstate)
}
}
absh = std::max(0.1_rt, fac) * absh;
absh = amrex::clamp(absh, hmin, rstate.hmax);
absh = amrex::Clamp(absh, hmin, rstate.hmax);
errold = err;
hold = h;
h = tdir * absh;
Expand Down
2 changes: 1 addition & 1 deletion integration/VODE/vode_dvhin.H
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void dvhin (BurnT& state, DvodeT& vstate, amrex::Real& H0, int& NITER, int& IER)

// Iteration done. Apply bounds and bias factor. Then exit.
H0 = hnew * 0.5_rt;
H0 = amrex::clamp(H0, HLB, HUB);
H0 = amrex::Clamp(H0, HLB, HUB);

}

Expand Down
2 changes: 1 addition & 1 deletion integration/integrator_type_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void clean_state(const amrex::Real time, BurnT& state, T& int_state)
if (integrator_rp::do_species_clip) {
for (int n = 1; n <= NumSpec; ++n) {
// we use 1-based indexing, so we need to offset SFS
int_state.y(SFS+n) = amrex::clamp(int_state.y(SFS+n),
int_state.y(SFS+n) = amrex::Clamp(int_state.y(SFS+n),
state.rho * integrator_rp::SMALL_X_SAFE, state.rho);
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration/integrator_type_strang.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void clean_state (const amrex::Real time, BurnT& state, I& int_state)

if (integrator_rp::do_species_clip) {
for (int n = 1; n <= NumSpec; ++n) {
int_state.y(n) = amrex::clamp(int_state.y(n), integrator_rp::SMALL_X_SAFE, 1.0_rt);
int_state.y(n) = amrex::Clamp(int_state.y(n), integrator_rp::SMALL_X_SAFE, 1.0_rt);
}
}

Expand Down
4 changes: 2 additions & 2 deletions integration/nse_update_sdc.H
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void sdc_nse_burn(BurnT& state, const amrex::Real dt) {

amrex::Real sum_X{0.0_rt};
for (auto & xn : nse_state.X) {
xn = amrex::clamp(xn, small_x, 1.0_rt);
xn = amrex::Clamp(xn, small_x, 1.0_rt);
sum_X += xn;
}

Expand Down Expand Up @@ -583,7 +583,7 @@ void sdc_nse_burn(BurnT& state, const amrex::Real dt) {

amrex::Real sum_X{0.0_rt};
for (auto & xn : nse_state.xn) {
xn = amrex::clamp(xn, small_x, 1.0_rt);
xn = amrex::Clamp(xn, small_x, 1.0_rt);
sum_X += xn;
}

Expand Down
2 changes: 1 addition & 1 deletion integration/utils/initial_timestep.H
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ amrex::Real initial_react_dt (BurnT& burn_state, IntT& int_state,
// Save the final timestep, with a bias factor.

amrex::Real dt = h / 2.0_rt;
dt = amrex::clamp(h, hL, hU);
dt = amrex::Clamp(h, hL, hU);

dt = amrex::min(dt, integrator_rp::ode_max_dt);

Expand Down
2 changes: 1 addition & 1 deletion nse_solver/nse_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in,

// update the temperature and abar

T = amrex::clamp(T + dT, 0.25 * T, 4.0 * T);
T = amrex::Clamp(T + dT, 0.25 * T, 4.0 * T);
abar = eos_state.abar;

// update mu_p and mu_n
Expand Down
8 changes: 4 additions & 4 deletions nse_tabular/nse_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in, const amrex::Re
+ Ye * eos_state.dedZ * dabar_dT);

// update the temperature
T = amrex::clamp(T + dT, 0.25 * T, 4.0 * T);
T = amrex::Clamp(T + dT, 0.25 * T, 4.0 * T);

// check convergence

Expand Down Expand Up @@ -176,7 +176,7 @@ nse_rho_abar_from_e(const amrex::Real T, const amrex::Real e_in, const amrex::Re
+ Ye * eos_state.dedZ * dabar_drho);

// update the density
rho = amrex::clamp(rho + drho, 0.25 * rho, 4.0 * rho);
rho = amrex::Clamp(rho + drho, 0.25 * rho, 4.0 * rho);

// check convergence

Expand Down Expand Up @@ -267,7 +267,7 @@ nse_T_abar_from_p(const amrex::Real rho, const amrex::Real p_in, const amrex::Re
+ Ye * eos_state.dpdZ * dabar_dT);

// update the temperature
T = amrex::clamp(T + dT, 0.25 * T, 4.0 * T);
T = amrex::Clamp(T + dT, 0.25 * T, 4.0 * T);

// check convergence

Expand Down Expand Up @@ -358,7 +358,7 @@ nse_rho_abar_from_p(const amrex::Real T, const amrex::Real p_in, const amrex::Re
+ Ye * eos_state.dpdZ * dabar_drho);

// update the density
rho = amrex::clamp(rho + drho, 0.25 * rho, 4.0 * rho);
rho = amrex::Clamp(rho + drho, 0.25 * rho, 4.0 * rho);

// check convergence

Expand Down
40 changes: 20 additions & 20 deletions nse_tabular/nse_table.H
Original file line number Diff line number Diff line change
Expand Up @@ -405,23 +405,23 @@ void nse_interp(nse_table_t& nse_state, bool skip_X_fill=false) {
amrex::Real rmin = nse_table_size::logrho_min;
amrex::Real rmax = nse_table_size::logrho_max;

rholog = amrex::clamp(rholog, rmin, rmax);
rholog = amrex::Clamp(rholog, rmin, rmax);
}

amrex::Real tlog = std::log10(nse_state.T);
{
amrex::Real tmin = nse_table_size::logT_min;
amrex::Real tmax = nse_table_size::logT_max;

tlog = amrex::clamp(tlog, tmin, tmax);
tlog = amrex::Clamp(tlog, tmin, tmax);
}

amrex::Real yet = nse_state.Ye;
{
amrex::Real yemin = nse_table_size::ye_min;
amrex::Real yemax = nse_table_size::ye_max;

yet = amrex::clamp(yet, yemin, yemax);
yet = amrex::Clamp(yet, yemin, yemax);
}

if (nse_table_interp_linear) {
Expand All @@ -443,7 +443,7 @@ void nse_interp(nse_table_t& nse_state, bool skip_X_fill=false) {
for (int n = 1; n <= NumSpec; n++) {
amrex::Real _X = trilinear(ir1, it1, ic1, rholog, tlog, yet,
[=] (const int i) {return massfractab(n, i);});
nse_state.X[n-1] = amrex::clamp(_X, 0.0_rt, 1.0_rt);
nse_state.X[n-1] = amrex::Clamp(_X, 0.0_rt, 1.0_rt);
}
}

Expand All @@ -455,13 +455,13 @@ void nse_interp(nse_table_t& nse_state, bool skip_X_fill=false) {
// so we offset one to the left and also ensure that we don't go off the table

int ir0 = nse_get_logrho_index(rholog) - 1;
ir0 = amrex::clamp(ir0, 1, nse_table_size::nden-3);
ir0 = amrex::Clamp(ir0, 1, nse_table_size::nden-3);

int it0 = nse_get_logT_index(tlog) - 1;
it0 = amrex::clamp(it0, 1, nse_table_size::ntemp-3);
it0 = amrex::Clamp(it0, 1, nse_table_size::ntemp-3);

int ic0 = nse_get_ye_index(yet) - 1;
ic0 = amrex::clamp(ic0, 1, nse_table_size::nye-3);
ic0 = amrex::Clamp(ic0, 1, nse_table_size::nye-3);

nse_state.abar = tricubic(ir0, it0, ic0, rholog, tlog, yet, abartab);
nse_state.bea = tricubic(ir0, it0, ic0, rholog, tlog, yet, beatab);
Expand All @@ -476,7 +476,7 @@ void nse_interp(nse_table_t& nse_state, bool skip_X_fill=false) {
for (int n = 1; n <= NumSpec; n++) {
amrex::Real _X = tricubic(ir0, it0, ic0, rholog, tlog, yet,
[=] (const int i) {return massfractab(n, i);});
nse_state.X[n-1] = amrex::clamp(_X, 0.0_rt, 1.0_rt);
nse_state.X[n-1] = amrex::Clamp(_X, 0.0_rt, 1.0_rt);
}
}
}
Expand All @@ -498,33 +498,33 @@ nse_interp_dT(const amrex::Real temp, const amrex::Real rho, const amrex::Real y
amrex::Real rmin = nse_table_size::logrho_min;
amrex::Real rmax = nse_table_size::logrho_max;

rholog = amrex::clamp(rholog, rmin, rmax);
rholog = amrex::Clamp(rholog, rmin, rmax);
}

amrex::Real tlog = std::log10(temp);
{
amrex::Real tmin = nse_table_size::logT_min;
amrex::Real tmax = nse_table_size::logT_max;

tlog = amrex::clamp(tlog, tmin, tmax);
tlog = amrex::Clamp(tlog, tmin, tmax);
}

amrex::Real yet = ye;
{
amrex::Real yemin = nse_table_size::ye_min;
amrex::Real yemax = nse_table_size::ye_max;

yet = amrex::clamp(yet, yemin, yemax);
yet = amrex::Clamp(yet, yemin, yemax);
}

int ir0 = nse_get_logrho_index(rholog) - 1;
ir0 = amrex::clamp(ir0, 1, nse_table_size::nden-3);
ir0 = amrex::Clamp(ir0, 1, nse_table_size::nden-3);

int it0 = nse_get_logT_index(tlog) - 1;
it0 = amrex::clamp(it0, 1, nse_table_size::ntemp-3);
it0 = amrex::Clamp(it0, 1, nse_table_size::ntemp-3);

int ic0 = nse_get_ye_index(yet) - 1;
ic0 = amrex::clamp(ic0, 1, nse_table_size::nye-3);
ic0 = amrex::Clamp(ic0, 1, nse_table_size::nye-3);

// note: this is returning the derivative wrt log10(T), so we need to
// convert to d/dT
Expand All @@ -551,33 +551,33 @@ nse_interp_drho(const amrex::Real temp, const amrex::Real rho, const amrex::Real
amrex::Real rmin = nse_table_size::logrho_min;
amrex::Real rmax = nse_table_size::logrho_max;

rholog = amrex::clamp(rholog, rmin, rmax);
rholog = amrex::Clamp(rholog, rmin, rmax);
}

amrex::Real tlog = std::log10(temp);
{
amrex::Real tmin = nse_table_size::logT_min;
amrex::Real tmax = nse_table_size::logT_max;

tlog = amrex::clamp(tlog, tmin, tmax);
tlog = amrex::Clamp(tlog, tmin, tmax);
}

amrex::Real yet = ye;
{
amrex::Real yemin = nse_table_size::ye_min;
amrex::Real yemax = nse_table_size::ye_max;

yet = amrex::clamp(yet, yemin, yemax);
yet = amrex::Clamp(yet, yemin, yemax);
}

int ir0 = nse_get_logrho_index(rholog) - 1;
ir0 = amrex::clamp(ir0, 1, nse_table_size::nden-3);
ir0 = amrex::Clamp(ir0, 1, nse_table_size::nden-3);

int it0 = nse_get_logT_index(tlog) - 1;
it0 = amrex::clamp(it0, 1, nse_table_size::ntemp-3);
it0 = amrex::Clamp(it0, 1, nse_table_size::ntemp-3);

int ic0 = nse_get_ye_index(yet) - 1;
ic0 = amrex::clamp(ic0, 1, nse_table_size::nye-3);
ic0 = amrex::Clamp(ic0, 1, nse_table_size::nye-3);

// note: this is returning the derivative wrt log10(rho), so we need to
// convert to d/drho
Expand Down

0 comments on commit 9e86735

Please sign in to comment.