Skip to content

Commit

Permalink
make some helmeos stuff constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Nov 13, 2023
1 parent 3fe63e8 commit ed7d63a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions EOS/helmholtz/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ void apply_electrons (T& state)

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

Real fi[36];

Expand Down Expand Up @@ -1316,8 +1316,6 @@ void actual_eos_init ()
dtol = eos_dtol;

// read the helmholtz free energy table
itmax = imax;
jtmax = jmax;
tlo = 3.0e0_rt;
thi = 13.0e0_rt;
tstp = (thi - tlo) / ((Real) (jmax-1));
Expand Down Expand Up @@ -1508,4 +1506,3 @@ bool is_input_valid (I input)
}

#endif

12 changes: 6 additions & 6 deletions EOS/helmholtz/actual_eos_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace helmholtz

// for the tables

const int imax = 541;
const int jmax = 201;
constexpr int imax = 541;
constexpr int jmax = 201;

extern AMREX_GPU_MANAGED int itmax;
extern AMREX_GPU_MANAGED int jtmax;
Expand Down Expand Up @@ -57,10 +57,10 @@ namespace helmholtz
extern AMREX_GPU_MANAGED amrex::Real dd2i_sav[imax];

// 2006 CODATA physical constants
const amrex::Real h = 6.6260689633e-27;
const amrex::Real avo_eos = 6.0221417930e23;
const amrex::Real kerg = 1.380650424e-16;
const amrex::Real amu = 1.66053878283e-24;
constexpr amrex::Real h = 6.6260689633e-27;
constexpr amrex::Real avo_eos = 6.0221417930e23;
constexpr amrex::Real kerg = 1.380650424e-16;
constexpr amrex::Real amu = 1.66053878283e-24;
}

#endif

0 comments on commit ed7d63a

Please sign in to comment.