Skip to content

Commit

Permalink
remove "using namespace eos" from headers (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Jul 28, 2024
1 parent c75486b commit b42f181
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 115 deletions.
6 changes: 2 additions & 4 deletions EOS/breakout/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
#include <network.H>
#include <actual_eos_data.H>

using namespace eos_rp;

const std::string eos_name = "breakout";

inline
void actual_eos_init ()
{

// constant ratio of specific heats
if (eos_gamma > 0.e0_rt) {
gamma_const = eos_gamma;
if (eos_rp::eos_gamma > 0.e0_rt) {
gamma_const = eos_rp::eos_gamma;
} else {
gamma_const = 5.0_rt / 3.0_rt;
}
Expand Down
24 changes: 11 additions & 13 deletions EOS/gamma_law/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <fundamental_constants.H>
#include <cmath>

using namespace eos_rp;

// This is a constant gamma equation of state, using an ideal gas.
//
// The gas may either be completely ionized or completely neutral.
Expand All @@ -22,7 +20,7 @@ inline
void actual_eos_init() {

// constant ratio of specific heats
if (eos_gamma <= 0.0) {
if (eos_rp::eos_gamma <= 0.0) {
amrex::Error("gamma_const cannot be < 0");
}

Expand Down Expand Up @@ -56,7 +54,7 @@ void actual_eos (I input, T& state)
const amrex::Real m_nucleon = C::m_u;

if constexpr (has_xn<T>::value) {
if (eos_assume_neutral) {
if (eos_rp::eos_assume_neutral) {
state.mu = state.abar;
} else {
amrex::Real sum = 0.0;
Expand Down Expand Up @@ -88,7 +86,7 @@ void actual_eos (I input, T& state)
// h = e + p/rho = (p/rho)*[1 + 1/(gamma-1)] = (p/rho)*gamma/(gamma-1)

if constexpr (has_enthalpy<T>::value) {
state.T = (state.h * state.mu * m_nucleon / C::k_B)*(eos_gamma - 1.0)/eos_gamma;
state.T = (state.h * state.mu * m_nucleon / C::k_B)*(eos_rp::eos_gamma - 1.0)/eos_rp::eos_gamma;
}

break;
Expand Down Expand Up @@ -127,7 +125,7 @@ void actual_eos (I input, T& state)
// e = k T / [(mu m_nucleon)*(gamma-1)]

if constexpr (has_energy<T>::value) {
state.T = state.e * state.mu * m_nucleon * (eos_gamma - 1.0) / C::k_B;
state.T = state.e * state.mu * m_nucleon * (eos_rp::eos_gamma - 1.0) / C::k_B;
}

break;
Expand Down Expand Up @@ -162,7 +160,7 @@ void actual_eos (I input, T& state)
// Solve for temperature and density

if constexpr (has_pressure<T>::value && has_enthalpy<T>::value) {
state.rho = state.p / state.h * eos_gamma / (eos_gamma - 1.0);
state.rho = state.p / state.h * eos_rp::eos_gamma / (eos_rp::eos_gamma - 1.0);
state.T = state.p * state.mu * m_nucleon / (C::k_B * state.rho);
}

Expand Down Expand Up @@ -199,7 +197,7 @@ void actual_eos (I input, T& state)
// Compute the pressure simply from the ideal gas law, and the
// specific internal energy using the gamma-law EOS relation.
amrex::Real pressure = state.rho * state.T * C::k_B / (state.mu * m_nucleon);
amrex::Real energy = pressure / (eos_gamma - 1.0) * rhoinv;
amrex::Real energy = pressure / (eos_rp::eos_gamma - 1.0) * rhoinv;
if constexpr (has_pressure<T>::value) {
state.p = pressure;
}
Expand Down Expand Up @@ -256,17 +254,17 @@ void actual_eos (I input, T& state)
state.cv = state.dedT;

if constexpr (has_pressure<T>::value) {
state.cp = eos_gamma * state.cv;
state.cp = eos_rp::eos_gamma * state.cv;

state.gam1 = eos_gamma;
state.gam1 = eos_rp::eos_gamma;

state.dpdr_e = state.dpdr - state.dpdT * state.dedr * (1.0 / state.dedT);
state.dpde = state.dpdT * (1.0 / state.dedT);

// sound speed
state.cs = std::sqrt(eos_gamma * state.p * rhoinv);
state.cs = std::sqrt(eos_rp::eos_gamma * state.p * rhoinv);
if constexpr (has_G<T>::value) {
state.G = 0.5 * (1.0 + eos_gamma);
state.G = 0.5 * (1.0 + eos_rp::eos_gamma);
}
}
}
Expand All @@ -278,7 +276,7 @@ void actual_eos (I input, T& state)
state.dedA = - state.e * (1.0 / state.abar);
}

if (eos_assume_neutral) {
if (eos_rp::eos_assume_neutral) {
if constexpr (has_dpdZ<T>::value) {
state.dpdZ = 0.0;
}
Expand Down
16 changes: 7 additions & 9 deletions EOS/multigamma/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <cmath>
#include <actual_eos_data.H>

using namespace eos_rp;

const std::string eos_name = "multigamma";

inline
Expand All @@ -26,24 +24,24 @@ void actual_eos_init ()
// that can override the default gammas for a few named species.

for (int n = 0; n < NumSpec; ++n) {
gammas[n] = eos_gamma_default;
gammas[n] = eos_rp::eos_gamma_default;
}

int idx;

idx = network_spec_index(species_a_name);
idx = network_spec_index(eos_rp::species_a_name);
if (idx >= 0) {
gammas[idx] = species_a_gamma;
gammas[idx] = eos_rp::species_a_gamma;
}

idx = network_spec_index(species_b_name);
idx = network_spec_index(eos_rp::species_b_name);
if (idx >= 0) {
gammas[idx] = species_b_gamma;
gammas[idx] = eos_rp::species_b_gamma;
}

idx = network_spec_index(species_c_name);
idx = network_spec_index(eos_rp::species_c_name);
if (idx >= 0) {
gammas[idx] = species_c_gamma;
gammas[idx] = eos_rp::species_c_gamma;
}

}
Expand Down
14 changes: 6 additions & 8 deletions EOS/polytrope/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <eos_type.H>
#include <actual_eos_data.H>

using namespace eos_rp;

const std::string eos_name = "polytrope";

inline
Expand All @@ -41,9 +39,9 @@ void actual_eos_init ()
// 1: Non-relativistic, fully degenerate electron gas
// 2: Relativistic, fully degenerate electron gas

if (polytrope_type > 0) {
mu_e = polytrope_mu_e;
polytrope = polytrope_type;
if (eos_rp::polytrope_type > 0) {
mu_e = eos_rp::polytrope_mu_e;
polytrope = eos_rp::polytrope_type;

if (polytrope == 1) {
gamma_const = 5.0_rt / 3.0_rt;
Expand All @@ -59,9 +57,9 @@ void actual_eos_init ()
amrex::Error("EOS: Polytrope type currently not defined");
}
}
else if (polytrope_gamma > 0.0_rt && polytrope_K > 0.0_rt) {
gamma_const = polytrope_gamma;
K_const = polytrope_K;
else if (eos_rp::polytrope_gamma > 0.0_rt && eos_rp::polytrope_K > 0.0_rt) {
gamma_const = eos_rp::polytrope_gamma;
K_const = eos_rp::polytrope_K;
mu_e = 2.0_rt; // This will not be used
}
else {
Expand Down
88 changes: 43 additions & 45 deletions EOS/primordial_chem/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <cmath>
#include <actual_eos_data.H>

using namespace eos_rp;

const std::string eos_name = "multigamma";

inline
Expand All @@ -23,94 +21,94 @@ void actual_eos_init ()
// Set the gammas & masses for the species

for (int n = 0; n < NumSpec; ++n) {
gammas[n] = eos_gamma_default;
gammas[n] = eos_rp::eos_gamma_default;
spmasses[n] = 1.67353251819e-24;
}

int idx;

idx = network_spec_index(species_a_name);
idx = network_spec_index(eos_rp::species_a_name);
if (idx >= 0) {
gammas[idx] = species_a_gamma;
spmasses[idx] = species_a_mass;
gammas[idx] = eos_rp::species_a_gamma;
spmasses[idx] = eos_rp::species_a_mass;
}

idx = network_spec_index(species_b_name);
idx = network_spec_index(eos_rp::species_b_name);
if (idx >= 0) {
gammas[idx] = species_b_gamma;
spmasses[idx] = species_b_mass;
gammas[idx] = eos_rp::species_b_gamma;
spmasses[idx] = eos_rp::species_b_mass;
}

idx = network_spec_index(species_c_name);
idx = network_spec_index(eos_rp::species_c_name);
if (idx >= 0) {
gammas[idx] = species_c_gamma;
spmasses[idx] = species_c_mass;
gammas[idx] = eos_rp::species_c_gamma;
spmasses[idx] = eos_rp::species_c_mass;
}

idx = network_spec_index(species_d_name);
idx = network_spec_index(eos_rp::species_d_name);
if (idx >= 0) {
gammas[idx] = species_d_gamma;
spmasses[idx] = species_d_mass;
gammas[idx] = eos_rp::species_d_gamma;
spmasses[idx] = eos_rp::species_d_mass;
}

idx = network_spec_index(species_e_name);
idx = network_spec_index(eos_rp::species_e_name);
if (idx >= 0) {
gammas[idx] = species_e_gamma;
spmasses[idx] = species_e_mass;
gammas[idx] = eos_rp::species_e_gamma;
spmasses[idx] = eos_rp::species_e_mass;
}

idx = network_spec_index(species_f_name);
idx = network_spec_index(eos_rp::species_f_name);
if (idx >= 0) {
gammas[idx] = species_f_gamma;
spmasses[idx] = species_f_mass;
gammas[idx] = eos_rp::species_f_gamma;
spmasses[idx] = eos_rp::species_f_mass;
}

idx = network_spec_index(species_g_name);
idx = network_spec_index(eos_rp::species_g_name);
if (idx >= 0) {
gammas[idx] = species_g_gamma;
spmasses[idx] = species_g_mass;
gammas[idx] = eos_rp::species_g_gamma;
spmasses[idx] = eos_rp::species_g_mass;
}

idx = network_spec_index(species_h_name);
idx = network_spec_index(eos_rp::species_h_name);
if (idx >= 0) {
gammas[idx] = species_h_gamma;
spmasses[idx] = species_h_mass;
gammas[idx] = eos_rp::species_h_gamma;
spmasses[idx] = eos_rp::species_h_mass;
}

idx = network_spec_index(species_i_name);
idx = network_spec_index(eos_rp::species_i_name);
if (idx >= 0) {
gammas[idx] = species_i_gamma;
spmasses[idx] = species_i_mass;
gammas[idx] = eos_rp::species_i_gamma;
spmasses[idx] = eos_rp::species_i_mass;
}

idx = network_spec_index(species_j_name);
idx = network_spec_index(eos_rp::species_j_name);
if (idx >= 0) {
gammas[idx] = species_j_gamma;
spmasses[idx] = species_j_mass;
gammas[idx] = eos_rp::species_j_gamma;
spmasses[idx] = eos_rp::species_j_mass;
}

idx = network_spec_index(species_k_name);
idx = network_spec_index(eos_rp::species_k_name);
if (idx >= 0) {
gammas[idx] = species_k_gamma;
spmasses[idx] = species_k_mass;
gammas[idx] = eos_rp::species_k_gamma;
spmasses[idx] = eos_rp::species_k_mass;
}

idx = network_spec_index(species_l_name);
idx = network_spec_index(eos_rp::species_l_name);
if (idx >= 0) {
gammas[idx] = species_l_gamma;
spmasses[idx] = species_l_mass;
gammas[idx] = eos_rp::species_l_gamma;
spmasses[idx] = eos_rp::species_l_mass;
}

idx = network_spec_index(species_m_name);
idx = network_spec_index(eos_rp::species_m_name);
if (idx >= 0) {
gammas[idx] = species_m_gamma;
spmasses[idx] = species_m_mass;
gammas[idx] = eos_rp::species_m_gamma;
spmasses[idx] = eos_rp::species_m_mass;
}

idx = network_spec_index(species_n_name);
idx = network_spec_index(eos_rp::species_n_name);
if (idx >= 0) {
gammas[idx] = species_n_gamma;
spmasses[idx] = species_n_mass;
gammas[idx] = eos_rp::species_n_gamma;
spmasses[idx] = eos_rp::species_n_mass;
}

}
Expand Down
14 changes: 6 additions & 8 deletions EOS/rad_power_law/actual_eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@
#include <eos_type.H>
#include <cmath>

using namespace eos_rp;

const std::string eos_name = "rad_power_law";

inline
void actual_eos_init ()
{

if (eos_const_c_v <= 0.e0_rt) {
if (eos_rp::eos_const_c_v <= 0.e0_rt) {
amrex::Error("eos_const_c_v must be > 0");
}

if (eos_c_v_exp_n == 1.0e0_rt) {
if (eos_rp::eos_c_v_exp_n == 1.0e0_rt) {
amrex::Error("eos_c_v_exp_n == 1 is unsupported");
}

Expand Down Expand Up @@ -77,17 +75,17 @@ void actual_eos (I input, T& state)
case eos_input_rt:

if constexpr (has_energy<T>::value) {
state.cv = eos_const_c_v * std::pow(state.rho, eos_c_v_exp_m) * std::pow(state.T, -eos_c_v_exp_n);
state.e = eos_const_c_v * std::pow(state.rho, eos_c_v_exp_m) * std::pow(state.T, 1 - eos_c_v_exp_n) / (1 - eos_c_v_exp_n);
state.cv = eos_rp::eos_const_c_v * std::pow(state.rho, eos_rp::eos_c_v_exp_m) * std::pow(state.T, -eos_rp::eos_c_v_exp_n);
state.e = eos_rp::eos_const_c_v * std::pow(state.rho, eos_rp::eos_c_v_exp_m) * std::pow(state.T, 1 - eos_rp::eos_c_v_exp_n) / (1 - eos_rp::eos_c_v_exp_n);
}

break;

case eos_input_re:

if constexpr (has_energy<T>::value) {
state.T = std::pow((1 - eos_c_v_exp_n) * state.e * std::pow(state.rho, -eos_c_v_exp_m) / eos_const_c_v, 1.0_rt / (1.0_rt - eos_c_v_exp_n));
state.cv = eos_const_c_v * std::pow(state.rho, eos_c_v_exp_m) * std::pow(state.T, -eos_c_v_exp_n);
state.T = std::pow((1 - eos_rp::eos_c_v_exp_n) * state.e * std::pow(state.rho, -eos_rp::eos_c_v_exp_m) / eos_rp::eos_const_c_v, 1.0_rt / (1.0_rt - eos_rp::eos_c_v_exp_n));
state.cv = eos_rp::eos_const_c_v * std::pow(state.rho, eos_rp::eos_c_v_exp_m) * std::pow(state.T, -eos_rp::eos_c_v_exp_n);
}

break;
Expand Down
Loading

0 comments on commit b42f181

Please sign in to comment.