diff --git a/.github/workflows/dependencies/dependencies_hip.sh b/.github/workflows/dependencies/dependencies_hip.sh index 527379e7e8..76a2abd04c 100755 --- a/.github/workflows/dependencies/dependencies_hip.sh +++ b/.github/workflows/dependencies/dependencies_hip.sh @@ -33,7 +33,9 @@ sudo apt-key add rocm.gpg.key source /etc/os-release # set UBUNTU_CODENAME: focal or jammy or ... -echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/${1-latest} ${UBUNTU_CODENAME} main" \ +VERSION=${1-6.3.2} + +echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/${VERSION} ${UBUNTU_CODENAME} main" \ | sudo tee /etc/apt/sources.list.d/rocm.list echo 'export PATH=/opt/rocm/llvm/bin:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin:$PATH' \ | sudo tee -a /etc/profile.d/rocm.sh @@ -53,16 +55,16 @@ sudo apt-get install -y --no-install-recommends \ libnuma-dev \ libopenmpi-dev \ openmpi-bin \ - rocm-dev \ - roctracer-dev \ - rocprofiler-dev \ - rocrand-dev \ - rocfft-dev \ - rocprim-dev \ - rocsparse-dev + rocm-dev${VERSION} \ + roctracer-dev${VERSION} \ + rocprofiler-dev${VERSION} \ + rocrand-dev${VERSION} \ + rocfft-dev${VERSION} \ + rocprim-dev${VERSION} \ + rocsparse-dev${VERSION} # hiprand-dev is a new package that does not exist in old versions -sudo apt-get install -y --no-install-recommends hiprand-dev || true +sudo apt-get install -y --no-install-recommends hiprand-dev${VERSION} || true # activate # diff --git a/.github/workflows/hip.yml b/.github/workflows/hip.yml index cd3fac813e..fff66f72ec 100644 --- a/.github/workflows/hip.yml +++ b/.github/workflows/hip.yml @@ -8,7 +8,7 @@ concurrency: jobs: hip-compile: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: @@ -27,7 +27,7 @@ jobs: cd ../.. - name: Dependencies - run: .github/workflows/dependencies/dependencies_hip.sh + run: .github/workflows/dependencies/dependencies_hip.sh 6.3.2 - name: compile test_react with HIP (iso7) run: | diff --git a/Docs/source/comprehensive_tests.rst b/Docs/source/comprehensive_tests.rst index 5ea20ab663..32a4f507f9 100644 --- a/Docs/source/comprehensive_tests.rst +++ b/Docs/source/comprehensive_tests.rst @@ -1,3 +1,5 @@ +.. _sec:comprehensive_tests: + ************************ Comprehensive Unit Tests ************************ diff --git a/Docs/source/integrators.rst b/Docs/source/integrators.rst index 5d110b9bb8..d9950e7eef 100644 --- a/Docs/source/integrators.rst +++ b/Docs/source/integrators.rst @@ -88,7 +88,7 @@ routine (at the moment this can be ``VODE``, ``BackwardEuler``, ``ForwardEuler`` .. code-block:: c++ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - void burner (burn_t& state, Real dt) + void burner (burn_t& state, amrex::Real dt) The input is a ``burn_t``. @@ -198,7 +198,7 @@ be computed as: .. code-block:: c++ - Array1D y; + amrex::Array1D y; ... for (int i = 1; i <= NumSpec; ++i) { y(i) = state.xn[i-1] * aion_inv[i-1]; diff --git a/Docs/source/one_zone_tests.rst b/Docs/source/one_zone_tests.rst index 3824962369..6051152131 100644 --- a/Docs/source/one_zone_tests.rst +++ b/Docs/source/one_zone_tests.rst @@ -1,3 +1,5 @@ +.. _sec:one_zone_tests: + ************** One Zone Tests ************** diff --git a/Docs/source/templated_networks.rst b/Docs/source/templated_networks.rst index 50f419e545..cab071f26c 100644 --- a/Docs/source/templated_networks.rst +++ b/Docs/source/templated_networks.rst @@ -312,7 +312,7 @@ The main logic for constructing RHS is contained in ``Microphysics/networks/rhs. .. code:: c++ AMREX_GPU_HOST_DEVICE AMREX_INLINE - void rhs (burn_t& state, Array1D& ydot) + void rhs (burn_t& state, amrex::Array1D& ydot) The basic flow is: diff --git a/Docs/source/transport.rst b/Docs/source/transport.rst index d778e36101..9819afa84f 100644 --- a/Docs/source/transport.rst +++ b/Docs/source/transport.rst @@ -85,7 +85,8 @@ The interface for these opacities is: .. code:: c++ AMREX_GPU_HOST_DEVICE AMREX_INLINE - void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu, + void actual_opacity (amrex::Real& kp, amrex::Real& kr, + amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu, bool get_Planck_mean, bool get_Rosseland_mean) where the boolean ``get_Planck_mean`` and ``get_Rosseland_mean`` specify where those diff --git a/Docs/source/unit_test_runtime_parameters.rst b/Docs/source/unit_test_runtime_parameters.rst index 4584b833db..793fe699ef 100644 --- a/Docs/source/unit_test_runtime_parameters.rst +++ b/Docs/source/unit_test_runtime_parameters.rst @@ -25,7 +25,8 @@ Most of the unit tests require a composition to be defined (for the initial mass-fractions, $X_k$). There are a few ways this can be done (depending on the test). -* One-zone (``*_cell``) tests usually do one of: + +* One-zone (``*_cell``) tests (see :ref:`sec:one_zone_tests`) usually do one of: * *Explicitly setting the individual mass fractions.* This is controlled by the parameters ``unit_test.X1``, ``unit_test.X2``, ..., ``unit_test.X35``, @@ -45,7 +46,8 @@ initial mass-fractions, $X_k$). There are a few ways this can be done ``unit_test.uniform_xn``. If this is set to ``1``, then each mass fraction is initialized to ``1 / NumSpec``. -* Comprehensive tests need many different compositions, since they are creating a cube +* Comprehensive tests (see :ref:`sec:comprehensive_tests`) need many different compositions, since they are creating a cube + of varying thermodynamic properties, and thus require a prescription to create the composition. This is done by setting ``unit_test.primary_species_1``, ``unit_test.primary_species_2``, and ``unit_test.primary_species_3`` to one of the diff --git a/EOS/multigamma/eos_composition.H b/EOS/multigamma/eos_composition.H index 0d2f167fad..838b3a0e5f 100644 --- a/EOS/multigamma/eos_composition.H +++ b/EOS/multigamma/eos_composition.H @@ -8,9 +8,9 @@ using namespace amrex::literals; struct eos_xderivs_t { - Real dedX[NumSpec]; - Real dpdX[NumSpec]; - Real dhdX[NumSpec]; + amrex::Real dedX[NumSpec]; + amrex::Real dpdX[NumSpec]; + amrex::Real dhdX[NumSpec]; }; // Given a set of mass fractions, calculate quantities that depend @@ -32,7 +32,7 @@ void subroutine (T& state) } state.mu_e = 1.0_rt / state.y_e; - Real sum = 0.0_rt; + amrex::Real sum = 0.0_rt; for (int n = 0; n < NumSpec; ++n) { sum = sum + state.xn[n] * aion_inv[n]; } @@ -51,7 +51,7 @@ eos_x_derivs_t composition_derivatives (const T& state) eos_xderivs_t state_xderivs; // Get the mass of a nucleon from Avogadro's number. - const Real m_nucleon = 1.0_rt / n_A; + const amrex::Real m_nucleon = 1.0_rt / n_A; // Composition derivatives diff --git a/EOS/ztwd/actual_eos.H b/EOS/ztwd/actual_eos.H index 222e4fe2db..54f390be5d 100644 --- a/EOS/ztwd/actual_eos.H +++ b/EOS/ztwd/actual_eos.H @@ -27,9 +27,9 @@ using namespace amrex::literals; const std::string eos_name = "ztwd"; -const Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck)); -const Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck)); -const Real iter_tol = 1.e-10_rt; +const amrex::Real A = M_PI * amrex::Math::powi<4>(C::m_e) * amrex::Math::powi<5>(C::c_light) / (3.0_rt * amrex::Math::powi<3>(C::hplanck)); +const amrex::Real B2 = 8.0_rt * M_PI * amrex::Math::powi<3>(C::m_e) * amrex::Math::powi<3>(C::c_light) * C::m_p / (3.0_rt * amrex::Math::powi<3>(C::hplanck)); +const amrex::Real iter_tol = 1.e-10_rt; const int max_iter = 1000; inline @@ -43,7 +43,7 @@ AMREX_GPU_HOST_DEVICE AMREX_INLINE bool is_input_valid (I input) { static_assert(std::is_same_v, "input must be an eos_input_t"); - + amrex::ignore_unused(input); bool valid = true; return valid; @@ -52,7 +52,7 @@ bool is_input_valid (I input) AMREX_GPU_HOST_DEVICE AMREX_INLINE -Real pressure (Real x) +amrex::Real pressure (amrex::Real x) { return A * (x * (2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) + 3.0_rt * std::asinh(x)); } @@ -60,7 +60,7 @@ Real pressure (Real x) AMREX_GPU_HOST_DEVICE AMREX_INLINE -Real enthalpy (Real x, Real B) +amrex::Real enthalpy (amrex::Real x, amrex::Real B) { return (8.0_rt * A / B) * std::sqrt(1.0_rt + x * x); } @@ -68,7 +68,7 @@ Real enthalpy (Real x, Real B) AMREX_GPU_HOST_DEVICE AMREX_INLINE -Real dpdx (Real x) +amrex::Real dpdx (amrex::Real x) { return A * ((2.0_rt * x * x - 3.0_rt) * std::sqrt(x * x + 1.0_rt) + x * (4.0_rt * x) * std::sqrt(x * x + 1.0_rt) + @@ -79,7 +79,7 @@ Real dpdx (Real x) AMREX_GPU_HOST_DEVICE AMREX_INLINE -Real dhdx (Real x, Real B) +amrex::Real dhdx (amrex::Real x, amrex::Real B) { return enthalpy(x, B) * (x / (x * x + 1.0_rt)); } @@ -88,12 +88,12 @@ Real dhdx (Real x, Real B) AMREX_GPU_HOST_DEVICE AMREX_INLINE -void pres_iter (Real pres, Real& dens, Real B) +void pres_iter (amrex::Real pres, amrex::Real& dens, amrex::Real B) { // Starting guess for the iteration. - Real x = 1.0_rt; + amrex::Real x = 1.0_rt; // We are solving the equation: // f(x) = p_want - p(x) = 0. @@ -104,7 +104,7 @@ void pres_iter (Real pres, Real& dens, Real B) for (iter = 1; iter <= max_iter; ++iter) { - Real dx = (pres - pressure(x)) / dpdx(x); + amrex::Real dx = (pres - pressure(x)) / dpdx(x); x = x + dx; @@ -131,32 +131,32 @@ void actual_eos (I input, T& state) { static_assert(std::is_same_v, "input must be an eos_input_t"); - Real dens = state.rho; - Real temp = state.T; + amrex::Real dens = state.rho; + amrex::Real temp = state.T; - Real pres = 1.0_rt; + amrex::Real pres = 1.0_rt; if constexpr (has_pressure::value) { pres = state.p; } - Real enth = 1.0_rt; + amrex::Real enth = 1.0_rt; if constexpr (has_enthalpy::value) { enth = state.h; } - Real eint = 1.0_rt; + amrex::Real eint = 1.0_rt; if constexpr (has_energy::value) { eint = state.e; } - Real entr = 1.0_rt; + amrex::Real entr = 1.0_rt; if constexpr (has_entropy::value) { entr = state.s; } - Real B = B2 * state.mu_e; + amrex::Real B = B2 * state.mu_e; - Real x, dxdr; + amrex::Real x, dxdr; switch (input) { @@ -321,8 +321,8 @@ void actual_eos (I input, T& state) x = std::cbrt(dens / B); dxdr = (1.0_rt / 3.0_rt) * x / dens; - Real dpdr = dxdr * dpdx(x); - Real dhdr = dxdr * dhdx(x, B); + amrex::Real dpdr = dxdr * dpdx(x); + amrex::Real dhdr = dxdr * dhdx(x, B); if constexpr (has_pressure::value) { state.dpdr = dpdr; diff --git a/conductivity/stellar/actual_conductivity.H b/conductivity/stellar/actual_conductivity.H index 2649d14f38..4776429ab6 100644 --- a/conductivity/stellar/actual_conductivity.H +++ b/conductivity/stellar/actual_conductivity.H @@ -127,9 +127,7 @@ actual_conductivity (T& state) amrex::Real xkaz = 50.0_rt*xz*xka1 * std::exp(-0.5206_rt*amrex::Math::powi<2>((std::log(state.rho)-d0log)/xkw)); amrex::Real dbar2log = -(4.283_rt + 0.7196_rt*xh) + 3.86_rt*std::log(t6); amrex::Real dbar1log = -5.296_rt + 4.833_rt*std::log(t6); - if (dbar2log < dbar1log) { - dbar1log = dbar2log; - } + dbar1log = std::min(dbar1log, dbar2log); oiben2 = std::pow(state.rho/std::exp(dbar1log), 0.67_rt) * std::exp(xkaz); } diff --git a/integration/nse_update_sdc.H b/integration/nse_update_sdc.H index 6756b3006a..1604b0f800 100644 --- a/integration/nse_update_sdc.H +++ b/integration/nse_update_sdc.H @@ -1,8 +1,6 @@ #ifndef NSE_UPDATE_H #define NSE_UPDATE_H -#include - #include #include #include diff --git a/integration/utils/nonaka_plot.H b/integration/utils/nonaka_plot.H index 2bc42a5ba7..dd70eeb23f 100644 --- a/integration/utils/nonaka_plot.H +++ b/integration/utils/nonaka_plot.H @@ -52,7 +52,7 @@ void nonaka_init() { template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_react) { +void nonaka_rhs(const amrex::Real time, const BurnT& state, const YdotNetArray1D& ydot_react) { // state: the burn_t corresponding to the current state note: // state.time is relative to the start of the current burn call, @@ -74,7 +74,7 @@ void nonaka_rhs(const Real time, const BurnT& state, const YdotNetArray1D& ydot_ nf.open(nonaka_file, std::ios::app); - Real simulation_time = time + state.reference_time; + amrex::Real simulation_time = time + state.reference_time; nf << std::setw(FIELD_WIDTH) << simulation_time << " "; diff --git a/networks/aprox21/actual_network.H b/networks/aprox21/actual_network.H index 9fca91944a..af5c0a3c70 100644 --- a/networks/aprox21/actual_network.H +++ b/networks/aprox21/actual_network.H @@ -235,7 +235,7 @@ namespace RHS { rhs_t data; - switch (rate) { + switch (rate) { // NOLINT(bugprone-switch-missing-default-case) case P_to_N: // irpen and irnep in the original aprox21 diff --git a/nse_solver/nse_eos.H b/nse_solver/nse_eos.H index 6816ad31fa..2a57868caf 100644 --- a/nse_solver/nse_eos.H +++ b/nse_solver/nse_eos.H @@ -102,7 +102,7 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in, amrex::Real &T, amrex::Real &abar, amrex::Real &mu_p, amrex::Real &mu_n) { - constexpr Real ttol{1.e-8_rt}; + constexpr amrex::Real ttol{1.e-8_rt}; constexpr int max_iter{100}; bool converged{false}; @@ -148,8 +148,8 @@ nse_T_abar_from_e(const amrex::Real rho, const amrex::Real e_in, // compute the correction to our guess - Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT - + Ye * eos_state.dedZ * dabar_dT); + amrex::Real dT = -f / (eos_state.dedT + eos_state.dedA * dabar_dT + + Ye * eos_state.dedZ * dabar_dT); // update the temperature and abar diff --git a/opacity/breakout/actual_opacity.H b/opacity/breakout/actual_opacity.H index 41da0dba7d..de43e7a9cf 100644 --- a/opacity/breakout/actual_opacity.H +++ b/opacity/breakout/actual_opacity.H @@ -9,11 +9,12 @@ AMREX_INLINE void actual_opacity_init () {} AMREX_GPU_HOST_DEVICE AMREX_INLINE -void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu, +void actual_opacity (amrex::Real& kp, amrex::Real& kr, + amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu, bool get_Planck_mean, bool get_Rosseland_mean) { - const Real Ksc = 0.4e0; // Thomson scattering - const Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc + const amrex::Real Ksc = 0.4e0; // Thomson scattering + const amrex::Real fac = 1.e-4; // Planck mean is assumed to be fac * Ksc if (get_Planck_mean) { kp = rhoYe * Ksc * fac; @@ -25,5 +26,3 @@ void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real n } #endif - - diff --git a/opacity/opacity.H b/opacity/opacity.H index 4f362d5d19..3eda659fd3 100644 --- a/opacity/opacity.H +++ b/opacity/opacity.H @@ -10,7 +10,8 @@ void opacity_init () } AMREX_GPU_HOST_DEVICE AMREX_INLINE -void opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu, +void opacity (Real& kp, amrex::Real& kr, amrex::Real rho, + amrex::Real temp, amrex::Real rhoYe, amrex::Real nu, bool get_Planck_mean, bool get_Rosseland_mean) { actual_opacity(kp, kr, rho, temp, rhoYe, nu, get_Planck_mean, get_Rosseland_mean); diff --git a/opacity/rad_power_law/actual_opacity.H b/opacity/rad_power_law/actual_opacity.H index a2e09d8a0e..db8c59191f 100644 --- a/opacity/rad_power_law/actual_opacity.H +++ b/opacity/rad_power_law/actual_opacity.H @@ -11,17 +11,18 @@ AMREX_INLINE void actual_opacity_init () {} AMREX_GPU_HOST_DEVICE AMREX_INLINE -void actual_opacity (Real& kp, Real& kr, Real rho, Real temp, Real rhoYe, Real nu, +void actual_opacity (amrex::Real& kp, amrex::Real& kr, + amrex::Real rho, amrex::Real temp, amrex::Real rhoYe, amrex::Real nu, bool get_Planck_mean, bool get_Rosseland_mean) { - Real nup_kpp = std::pow(nu, kappa_p_exp_p); - Real nup_kpr = std::pow(nu, kappa_r_exp_p); - Real nup_kps = std::pow(nu, scatter_exp_p); + amrex::Real nup_kpp = std::pow(nu, kappa_p_exp_p); + amrex::Real nup_kpr = std::pow(nu, kappa_r_exp_p); + amrex::Real nup_kps = std::pow(nu, scatter_exp_p); - Real teff = amrex::max(temp, 1.0e-50_rt); + amrex::Real teff = amrex::max(temp, 1.0e-50_rt); teff = teff + rad_temp_floor * std::exp(-teff / (rad_temp_floor + 1.e-50_rt)); - Real ks = const_scatter * std::pow(rho, scatter_exp_m) * std::pow(teff, -scatter_exp_n) * nup_kps; + amrex::Real ks = const_scatter * std::pow(rho, scatter_exp_m) * std::pow(teff, -scatter_exp_n) * nup_kps; if (get_Planck_mean) { #ifndef AMREX_USE_GPU diff --git a/unit_test/burn_cell/burn_cell.H b/unit_test/burn_cell/burn_cell.H index 482fb580f9..0116ca01fc 100644 --- a/unit_test/burn_cell/burn_cell.H +++ b/unit_test/burn_cell/burn_cell.H @@ -10,8 +10,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void burn_cell_c() { @@ -30,9 +28,9 @@ void burn_cell_c() // Echo initial conditions at burn and fill burn state input - std::cout << "Maximum Time (s): " << tmax << std::endl; - std::cout << "State Density (g/cm^3): " << density << std::endl; - std::cout << "State Temperature (K): " << temperature << std::endl; + std::cout << "Maximum Time (s): " << unit_test_rp::tmax << std::endl; + std::cout << "State Density (g/cm^3): " << unit_test_rp::density << std::endl; + std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl; for (int n = 0; n < NumSpec; ++n) { std::cout << "Mass Fraction (" << short_spec_names_cxx[n] << "): " << massfractions[n] << std::endl; } @@ -40,8 +38,8 @@ void burn_cell_c() burn_t burn_state; eos_t eos_state; - eos_state.rho = density; - eos_state.T = temperature; + eos_state.rho = unit_test_rp::density; + eos_state.T = unit_test_rp::temperature; for (int n = 0; n < NumSpec; n++) { eos_state.xn[n] = massfractions[n]; } @@ -70,7 +68,7 @@ void burn_cell_c() // normalize -- just in case - if (! skip_initial_normalization) { + if (! unit_test_rp::skip_initial_normalization) { normalize_abundances_burn(burn_state); } @@ -97,18 +95,18 @@ void burn_cell_c() // we will divide the total integration time into nsteps that are // logarithmically spaced - if (tfirst == 0.0_rt) { - if (nsteps == 1) { - tfirst = tmax; + if (unit_test_rp::tfirst == 0.0_rt) { + if (unit_test_rp::nsteps == 1) { + unit_test_rp::tfirst = unit_test_rp::tmax; } else { - tfirst = tmax / nsteps; + unit_test_rp::tfirst = unit_test_rp::tmax / static_cast(unit_test_rp::nsteps); } } amrex::Real dlogt = 0.0_rt; - if (nsteps == 1) { - dlogt = (std::log10(tmax) - std::log10(tfirst)); + if (unit_test_rp::nsteps == 1) { + dlogt = (std::log10(unit_test_rp::tmax) - std::log10(unit_test_rp::tfirst)); } else { - dlogt = (std::log10(tmax) - std::log10(tfirst)) / (nsteps - 1); + dlogt = (std::log10(unit_test_rp::tmax) - std::log10(unit_test_rp::tfirst)) / static_cast(unit_test_rp::nsteps - 1); } // save the initial state -- we'll use this to determine @@ -147,11 +145,11 @@ void burn_cell_c() int nstep_int = 0; - for (int n = 0; n < nsteps; n++){ + for (int n = 0; n < unit_test_rp::nsteps; n++){ // compute the time we wish to integrate to - amrex::Real tend = std::pow(10.0_rt, std::log10(tfirst) + dlogt * n); + amrex::Real tend = std::pow(10.0_rt, std::log10(unit_test_rp::tfirst) + dlogt * n); amrex::Real dt = tend - t; burner(burn_state, dt); @@ -192,7 +190,7 @@ void burn_cell_c() std::cout << "------------------------------------" << std::endl; std::cout << "successful? " << burn_state.success << std::endl; - std::cout << " - Hnuc = " << (burn_state.e - burn_state_in.e) / tmax << std::endl; + std::cout << " - Hnuc = " << (burn_state.e - burn_state_in.e) / unit_test_rp::tmax << std::endl; std::cout << " - added e = " << burn_state.e - burn_state_in.e << std::endl; std::cout << " - final T = " << burn_state.T << std::endl; @@ -213,7 +211,7 @@ void burn_cell_c() std::cout << "species creation rates: " << std::endl; for (int n = 0; n < NumSpec; ++n) { std::cout << "omegadot(" << short_spec_names_cxx[n] << "): " - << (burn_state.xn[n] - burn_state_in.xn[n]) / tmax << std::endl; + << (burn_state.xn[n] - burn_state_in.xn[n]) / unit_test_rp::tmax << std::endl; } std::cout << "number of steps taken: " << nstep_int << std::endl; diff --git a/unit_test/burn_cell_metal_chem/burn_cell.H b/unit_test/burn_cell_metal_chem/burn_cell.H index 6adf645455..8013aaf4bd 100644 --- a/unit_test/burn_cell_metal_chem/burn_cell.H +++ b/unit_test/burn_cell_metal_chem/burn_cell.H @@ -15,8 +15,6 @@ amrex::Real grav_constant = C::Gconst; AMREX_INLINE auto burn_cell_c() -> int { - using namespace unit_test_rp; - burn_t state; amrex::Real numdens[NumSpec] = {-1.0}; @@ -30,113 +28,113 @@ auto burn_cell_c() -> int { switch (n) { case 1: - numdens[n - 1] = primary_species_1; + numdens[n - 1] = unit_test_rp::primary_species_1; break; case 2: - numdens[n - 1] = primary_species_2; + numdens[n - 1] = unit_test_rp::primary_species_2; break; case 3: - numdens[n - 1] = primary_species_3; + numdens[n - 1] = unit_test_rp::primary_species_3; break; case 4: - numdens[n - 1] = primary_species_4; + numdens[n - 1] = unit_test_rp::primary_species_4; break; case 5: - numdens[n - 1] = primary_species_5; + numdens[n - 1] = unit_test_rp::primary_species_5; break; case 6: - numdens[n - 1] = primary_species_6; + numdens[n - 1] = unit_test_rp::primary_species_6; break; case 7: - numdens[n - 1] = primary_species_7; + numdens[n - 1] = unit_test_rp::primary_species_7; break; case 8: - numdens[n - 1] = primary_species_8; + numdens[n - 1] = unit_test_rp::primary_species_8; break; case 9: - numdens[n - 1] = primary_species_9; + numdens[n - 1] = unit_test_rp::primary_species_9; break; case 10: - numdens[n - 1] = primary_species_10; + numdens[n - 1] = unit_test_rp::primary_species_10; break; case 11: - numdens[n - 1] = primary_species_11; + numdens[n - 1] = unit_test_rp::primary_species_11; break; case 12: - numdens[n - 1] = primary_species_12; + numdens[n - 1] = unit_test_rp::primary_species_12; break; case 13: - numdens[n - 1] = primary_species_13; + numdens[n - 1] = unit_test_rp::primary_species_13; break; case 14: - numdens[n - 1] = primary_species_14; + numdens[n - 1] = unit_test_rp::primary_species_14; break; case 15: - numdens[n - 1] = primary_species_15; + numdens[n - 1] = unit_test_rp::primary_species_15; break; case 16: - numdens[n - 1] = primary_species_16; + numdens[n - 1] = unit_test_rp::primary_species_16; break; case 17: - numdens[n - 1] = primary_species_17*metal; + numdens[n - 1] = unit_test_rp::primary_species_17*metal; break; case 18: - numdens[n - 1] = primary_species_18; + numdens[n - 1] = unit_test_rp::primary_species_18; break; case 19: - numdens[n - 1] = primary_species_19; + numdens[n - 1] = unit_test_rp::primary_species_19; break; case 20: - numdens[n - 1] = primary_species_20; + numdens[n - 1] = unit_test_rp::primary_species_20; break; case 21: - numdens[n - 1] = primary_species_21; + numdens[n - 1] = unit_test_rp::primary_species_21; break; case 22: - numdens[n - 1] = primary_species_22; + numdens[n - 1] = unit_test_rp::primary_species_22; break; case 23: - numdens[n - 1] = primary_species_23*metal; + numdens[n - 1] = unit_test_rp::primary_species_23*metal; break; case 24: - numdens[n - 1] = primary_species_24; + numdens[n - 1] = unit_test_rp::primary_species_24; break; case 25: - numdens[n - 1] = primary_species_25; + numdens[n - 1] = unit_test_rp::primary_species_25; break; case 26: - numdens[n - 1] = primary_species_26; + numdens[n - 1] = unit_test_rp::primary_species_26; break; case 27: - numdens[n - 1] = primary_species_27; + numdens[n - 1] = unit_test_rp::primary_species_27; break; case 28: - numdens[n - 1] = primary_species_28; + numdens[n - 1] = unit_test_rp::primary_species_28; break; case 29: - numdens[n - 1] = primary_species_29; + numdens[n - 1] = unit_test_rp::primary_species_29; break; case 30: - numdens[n - 1] = primary_species_30; + numdens[n - 1] = unit_test_rp::primary_species_30; break; case 31: - numdens[n - 1] = primary_species_31; + numdens[n - 1] = unit_test_rp::primary_species_31; break; case 32: - numdens[n - 1] = primary_species_32; + numdens[n - 1] = unit_test_rp::primary_species_32; break; case 33: - numdens[n - 1] = primary_species_33; + numdens[n - 1] = unit_test_rp::primary_species_33; break; case 34: - numdens[n - 1] = primary_species_34; + numdens[n - 1] = unit_test_rp::primary_species_34; break; } } //scale number densities by initial ninit for (n = 0; n < NumSpec; ++n) { - numdens[n] *= ninit; + numdens[n] *= unit_test_rp::ninit; } //if metallicity is 0, reset metal number densities to 0 @@ -156,15 +154,15 @@ auto burn_cell_c() -> int { std::cout << "Dust2gas Ratio: " << network_rp::dust2gas_ratio << std::endl; std::cout << " " << std::endl; - std::cout << "Maximum Time (s): " << tmax << std::endl; - std::cout << "State Temperature (K): " << temperature << std::endl; + std::cout << "Maximum Time (s): " << unit_test_rp::tmax << std::endl; + std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl; for (n = 0; n < NumSpec; ++n) { std::cout << "Number Density input (" << short_spec_names_cxx[n] << "): " << numdens[n] << std::endl; } amrex::Real TCMB = 2.73*(1.0 + network_rp::redshift); - state.T = amrex::max(temperature, TCMB); + state.T = amrex::max(unit_test_rp::temperature, TCMB); // set initial Tdust to CMB state.aux[0] = TCMB; @@ -222,7 +220,7 @@ auto burn_cell_c() -> int { amrex::Real dd = rhotot; amrex::Real dd1 = 0.0_rt; - for (n = 0; n < nsteps; n++) { + for (n = 0; n < unit_test_rp::nsteps; n++) { dd1 = dd; @@ -234,7 +232,7 @@ auto burn_cell_c() -> int { // find the freefall time amrex::Real tff = std::sqrt(M_PI * 3.0 / (32.0 * rhotmp * grav_constant)); - amrex::Real dt = tff_reduc * tff; + amrex::Real dt = unit_test_rp::tff_reduc * tff; // scale the density dd += dt * (dd / tff); diff --git a/unit_test/burn_cell_primordial_chem/burn_cell.H b/unit_test/burn_cell_primordial_chem/burn_cell.H index 794601d35b..f5ced4cb5e 100644 --- a/unit_test/burn_cell_primordial_chem/burn_cell.H +++ b/unit_test/burn_cell_primordial_chem/burn_cell.H @@ -15,8 +15,6 @@ amrex::Real grav_constant = 6.674e-8; AMREX_INLINE auto burn_cell_c() -> int { - using namespace unit_test_rp; - burn_t state; amrex::Real numdens[NumSpec] = {-1.0}; @@ -25,60 +23,60 @@ auto burn_cell_c() -> int { switch (n) { case 1: - numdens[n - 1] = primary_species_1; + numdens[n - 1] = unit_test_rp::primary_species_1; break; case 2: - numdens[n - 1] = primary_species_2; + numdens[n - 1] = unit_test_rp::primary_species_2; break; case 3: - numdens[n - 1] = primary_species_3; + numdens[n - 1] = unit_test_rp::primary_species_3; break; case 4: - numdens[n - 1] = primary_species_4; + numdens[n - 1] = unit_test_rp::primary_species_4; break; case 5: - numdens[n - 1] = primary_species_5; + numdens[n - 1] = unit_test_rp::primary_species_5; break; case 6: - numdens[n - 1] = primary_species_6; + numdens[n - 1] = unit_test_rp::primary_species_6; break; case 7: - numdens[n - 1] = primary_species_7; + numdens[n - 1] = unit_test_rp::primary_species_7; break; case 8: - numdens[n - 1] = primary_species_8; + numdens[n - 1] = unit_test_rp::primary_species_8; break; case 9: - numdens[n - 1] = primary_species_9; + numdens[n - 1] = unit_test_rp::primary_species_9; break; case 10: - numdens[n - 1] = primary_species_10; + numdens[n - 1] = unit_test_rp::primary_species_10; break; case 11: - numdens[n - 1] = primary_species_11; + numdens[n - 1] = unit_test_rp::primary_species_11; break; case 12: - numdens[n - 1] = primary_species_12; + numdens[n - 1] = unit_test_rp::primary_species_12; break; case 13: - numdens[n - 1] = primary_species_13; + numdens[n - 1] = unit_test_rp::primary_species_13; break; case 14: - numdens[n - 1] = primary_species_14; + numdens[n - 1] = unit_test_rp::primary_species_14; break; } } // Echo initial conditions at burn and fill burn state input - std::cout << "Maximum Time (s): " << tmax << std::endl; - std::cout << "State Temperature (K): " << temperature << std::endl; + std::cout << "Maximum Time (s): " << unit_test_rp::tmax << std::endl; + std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl; for (int n = 0; n < NumSpec; ++n) { std::cout << "Number Density input (" << short_spec_names_cxx[n] << "): " << numdens[n] << std::endl; } - state.T = temperature; + state.T = unit_test_rp::temperature; // find the density in g/cm^3 amrex::Real rhotot = 0.0_rt; @@ -150,7 +148,7 @@ auto burn_cell_c() -> int { amrex::Real dd = rhotot; amrex::Real dd1 = 0.0_rt; - for (int n = 0; n < nsteps; n++) { + for (int n = 0; n < unit_test_rp::nsteps; n++) { dd1 = dd; @@ -162,7 +160,7 @@ auto burn_cell_c() -> int { // find the freefall time amrex::Real tff = std::sqrt(M_PI * 3.0 / (32.0 * rhotmp * grav_constant)); - amrex::Real dt = tff_reduc * tff; + amrex::Real dt = unit_test_rp::tff_reduc * tff; // scale the density dd += dt * (dd / tff); diff --git a/unit_test/burn_cell_sdc/burn_cell.H b/unit_test/burn_cell_sdc/burn_cell.H index f5e926e1c2..a271b33640 100644 --- a/unit_test/burn_cell_sdc/burn_cell.H +++ b/unit_test/burn_cell_sdc/burn_cell.H @@ -9,8 +9,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void burn_cell_c() { @@ -37,13 +35,13 @@ void burn_cell_c() switch (n) { case 1: - auxdata[n-1] = Aux1; + auxdata[n-1] = unit_test_rp::Aux1; break; case 2: - auxdata[n-1] = Aux2; + auxdata[n-1] = unit_test_rp::Aux2; break; case 3: - auxdata[n-1] = Aux3; + auxdata[n-1] = unit_test_rp::Aux3; break; default: amrex::Error("invalid aux"); @@ -60,109 +58,109 @@ void burn_cell_c() switch (n) { case 1: - adv_species[n-1] = Adv_X1; + adv_species[n-1] = unit_test_rp::Adv_X1; break; case 2: - adv_species[n-1] = Adv_X2; + adv_species[n-1] = unit_test_rp::Adv_X2; break; case 3: - adv_species[n-1] = Adv_X3; + adv_species[n-1] = unit_test_rp::Adv_X3; break; case 4: - adv_species[n-1] = Adv_X4; + adv_species[n-1] = unit_test_rp::Adv_X4; break; case 5: - adv_species[n-1] = Adv_X5; + adv_species[n-1] = unit_test_rp::Adv_X5; break; case 6: - adv_species[n-1] = Adv_X6; + adv_species[n-1] = unit_test_rp::Adv_X6; break; case 7: - adv_species[n-1] = Adv_X7; + adv_species[n-1] = unit_test_rp::Adv_X7; break; case 8: - adv_species[n-1] = Adv_X8; + adv_species[n-1] = unit_test_rp::Adv_X8; break; case 9: - adv_species[n-1] = Adv_X9; + adv_species[n-1] = unit_test_rp::Adv_X9; break; case 10: - adv_species[n-1] = Adv_X10; + adv_species[n-1] = unit_test_rp::Adv_X10; break; case 11: - adv_species[n-1] = Adv_X11; + adv_species[n-1] = unit_test_rp::Adv_X11; break; case 12: - adv_species[n-1] = Adv_X12; + adv_species[n-1] = unit_test_rp::Adv_X12; break; case 13: - adv_species[n-1] = Adv_X13; + adv_species[n-1] = unit_test_rp::Adv_X13; break; case 14: - adv_species[n-1] = Adv_X14; + adv_species[n-1] = unit_test_rp::Adv_X14; break; case 15: - adv_species[n-1] = Adv_X15; + adv_species[n-1] = unit_test_rp::Adv_X15; break; case 16: - adv_species[n-1] = Adv_X16; + adv_species[n-1] = unit_test_rp::Adv_X16; break; case 17: - adv_species[n-1] = Adv_X17; + adv_species[n-1] = unit_test_rp::Adv_X17; break; case 18: - adv_species[n-1] = Adv_X18; + adv_species[n-1] = unit_test_rp::Adv_X18; break; case 19: - adv_species[n-1] = Adv_X19; + adv_species[n-1] = unit_test_rp::Adv_X19; break; case 20: - adv_species[n-1] = Adv_X20; + adv_species[n-1] = unit_test_rp::Adv_X20; break; case 21: - adv_species[n-1] = Adv_X21; + adv_species[n-1] = unit_test_rp::Adv_X21; break; case 22: - adv_species[n-1] = Adv_X22; + adv_species[n-1] = unit_test_rp::Adv_X22; break; case 23: - adv_species[n-1] = Adv_X23; + adv_species[n-1] = unit_test_rp::Adv_X23; break; case 24: - adv_species[n-1] = Adv_X24; + adv_species[n-1] = unit_test_rp::Adv_X24; break; case 25: - adv_species[n-1] = Adv_X25; + adv_species[n-1] = unit_test_rp::Adv_X25; break; case 26: - adv_species[n-1] = Adv_X26; + adv_species[n-1] = unit_test_rp::Adv_X26; break; case 27: - adv_species[n-1] = Adv_X27; + adv_species[n-1] = unit_test_rp::Adv_X27; break; case 28: - adv_species[n-1] = Adv_X28; + adv_species[n-1] = unit_test_rp::Adv_X28; break; case 29: - adv_species[n-1] = Adv_X29; + adv_species[n-1] = unit_test_rp::Adv_X29; break; case 30: - adv_species[n-1] = Adv_X30; + adv_species[n-1] = unit_test_rp::Adv_X30; break; case 31: - adv_species[n-1] = Adv_X31; + adv_species[n-1] = unit_test_rp::Adv_X31; break; case 32: - adv_species[n-1] = Adv_X32; + adv_species[n-1] = unit_test_rp::Adv_X32; break; case 33: - adv_species[n-1] = Adv_X33; + adv_species[n-1] = unit_test_rp::Adv_X33; break; case 34: - adv_species[n-1] = Adv_X34; + adv_species[n-1] = unit_test_rp::Adv_X34; break; case 35: - adv_species[n-1] = Adv_X35; + adv_species[n-1] = unit_test_rp::Adv_X35; break; default: amrex::Error("invalid species"); @@ -179,13 +177,13 @@ void burn_cell_c() switch (n) { case 1: - adv_aux[n-1] = Adv_Aux1; + adv_aux[n-1] = unit_test_rp::Adv_Aux1; break; case 2: - adv_aux[n-1] = Adv_Aux2; + adv_aux[n-1] = unit_test_rp::Adv_Aux2; break; case 3: - adv_aux[n-1] = Adv_Aux3; + adv_aux[n-1] = unit_test_rp::Adv_Aux3; break; default: amrex::Error("invalid aux component"); @@ -197,10 +195,10 @@ void burn_cell_c() // Echo initial conditions at burn and fill burn state input - std::cout << "Maximum Time (s): " << tmax << std::endl; - std::cout << "State Density (g/cm^3): " << density << std::endl; - std::cout << "State Temperature (K): " << temperature << std::endl; - std::cout << "State rhoe (erg/cm^3): " << rhoe << std::endl; + std::cout << "Maximum Time (s): " << unit_test_rp::tmax << std::endl; + std::cout << "State Density (g/cm^3): " << unit_test_rp::density << std::endl; + std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl; + std::cout << "State rhoe (erg/cm^3): " << unit_test_rp::rhoe << std::endl; for (int n = 0; n < NumSpec; ++n) { std::cout << "Mass Fraction (" << short_spec_names_cxx[n] << "): " << massfractions[n] << std::endl; @@ -213,14 +211,14 @@ void burn_cell_c() burn_t burn_state; eos_extra_t eos_state; - eos_state.rho = density; - eos_state.T = temperature; + eos_state.rho = unit_test_rp::density; + eos_state.T = unit_test_rp::temperature; for (int n = 0; n < NumSpec; n++) { eos_state.xn[n] = massfractions[n]; } #ifdef AUX_THERMO - if (recompute_aux) { + if (unit_test_rp::recompute_aux) { set_aux_comp_from_X(eos_state); } else { for (int n = 0; n < NumAux; ++n) { @@ -229,9 +227,9 @@ void burn_cell_c() } #endif - if (rhoe < 0) { + if (unit_test_rp::rhoe < 0) { eos(eos_input_rt, eos_state); - rhoe = density * eos_state.e; + unit_test_rp::rhoe = unit_test_rp::density * eos_state.e; } burn_state.rho = eos_state.rho; @@ -247,21 +245,21 @@ void burn_cell_c() } #endif - burn_state.y[SRHO] = density; + burn_state.y[SRHO] = unit_test_rp::density; burn_state.y[SMX] = 0.0; burn_state.y[SMY] = 0.0; burn_state.y[SMZ] = 0.0; - burn_state.y[SEINT] = rhoe; + burn_state.y[SEINT] = unit_test_rp::rhoe; burn_state.y[SEDEN] = burn_state.y[SEINT]; // now initialize the advective terms -- the only ones that are // actually used during the integration are for rho, (rho X), and // (rho e) - burn_state.ydot_a[SRHO] = Adv_rho; - burn_state.ydot_a[SEINT] = Adv_rhoe; + burn_state.ydot_a[SRHO] = unit_test_rp::Adv_rho; + burn_state.ydot_a[SEINT] = unit_test_rp::Adv_rhoe; for (int n = 0; n < NumSpec; n++) { burn_state.ydot_a[SFS+n] = adv_species[n]; @@ -292,7 +290,7 @@ void burn_cell_c() } #endif - burn_state.e = rhoe / burn_state.rho; + burn_state.e = unit_test_rp::rhoe / burn_state.rho; burn_state.T_fixed = -1.0; @@ -308,18 +306,18 @@ void burn_cell_c() // we will divide the total integration time into nsteps that are // logarithmically spaced - if (tfirst == 0.0_rt) { - if (nsteps == 1) { - tfirst = tmax; + if (unit_test_rp::tfirst == 0.0_rt) { + if (unit_test_rp::nsteps == 1) { + unit_test_rp::tfirst = unit_test_rp::tmax; } else { - tfirst = tmax / nsteps; + unit_test_rp::tfirst = unit_test_rp::tmax / static_cast(unit_test_rp::nsteps); } } amrex::Real dlogt = 0.0_rt; - if (nsteps == 1) { - dlogt = (std::log10(tmax) - std::log10(tfirst)); + if (unit_test_rp::nsteps == 1) { + dlogt = (std::log10(unit_test_rp::tmax) - std::log10(unit_test_rp::tfirst)); } else { - dlogt = (std::log10(tmax) - std::log10(tfirst)) / (nsteps - 1); + dlogt = (std::log10(unit_test_rp::tmax) - std::log10(unit_test_rp::tfirst)) / static_cast(unit_test_rp::nsteps - 1); } // output the data in columns, one line per timestep @@ -350,11 +348,11 @@ void burn_cell_c() std::cout << burn_state << std::endl; - for (int n = 0; n < nsteps; n++){ + for (int n = 0; n < unit_test_rp::nsteps; n++){ // compute the time we wish to integrate to - amrex::Real tend = std::pow(10.0_rt, std::log10(tfirst) + dlogt * n); + amrex::Real tend = std::pow(10.0_rt, std::log10(unit_test_rp::tfirst) + dlogt * n); amrex::Real dt = tend - t; // if we start out in NSE, then the burner will never reset diff --git a/unit_test/eos_cell/eos_cell.H b/unit_test/eos_cell/eos_cell.H index da033d7c20..1e1fa58958 100644 --- a/unit_test/eos_cell/eos_cell.H +++ b/unit_test/eos_cell/eos_cell.H @@ -7,8 +7,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void eos_cell_c() { @@ -17,8 +15,8 @@ void eos_cell_c() // Set mass fractions to sanitize inputs for them amrex::Real massfractions[NumSpec]; - for (int n = 0; n < NumSpec; ++n) { - massfractions[n] = -1.0e0_rt; + for (double &X : massfractions) { + X = -1.0e0_rt; } // Make sure user set all the mass fractions to values in the interval [0, 1] @@ -32,8 +30,8 @@ void eos_cell_c() } - state.T = temperature; - state.rho = density; + state.T = unit_test_rp::temperature; + state.rho = unit_test_rp::density; for (int n = 0; n < NumSpec; ++n) { state.xn[n] = massfractions[n]; } diff --git a/unit_test/jac_cell/jac_cell.H b/unit_test/jac_cell/jac_cell.H index 54560a56dd..4fa3693e9e 100644 --- a/unit_test/jac_cell/jac_cell.H +++ b/unit_test/jac_cell/jac_cell.H @@ -11,8 +11,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void jac_cell_c() { @@ -32,8 +30,8 @@ void jac_cell_c() burn_t burn_state; - burn_state.rho = density; - burn_state.T = temperature; + burn_state.rho = unit_test_rp::density; + burn_state.T = unit_test_rp::temperature; for (int n = 0; n < NumSpec; ++n) { burn_state.xn[n] = massfractions[n]; } diff --git a/unit_test/nse_net_cell/_parameters b/unit_test/nse_net_cell/_parameters index 5cf8cec4f9..cfe765b8e8 100644 --- a/unit_test/nse_net_cell/_parameters +++ b/unit_test/nse_net_cell/_parameters @@ -9,25 +9,3 @@ temperature real 3.e9 ye real 0.75 mu_p real -3.0 mu_n real -12.0 - -X1 real 1.0e0 -X2 real 0.0e0 -X3 real 0.0e0 -X4 real 0.0e0 -X5 real 0.0e0 -X6 real 0.0e0 -X7 real 0.0e0 -X8 real 0.0e0 -X9 real 0.0e0 -X10 real 0.0e0 -X11 real 0.0e0 -X12 real 0.0e0 -X13 real 0.0e0 -X14 real 0.0e0 -X15 real 0.0e0 -X16 real 0.0e0 -X17 real 0.0e0 -X18 real 0.0e0 -X19 real 0.0e0 -X20 real 0.0e0 -X21 real 0.0e0 diff --git a/unit_test/nse_net_cell/burn_cell.H b/unit_test/nse_net_cell/burn_cell.H index 2d1cde714a..b39d53a771 100644 --- a/unit_test/nse_net_cell/burn_cell.H +++ b/unit_test/nse_net_cell/burn_cell.H @@ -9,8 +9,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void burn_cell_c() { @@ -20,21 +18,21 @@ void burn_cell_c() // // Echo initial conditions at burn and fill burn state input - state.T = temperature; - state.rho = density; - state.y_e = ye; + state.T = unit_test_rp::temperature; + state.rho = unit_test_rp::density; + state.y_e = unit_test_rp::ye; // set initial chemical potential of proton and neutron - state.mu_p = mu_p; - state.mu_n = mu_n; + state.mu_p = unit_test_rp::mu_p; + state.mu_n = unit_test_rp::mu_n; // set a reference cell size. state.dx = 1.0e6_rt; - std::cout << "chemical potential of proton is " << mu_p << std::endl; - std::cout << "chemical potential of neutron is " << mu_n << std::endl; + std::cout << "chemical potential of proton is " << unit_test_rp::mu_p << std::endl; + std::cout << "chemical potential of neutron is " << unit_test_rp::mu_n << std::endl; // find the nse state bool ye_is_valid = true; @@ -98,7 +96,7 @@ void burn_cell_c() amrex::Real T_new{eos_state.T}; amrex::Real abar_new{}; - nse_T_abar_from_e(eos_state.rho, eos_state.e, ye, + nse_T_abar_from_e(eos_state.rho, eos_state.e, unit_test_rp::ye, T_new, abar_new, state.mu_p, state.mu_n); diff --git a/unit_test/nse_net_cell/main.cpp b/unit_test/nse_net_cell/main.cpp index 134b08b579..682fd34371 100644 --- a/unit_test/nse_net_cell/main.cpp +++ b/unit_test/nse_net_cell/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) { init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); diff --git a/unit_test/nse_net_cell/make_table/burn_cell.H b/unit_test/nse_net_cell/make_table/burn_cell.H index 17f056ef06..9d566facf9 100644 --- a/unit_test/nse_net_cell/make_table/burn_cell.H +++ b/unit_test/nse_net_cell/make_table/burn_cell.H @@ -10,8 +10,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void burn_cell_c() { @@ -22,17 +20,17 @@ void burn_cell_c() state.dx = 1.0e6_rt; - amrex::Real dlogrho = (std::log10(rho_max) - std::log10(rho_min))/static_cast(nrho-1); - amrex::Real dlogT = (std::log10(T_max) - std::log10(T_min))/static_cast(nT-1); - amrex::Real dYe = (Ye_max - Ye_min)/(nye-1); + amrex::Real dlogrho = (std::log10(unit_test_rp::rho_max) - std::log10(unit_test_rp::rho_min)) / static_cast(unit_test_rp::nrho-1); + amrex::Real dlogT = (std::log10(unit_test_rp::T_max) - std::log10(unit_test_rp::T_min)) / static_cast(unit_test_rp::nT-1); + amrex::Real dYe = (unit_test_rp::Ye_max - unit_test_rp::Ye_min) / static_cast(unit_test_rp::nye-1); - for (int iye = 0; iye < nye; ++iye) { - for (int irho = 0; irho < nrho; ++irho) { - for (int itemp = 0; itemp < nT; ++itemp) { + for (int iye = 0; iye < unit_test_rp::nye; ++iye) { + for (int irho = 0; irho < unit_test_rp::nrho; ++irho) { + for (int itemp = 0; itemp < unit_test_rp::nT; ++itemp) { - amrex::Real T = std::pow(10.0, std::log10(T_min) + itemp * dlogT); - amrex::Real rho = std::pow(10.0, std::log10(rho_min) + irho * dlogrho); - amrex::Real Ye = Ye_min + iye * dYe; + amrex::Real T = std::pow(10.0, std::log10(unit_test_rp::T_min) + itemp * dlogT); + amrex::Real rho = std::pow(10.0, std::log10(unit_test_rp::rho_min) + irho * dlogrho); + amrex::Real Ye = unit_test_rp::Ye_min + iye * dYe; state.T = T; state.rho = rho; state.y_e = Ye; diff --git a/unit_test/nse_net_cell/make_table/main.cpp b/unit_test/nse_net_cell/make_table/main.cpp index 134b08b579..682fd34371 100644 --- a/unit_test/nse_net_cell/make_table/main.cpp +++ b/unit_test/nse_net_cell/make_table/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) { init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); diff --git a/unit_test/nse_table_cell/main.cpp b/unit_test/nse_table_cell/main.cpp index 166a2c2b4a..9de0af0faf 100644 --- a/unit_test/nse_table_cell/main.cpp +++ b/unit_test/nse_table_cell/main.cpp @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); diff --git a/unit_test/nse_table_cell/nse_cell.H b/unit_test/nse_table_cell/nse_cell.H index e5cc165ea3..759cfc8043 100644 --- a/unit_test/nse_table_cell/nse_cell.H +++ b/unit_test/nse_table_cell/nse_cell.H @@ -11,19 +11,20 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void nse_cell_c() { - std::cout << "rho, T, Ye = " << density << " " << temperature << " " << ye << std::endl; + std::cout << "rho, T, Ye = " + << unit_test_rp::density << " " + << unit_test_rp::temperature << " " + << unit_test_rp::ye << std::endl; nse_table_t nse_state; - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); diff --git a/unit_test/part_func_cell/_parameters b/unit_test/part_func_cell/_parameters index e5a08f4463..9b1373362a 100644 --- a/unit_test/part_func_cell/_parameters +++ b/unit_test/part_func_cell/_parameters @@ -1,5 +1,4 @@ @namespace: unit_test -density real 1.e9 temperature real 5.e9 diff --git a/unit_test/part_func_cell/main.cpp b/unit_test/part_func_cell/main.cpp index 9fa048d804..c317fb0618 100644 --- a/unit_test/part_func_cell/main.cpp +++ b/unit_test/part_func_cell/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) { init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); diff --git a/unit_test/part_func_cell/pf_cell.H b/unit_test/part_func_cell/pf_cell.H index c6e3eec621..b16f3eb874 100644 --- a/unit_test/part_func_cell/pf_cell.H +++ b/unit_test/part_func_cell/pf_cell.H @@ -11,8 +11,6 @@ #include #include -using namespace unit_test_rp; - AMREX_INLINE void pf_cell_c() { @@ -20,9 +18,9 @@ void pf_cell_c() amrex::Real pf; amrex::Real dpf_dT; - std::cout << "temperature = " << temperature << std::endl; + std::cout << "temperature = " << unit_test_rp::temperature << std::endl; - tf_t tfactors = evaluate_tfactors(temperature); + tf_t tfactors = evaluate_tfactors(unit_test_rp::temperature); get_partition_function(Ni56, tfactors, pf, dpf_dT); diff --git a/unit_test/react_util.H b/unit_test/react_util.H index 7579b753e3..952d2ad23e 100644 --- a/unit_test/react_util.H +++ b/unit_test/react_util.H @@ -4,7 +4,6 @@ #include using namespace amrex::literals; -using namespace unit_test_rp; struct init_t { int nprim; @@ -29,7 +28,7 @@ init_t setup_composition(const int nz) { comp_data.nprim = 0; // we absolutely require primary_species_1 to be defined - comp_data.is1 = network_spec_index(primary_species_1); + comp_data.is1 = network_spec_index(unit_test_rp::primary_species_1); if (comp_data.is1 >= 0) { comp_data.nprim++; } else { @@ -38,13 +37,13 @@ init_t setup_composition(const int nz) { // we'll check the next species, but if it is not valid, // we'll just move on - comp_data.is2 = network_spec_index(primary_species_2); + comp_data.is2 = network_spec_index(unit_test_rp::primary_species_2); if (comp_data.is2 >= 0) { comp_data.nprim++; // only consider primary_species_3 if primary_species_2 // was defined - comp_data.is3 = network_spec_index(primary_species_3); + comp_data.is3 = network_spec_index(unit_test_rp::primary_species_3); if (comp_data.is3 >= 0) { comp_data.nprim++; } @@ -179,109 +178,109 @@ amrex::Real get_xn(const int index, bool uniform_composition=false) { switch (index) { case 1: - mass_fraction = X1; + mass_fraction = unit_test_rp::X1; break; case 2: - mass_fraction = X2; + mass_fraction = unit_test_rp::X2; break; case 3: - mass_fraction = X3; + mass_fraction = unit_test_rp::X3; break; case 4: - mass_fraction = X4; + mass_fraction = unit_test_rp::X4; break; case 5: - mass_fraction = X5; + mass_fraction = unit_test_rp::X5; break; case 6: - mass_fraction = X6; + mass_fraction = unit_test_rp::X6; break; case 7: - mass_fraction = X7; + mass_fraction = unit_test_rp::X7; break; case 8: - mass_fraction = X8; + mass_fraction = unit_test_rp::X8; break; case 9: - mass_fraction = X9; + mass_fraction = unit_test_rp::X9; break; case 10: - mass_fraction = X10; + mass_fraction = unit_test_rp::X10; break; case 11: - mass_fraction = X11; + mass_fraction = unit_test_rp::X11; break; case 12: - mass_fraction = X12; + mass_fraction = unit_test_rp::X12; break; case 13: - mass_fraction = X13; + mass_fraction = unit_test_rp::X13; break; case 14: - mass_fraction = X14; + mass_fraction = unit_test_rp::X14; break; case 15: - mass_fraction = X15; + mass_fraction = unit_test_rp::X15; break; case 16: - mass_fraction = X16; + mass_fraction = unit_test_rp::X16; break; case 17: - mass_fraction = X17; + mass_fraction = unit_test_rp::X17; break; case 18: - mass_fraction = X18; + mass_fraction = unit_test_rp::X18; break; case 19: - mass_fraction = X19; + mass_fraction = unit_test_rp::X19; break; case 20: - mass_fraction = X20; + mass_fraction = unit_test_rp::X20; break; case 21: - mass_fraction = X21; + mass_fraction = unit_test_rp::X21; break; case 22: - mass_fraction = X22; + mass_fraction = unit_test_rp::X22; break; case 23: - mass_fraction = X23; + mass_fraction = unit_test_rp::X23; break; case 24: - mass_fraction = X24; + mass_fraction = unit_test_rp::X24; break; case 25: - mass_fraction = X25; + mass_fraction = unit_test_rp::X25; break; case 26: - mass_fraction = X26; + mass_fraction = unit_test_rp::X26; break; case 27: - mass_fraction = X27; + mass_fraction = unit_test_rp::X27; break; case 28: - mass_fraction = X28; + mass_fraction = unit_test_rp::X28; break; case 29: - mass_fraction = X29; + mass_fraction = unit_test_rp::X29; break; case 30: - mass_fraction = X30; + mass_fraction = unit_test_rp::X30; break; case 31: - mass_fraction = X31; + mass_fraction = unit_test_rp::X31; break; case 32: - mass_fraction = X32; + mass_fraction = unit_test_rp::X32; break; case 33: - mass_fraction = X33; + mass_fraction = unit_test_rp::X33; break; case 34: - mass_fraction = X34; + mass_fraction = unit_test_rp::X34; break; case 35: - mass_fraction = X35; + mass_fraction = unit_test_rp::X35; break; } diff --git a/unit_test/test_conductivity/conductivity_util.cpp b/unit_test/test_conductivity/conductivity_util.cpp index 5151f0b9ac..ca31bd202c 100644 --- a/unit_test/test_conductivity/conductivity_util.cpp +++ b/unit_test/test_conductivity/conductivity_util.cpp @@ -10,12 +10,10 @@ #include #include #include +#include #include -using namespace amrex::literals; -using namespace unit_test_rp; - void cond_test_C(const amrex::Box& bx, const amrex::Real dlogrho, const amrex::Real dlogT, const amrex::Real dmetal, const plot_t& vars, @@ -32,16 +30,16 @@ void cond_test_C(const amrex::Box& bx, eos_extra_t eos_state; - for (int n = 0; n < NumSpec; n++) { - eos_state.xn[n] = metalicity/(NumSpec - 2); + for (double& X : eos_state.xn) { + X = metalicity / static_cast(NumSpec - 2); } eos_state.xn[ih1] = 0.75 - 0.5*metalicity; eos_state.xn[ihe4] = 0.25 - 0.5*metalicity; - amrex::Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast(j)*dlogT); + amrex::Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT); eos_state.T = temp_zone; - amrex::Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast(i)*dlogrho); + amrex::Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho); eos_state.rho = dens_zone; // store default state diff --git a/unit_test/test_conductivity/main.cpp b/unit_test/test_conductivity/main.cpp index ff02e80fc9..461b17e7bc 100644 --- a/unit_test/test_conductivity/main.cpp +++ b/unit_test/test_conductivity/main.cpp @@ -21,8 +21,6 @@ using namespace amrex; #include -using namespace unit_test_rp; - int main (int argc, char* argv[]) { amrex::Initialize(argc, argv); @@ -95,7 +93,7 @@ void main_main () init_unit_test(); - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); network_init(); conductivity_init(); @@ -130,9 +128,9 @@ void main_main () Real dmetal = 0.0e0_rt; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1); - dmetal = (metalicity_max - 0.0)/(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min))/(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/(n_cell - 1); + dmetal = (unit_test_rp::metalicity_max - 0.0)/(n_cell - 1); } // Initialize the state and compute the different thermodynamics diff --git a/unit_test/test_jac/jac_zones.H b/unit_test/test_jac/jac_zones.H index afb4616e23..553106c959 100644 --- a/unit_test/test_jac/jac_zones.H +++ b/unit_test/test_jac/jac_zones.H @@ -9,7 +9,6 @@ #include #include #include -#include #include AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/unit_test/test_jac/main.cpp b/unit_test/test_jac/main.cpp index e9ca42f556..2aa372b6f6 100644 --- a/unit_test/test_jac/main.cpp +++ b/unit_test/test_jac/main.cpp @@ -99,7 +99,7 @@ void main_main () init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); @@ -124,8 +124,8 @@ void main_main () Real dlogT; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min)) / static_cast(n_cell - 1); } else { dlogrho = 0.0_rt; dlogT = 0.0_rt; @@ -144,12 +144,12 @@ void main_main () { state_arr(i, j, k, vars.itemp) = - std::pow(10.0_rt, (std::log10(temp_min) + static_cast(j)*dlogT)); + std::pow(10.0_rt, (std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT)); state_arr(i, j, k, vars.irho) = - std::pow(10.0_rt, (std::log10(dens_min) + static_cast(i)*dlogrho)); + std::pow(10.0_rt, (std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho)); Real xn[NumSpec]; - get_xn(k, comp_data, xn, uniform_xn); + get_xn(k, comp_data, xn, unit_test_rp::uniform_xn); for (int n = 0; n < NumSpec; n++) { state_arr(i, j, k, vars.ispec_old+n) = diff --git a/unit_test/test_neutrino_cooling/main.cpp b/unit_test/test_neutrino_cooling/main.cpp index 24d498f520..76668239c4 100644 --- a/unit_test/test_neutrino_cooling/main.cpp +++ b/unit_test/test_neutrino_cooling/main.cpp @@ -21,8 +21,6 @@ using namespace amrex; #include #include -using namespace unit_test_rp; - int main (int argc, char* argv[]) { amrex::Initialize(argc, argv); @@ -96,7 +94,7 @@ void main_main () init_unit_test(); - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); network_init(); @@ -129,9 +127,9 @@ void main_main () Real dmetal = 0.0e0_rt; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min)) / static_cast(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/ static_cast(n_cell - 1); - dmetal = (metalicity_max - 0.0_rt)/ static_cast(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min))/ static_cast(n_cell - 1); + dmetal = (unit_test_rp::metalicity_max - 0.0_rt)/ static_cast(n_cell - 1); } // Initialize the state and compute the different thermodynamics diff --git a/unit_test/test_neutrino_cooling/neutrino_util.cpp b/unit_test/test_neutrino_cooling/neutrino_util.cpp index efa6c70bb4..b42b79ee50 100644 --- a/unit_test/test_neutrino_cooling/neutrino_util.cpp +++ b/unit_test/test_neutrino_cooling/neutrino_util.cpp @@ -9,13 +9,13 @@ #include #include #include +#include #include #include using namespace amrex; -using namespace unit_test_rp; void neut_test_C(const Box& bx, const Real dlogrho, const Real dlogT, const Real dmetal, @@ -43,15 +43,15 @@ void neut_test_C(const Box& bx, // for now... the screening using 1-based indexing Array1D ymass; - for (int n = 0; n < NumSpec; n++) { - xn[n] = metalicity / static_cast(NumSpec - 2); + for (double& X : xn) { + X = metalicity / static_cast(NumSpec - 2); } xn[ih1] = 0.75_rt - 0.5_rt * metalicity; xn[ihe4] = 0.25_rt - 0.5_rt * metalicity; - Real temp_zone = std::pow(10.0, std::log10(temp_min) + static_cast(j)*dlogT); + Real temp_zone = std::pow(10.0, std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT); - Real dens_zone = std::pow(10.0, std::log10(dens_min) + static_cast(i)*dlogrho); + Real dens_zone = std::pow(10.0, std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho); // store default state sp(i, j, k, vars.irho) = dens_zone; diff --git a/unit_test/test_nse_interp/nse_cell.H b/unit_test/test_nse_interp/nse_cell.H index 397a88fe2c..c1eb3cf3f1 100644 --- a/unit_test/test_nse_interp/nse_cell.H +++ b/unit_test/test_nse_interp/nse_cell.H @@ -15,27 +15,31 @@ AMREX_INLINE void nse_cell_c() { - using namespace unit_test_rp; - - std::cout << "rho, T, Ye = " << density << " " << temperature << " " << ye << std::endl; + std::cout << "rho, T, Ye = " + << unit_test_rp::density << " " + << unit_test_rp::temperature << " " + << unit_test_rp::ye << std::endl; // check the indices - amrex::Real logrho = std::log10(density); - amrex::Real logT = std::log10(temperature); + amrex::Real logrho = std::log10(unit_test_rp::density); + amrex::Real logT = std::log10(unit_test_rp::temperature); int ir0 = nse_get_logrho_index(logrho); int it0 = nse_get_logT_index(logT); - int ic0 = nse_get_ye_index(ye); + int ic0 = nse_get_ye_index(unit_test_rp::ye); std::cout << "density value brackets: " - << nse_table_logrho(ir0) << " < " << logrho << " < " << nse_table_logrho(ir0+1) << std::endl; + << nse_table_logrho(ir0) << " < " << logrho << " < " + << nse_table_logrho(ir0+1) << std::endl; std::cout << "temperature value brackets: " - << nse_table_logT(it0) << " < " << logT << " < " << nse_table_logT(it0+1) << std::endl; + << nse_table_logT(it0) << " < " << logT << " < " + << nse_table_logT(it0+1) << std::endl; std::cout << "Ye value brackets: " - << nse_table_ye(ic0) << " < " << ye << " < " << nse_table_ye(ic0+1) << std::endl; + << nse_table_ye(ic0) << " < " << unit_test_rp::ye << " < " + << nse_table_ye(ic0+1) << std::endl; std::cout << std::endl; @@ -117,16 +121,16 @@ void nse_cell_c() std::cout << std::endl; std::cout << "cubic interpolated value: " << - cubic(yes, _d, -nse_table_size::dye, ye) << std::endl << std::endl; + cubic(yes, _d, -nse_table_size::dye, unit_test_rp::ye) << std::endl << std::endl; } std::cout << "tricubic interpolated values: " << std::endl; nse_table_t nse_state; - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -147,9 +151,9 @@ void nse_cell_c() std::cout << "first finite-difference derivatives" << std::endl; - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -167,10 +171,10 @@ void nse_cell_c() std::cout << "now using derivative of the interpolant" << std::endl; - amrex::Real dabardT = nse_interp_dT(temperature, density, ye, + amrex::Real dabardT = nse_interp_dT(unit_test_rp::temperature, unit_test_rp::density, unit_test_rp::ye, nse_table::abartab); - amrex::Real dbeadT = nse_interp_dT(temperature, density, ye, + amrex::Real dbeadT = nse_interp_dT(unit_test_rp::temperature, unit_test_rp::density, unit_test_rp::ye, nse_table::beatab); std::cout << "dAbar/dT = " << dabardT << std::endl; @@ -185,9 +189,9 @@ void nse_cell_c() std::cout << "first finite-difference derivatives" << std::endl; - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -202,10 +206,10 @@ void nse_cell_c() std::cout << "now using derivative of the interpolant" << std::endl; - amrex::Real dabardrho = nse_interp_drho(temperature, density, ye, + amrex::Real dabardrho = nse_interp_drho(unit_test_rp::temperature, unit_test_rp::density, unit_test_rp::ye, nse_table::abartab); - amrex::Real dbeadrho = nse_interp_drho(temperature, density, ye, + amrex::Real dbeadrho = nse_interp_drho(unit_test_rp::temperature, unit_test_rp::density, unit_test_rp::ye, nse_table::beatab); std::cout << "dAbar/drho = " << dabardrho << std::endl; @@ -241,9 +245,9 @@ void nse_cell_c() // first get the abar consistent with our inputs and find e - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -251,8 +255,8 @@ void nse_cell_c() eos_t eos_state; - eos_state.T = temperature; - eos_state.rho = density; + eos_state.T = unit_test_rp::temperature; + eos_state.rho = unit_test_rp::density; eos_state.aux[iye] = nse_state.Ye; eos_state.aux[iabar] = nse_state.abar; @@ -280,10 +284,10 @@ void nse_cell_c() // now we try the new interface. This effectively does: // e', rho, Ye -> Abar', T' - eos_state.T = temperature; + eos_state.T = unit_test_rp::temperature; eos_state.e = e_new; - eos_state.rho = density; - eos_state.aux[iye] = ye; + eos_state.rho = unit_test_rp::density; + eos_state.aux[iye] = unit_test_rp::ye; eos_state.aux[iabar] = abar_orig; amrex::Real abar_start = eos_state.aux[iabar]; @@ -307,9 +311,9 @@ void nse_cell_c() // now redo it for pressure - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -317,8 +321,8 @@ void nse_cell_c() eos_t eos_state; - eos_state.T = temperature; - eos_state.rho = density; + eos_state.T = unit_test_rp::temperature; + eos_state.rho = unit_test_rp::density; eos_state.aux[iye] = nse_state.Ye; eos_state.aux[iabar] = nse_state.abar; @@ -346,10 +350,10 @@ void nse_cell_c() // now we try the new interface. This effectively does: // p', rho, Ye -> Abar', T' - eos_state.T = temperature; + eos_state.T = unit_test_rp::temperature; eos_state.p = p_new; - eos_state.rho = density; - eos_state.aux[iye] = ye; + eos_state.rho = unit_test_rp::density; + eos_state.aux[iye] = unit_test_rp::ye; eos_state.aux[iabar] = abar_orig; amrex::Real abar_start = eos_state.aux[iabar]; @@ -375,9 +379,9 @@ void nse_cell_c() { - nse_state.T = temperature; - nse_state.rho = density; - nse_state.Ye = ye; + nse_state.T = unit_test_rp::temperature; + nse_state.rho = unit_test_rp::density; + nse_state.Ye = unit_test_rp::ye; nse_interp(nse_state); @@ -385,8 +389,8 @@ void nse_cell_c() eos_t eos_state; - eos_state.T = temperature; - eos_state.rho = density; + eos_state.T = unit_test_rp::temperature; + eos_state.rho = unit_test_rp::density; eos_state.aux[iye] = nse_state.Ye; eos_state.aux[iabar] = nse_state.abar; @@ -414,10 +418,10 @@ void nse_cell_c() // now we try the new interface. This effectively does: // p', T, Ye -> Abar', rho' - eos_state.T = temperature; + eos_state.T = unit_test_rp::temperature; eos_state.p = p_new; - eos_state.rho = density; - eos_state.aux[iye] = ye; + eos_state.rho = unit_test_rp::density; + eos_state.aux[iye] = unit_test_rp::ye; eos_state.aux[iabar] = abar_orig; amrex::Real abar_start = eos_state.aux[iabar]; diff --git a/unit_test/test_react/main.cpp b/unit_test/test_react/main.cpp index 0a47397c39..35c0b1da2f 100644 --- a/unit_test/test_react/main.cpp +++ b/unit_test/test_react/main.cpp @@ -105,7 +105,7 @@ void main_main () init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); @@ -130,8 +130,8 @@ void main_main () Real dlogT; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min)) / static_cast(n_cell - 1); } else { dlogrho = 0.0_rt; dlogT = 0.0_rt; @@ -153,12 +153,12 @@ void main_main () { state_arr(i, j, k, vars.itemp) = - std::pow(10.0_rt, (std::log10(temp_min) + static_cast(j)*dlogT)); + std::pow(10.0_rt, (std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT)); state_arr(i, j, k, vars.irho) = - std::pow(10.0_rt, (std::log10(dens_min) + static_cast(i)*dlogrho)); + std::pow(10.0_rt, (std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho)); Real xn[NumSpec]; - get_xn(k, comp_data, xn, uniform_xn); + get_xn(k, comp_data, xn, unit_test_rp::uniform_xn); for (int n = 0; n < NumSpec; n++) { state_arr(i, j, k, vars.ispec_old+n) = diff --git a/unit_test/test_react/react_zones.H b/unit_test/test_react/react_zones.H index fbced3c425..1eef158425 100644 --- a/unit_test/test_react/react_zones.H +++ b/unit_test/test_react/react_zones.H @@ -9,8 +9,6 @@ #include #include -using namespace unit_test_rp; - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool do_react (int i, int j, int k, amrex::Array4 const& state, burn_t& burn_state, amrex::Array4 const& n_rhs, const plot_t& p) @@ -34,7 +32,7 @@ bool do_react (int i, int j, int k, amrex::Array4 const& state, // energy. burn_state.e = 0.0_rt; - amrex::Real dt = tmax; + amrex::Real dt = unit_test_rp::tmax; burn_state.i = i; burn_state.j = j; diff --git a/unit_test/test_rhs/main.cpp b/unit_test/test_rhs/main.cpp index ae01b38747..e7ee5fcb20 100644 --- a/unit_test/test_rhs/main.cpp +++ b/unit_test/test_rhs/main.cpp @@ -107,7 +107,7 @@ void main_main () } // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); @@ -132,8 +132,8 @@ void main_main () Real dlogT; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min)) / static_cast(n_cell - 1); } else { dlogrho = 0.0_rt; dlogT = 0.0_rt; @@ -152,12 +152,12 @@ void main_main () { state_arr(i, j, k, vars.itemp) = - std::pow(10.0_rt, (std::log10(temp_min) + static_cast(j)*dlogT)); + std::pow(10.0_rt, (std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT)); state_arr(i, j, k, vars.irho) = - std::pow(10.0_rt, (std::log10(dens_min) + static_cast(i)*dlogrho)); + std::pow(10.0_rt, (std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho)); Real xn[NumSpec]; - get_xn(k, comp_data, xn, uniform_xn); + get_xn(k, comp_data, xn, unit_test_rp::uniform_xn); for (int n = 0; n < NumSpec; n++) { state_arr(i, j, k, vars.ispec_old+n) = diff --git a/unit_test/test_rhs/rhs_zones.H b/unit_test/test_rhs/rhs_zones.H index 5c1cefded3..87a3ec559a 100644 --- a/unit_test/test_rhs/rhs_zones.H +++ b/unit_test/test_rhs/rhs_zones.H @@ -13,8 +13,6 @@ #include #include -using namespace unit_test_rp; - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool do_rhs (int i, int j, int k, amrex::Array4 const& state, const plot_t& p) { diff --git a/unit_test/test_sdc/main.cpp b/unit_test/test_sdc/main.cpp index 0a9886b46b..9b75a9ab57 100644 --- a/unit_test/test_sdc/main.cpp +++ b/unit_test/test_sdc/main.cpp @@ -103,7 +103,7 @@ void main_main () init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); @@ -129,8 +129,8 @@ void main_main () Real dlogT; if (n_cell > 1) { - dlogrho = (std::log10(dens_max) - std::log10(dens_min))/(n_cell - 1); - dlogT = (std::log10(temp_max) - std::log10(temp_min))/(n_cell - 1); + dlogrho = (std::log10(unit_test_rp::dens_max) - std::log10(unit_test_rp::dens_min)) / static_cast(n_cell - 1); + dlogT = (std::log10(unit_test_rp::temp_max) - std::log10(unit_test_rp::temp_min)) / static_cast(n_cell - 1); } else { dlogrho = 0.0_rt; dlogT = 0.0_rt; @@ -149,12 +149,12 @@ void main_main () { state_arr(i, j, k, vars.itemp) = - std::pow(10.0_rt, (std::log10(temp_min) + static_cast(j)*dlogT)); + std::pow(10.0_rt, (std::log10(unit_test_rp::temp_min) + static_cast(j)*dlogT)); state_arr(i, j, k, vars.irho) = - std::pow(10.0_rt, (std::log10(dens_min) + static_cast(i)*dlogrho)); + std::pow(10.0_rt, (std::log10(unit_test_rp::dens_min) + static_cast(i)*dlogrho)); Real xn[NumSpec]; - get_xn(k, comp_data, xn, uniform_xn); + get_xn(k, comp_data, xn, unit_test_rp::uniform_xn); for (int n = 0; n < NumSpec; n++) { state_arr(i, j, k, vars.ispec_old+n) = diff --git a/unit_test/test_sdc/react_zones.H b/unit_test/test_sdc/react_zones.H index bde1350b5d..ba7e694a37 100644 --- a/unit_test/test_sdc/react_zones.H +++ b/unit_test/test_sdc/react_zones.H @@ -9,8 +9,6 @@ #include #include -using namespace unit_test_rp; - AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool do_react (const plot_t& p, const int i, const int j, const int k, Array4 const& state, Array4 const& n_rhs) @@ -97,12 +95,12 @@ bool do_react (const plot_t& p, const int i, const int j, const int k, burn_state.sdc_iter = 1; burn_state.num_sdc_iters = 1; - burner(burn_state, tmax); + burner(burn_state, unit_test_rp::tmax); for (int n = 0; n < NumSpec; ++n) { state(i, j, k, p.ispec + n) = burn_state.y[SFS+n]/burn_state.rho; state(i, j, k, p.irodot + n) = (burn_state.y[SFS+n] - - state(i, j, k, p.irho) * state(i, j, k, p.ispec_old + n)) / tmax; + state(i, j, k, p.irho) * state(i, j, k, p.ispec_old + n)) / unit_test_rp::tmax; } #if NAUX_NET > 0 @@ -111,7 +109,7 @@ bool do_react (const plot_t& p, const int i, const int j, const int k, } #endif - state(i, j, k, p.irho_Hnuc) = (burn_state.y[SEINT] - rhoe_old) / tmax; + state(i, j, k, p.irho_Hnuc) = (burn_state.y[SEINT] - rhoe_old) / unit_test_rp::tmax; n_rhs(i, j, k, 0) = burn_state.n_rhs; diff --git a/unit_test/test_sdc_vode_rhs/main.cpp b/unit_test/test_sdc_vode_rhs/main.cpp index 8369c89429..04a0ff452a 100644 --- a/unit_test/test_sdc_vode_rhs/main.cpp +++ b/unit_test/test_sdc_vode_rhs/main.cpp @@ -42,7 +42,7 @@ void main_main () init_unit_test(); // C++ EOS initialization (must be done after init_extern_parameters) - eos_init(small_temp, small_dens); + eos_init(unit_test_rp::small_temp, unit_test_rp::small_dens); // C++ Network, RHS, screening, rates initialization network_init(); diff --git a/unit_test/test_sdc_vode_rhs/vode_rhs_test.H b/unit_test/test_sdc_vode_rhs/vode_rhs_test.H index 8c4c89c96b..7a70eecdfe 100644 --- a/unit_test/test_sdc_vode_rhs/vode_rhs_test.H +++ b/unit_test/test_sdc_vode_rhs/vode_rhs_test.H @@ -10,11 +10,11 @@ #include #include #include +#include #include +#include #include -using namespace unit_test_rp; - AMREX_INLINE void do_vode_rhs() { @@ -60,94 +60,94 @@ void do_vode_rhs() switch (n) { case 1: - adv_species[n-1] = Adv_X1; + adv_species[n-1] = unit_test_rp::Adv_X1; break; case 2: - adv_species[n-1] = Adv_X2; + adv_species[n-1] = unit_test_rp::Adv_X2; break; case 3: - adv_species[n-1] = Adv_X3; + adv_species[n-1] = unit_test_rp::Adv_X3; break; case 4: - adv_species[n-1] = Adv_X4; + adv_species[n-1] = unit_test_rp::Adv_X4; break; case 5: - adv_species[n-1] = Adv_X5; + adv_species[n-1] = unit_test_rp::Adv_X5; break; case 6: - adv_species[n-1] = Adv_X6; + adv_species[n-1] = unit_test_rp::Adv_X6; break; case 7: - adv_species[n-1] = Adv_X7; + adv_species[n-1] = unit_test_rp::Adv_X7; break; case 8: - adv_species[n-1] = Adv_X8; + adv_species[n-1] = unit_test_rp::Adv_X8; break; case 9: - adv_species[n-1] = Adv_X9; + adv_species[n-1] = unit_test_rp::Adv_X9; break; case 10: - adv_species[n-1] = Adv_X10; + adv_species[n-1] = unit_test_rp::Adv_X10; break; case 11: - adv_species[n-1] = Adv_X11; + adv_species[n-1] = unit_test_rp::Adv_X11; break; case 12: - adv_species[n-1] = Adv_X12; + adv_species[n-1] = unit_test_rp::Adv_X12; break; case 13: - adv_species[n-1] = Adv_X13; + adv_species[n-1] = unit_test_rp::Adv_X13; break; case 14: - adv_species[n-1] = Adv_X14; + adv_species[n-1] = unit_test_rp::Adv_X14; break; case 15: - adv_species[n-1] = Adv_X15; + adv_species[n-1] = unit_test_rp::Adv_X15; break; case 16: - adv_species[n-1] = Adv_X16; + adv_species[n-1] = unit_test_rp::Adv_X16; break; case 17: - adv_species[n-1] = Adv_X17; + adv_species[n-1] = unit_test_rp::Adv_X17; break; case 18: - adv_species[n-1] = Adv_X18; + adv_species[n-1] = unit_test_rp::Adv_X18; break; case 19: - adv_species[n-1] = Adv_X19; + adv_species[n-1] = unit_test_rp::Adv_X19; break; case 20: - adv_species[n-1] = Adv_X20; + adv_species[n-1] = unit_test_rp::Adv_X20; break; case 21: - adv_species[n-1] = Adv_X21; + adv_species[n-1] = unit_test_rp::Adv_X21; break; case 22: - adv_species[n-1] = Adv_X22; + adv_species[n-1] = unit_test_rp::Adv_X22; break; case 23: - adv_species[n-1] = Adv_X23; + adv_species[n-1] = unit_test_rp::Adv_X23; break; case 24: - adv_species[n-1] = Adv_X24; + adv_species[n-1] = unit_test_rp::Adv_X24; break; case 25: - adv_species[n-1] = Adv_X25; + adv_species[n-1] = unit_test_rp::Adv_X25; break; case 26: - adv_species[n-1] = Adv_X26; + adv_species[n-1] = unit_test_rp::Adv_X26; break; case 27: - adv_species[n-1] = Adv_X27; + adv_species[n-1] = unit_test_rp::Adv_X27; break; case 28: - adv_species[n-1] = Adv_X28; + adv_species[n-1] = unit_test_rp::Adv_X28; break; case 29: - adv_species[n-1] = Adv_X29; + adv_species[n-1] = unit_test_rp::Adv_X29; break; case 30: - adv_species[n-1] = Adv_X30; + adv_species[n-1] = unit_test_rp::Adv_X30; break; } @@ -162,13 +162,13 @@ void do_vode_rhs() switch (n) { case 1: - adv_aux[n-1] = Adv_Aux1; + adv_aux[n-1] = unit_test_rp::Adv_Aux1; break; case 2: - adv_aux[n-1] = Adv_Aux2; + adv_aux[n-1] = unit_test_rp::Adv_Aux2; break; case 3: - adv_aux[n-1] = Adv_Aux3; + adv_aux[n-1] = unit_test_rp::Adv_Aux3; break; } @@ -179,8 +179,8 @@ void do_vode_rhs() // Echo initial conditions at burn and fill burn state input - std::cout << "State Density (g/cm^3): " << density << std::endl; - std::cout << "State Temperature (K): " << temperature << std::endl; + std::cout << "State Density (g/cm^3): " << unit_test_rp::density << std::endl; + std::cout << "State Temperature (K): " << unit_test_rp::temperature << std::endl; for (int n = 0; n < NumSpec; ++n) { std::cout << "Mass Fraction (" << short_spec_names_cxx[n] << "): " << massfractions[n] << std::endl; } @@ -192,8 +192,8 @@ void do_vode_rhs() burn_t burn_state; eos_extra_t eos_state; - eos_state.rho = density; - eos_state.T = temperature; + eos_state.rho = unit_test_rp::density; + eos_state.T = unit_test_rp::temperature; for (int n = 0; n < NumSpec; n++) { eos_state.xn[n] = massfractions[n]; } @@ -218,7 +218,7 @@ void do_vode_rhs() } #endif - burn_state.y[SRHO] = density; + burn_state.y[SRHO] = unit_test_rp::density; burn_state.y[SMX] = 0.0; burn_state.y[SMY] = 0.0; @@ -233,8 +233,8 @@ void do_vode_rhs() // actually used during the integration are for rho, (rho X), and // (rho e) - burn_state.ydot_a[SRHO] = Adv_rho; - burn_state.ydot_a[SEINT] = Adv_rhoe; + burn_state.ydot_a[SRHO] = unit_test_rp::Adv_rho; + burn_state.ydot_a[SEINT] = unit_test_rp::Adv_rhoe; for (int n = 0; n < NumSpec; n++) { burn_state.ydot_a[SFS+n] = adv_species[n]; @@ -264,7 +264,9 @@ void do_vode_rhs() // now make the dvode_t - dvode_t vode_state; + constexpr int int_neqs = integrator_neqs(); + + dvode_t vode_state; vode_state.t = 0.0_rt; @@ -277,10 +279,10 @@ void do_vode_rhs() vode_state.t = 0.0_rt; vode_state.tn = 0.0_rt; // this is needed for directly accessing the jac() function - vode_state.H = tmax/1000.0_rt; // needed for jacobian = 3 scaling - vode_state.tout = tmax; - vode_state.NFE = 0; - vode_state.NJE = 0; + vode_state.H = unit_test_rp::tmax/1000.0_rt; // needed for jacobian = 3 scaling + vode_state.tout = unit_test_rp::tmax; + vode_state.n_rhs = 0; + vode_state.n_jac = 0; burn_to_int(burn_state, vode_state); @@ -292,7 +294,7 @@ void do_vode_rhs() rhs(0.0_rt, burn_state, vode_state, ydot); std::cout << "ydot = " << std::endl; - for (int n = 1; n <= VODE_NEQS; n++) { + for (int n = 1; n <= int_neqs; n++) { std::cout << n << " " << ydot(n) << std::endl; } @@ -302,8 +304,8 @@ void do_vode_rhs() const amrex::Real time = 0.0_rt; jac(time, burn_state, vode_state, pd); - for (int row = 1; row <= VODE_NEQS; ++row) { - for (int col = 1; col <= VODE_NEQS; ++col) { + for (int row = 1; row <= int_neqs; ++row) { + for (int col = 1; col <= int_neqs; ++col) { std::cout << "(" << std::setw(2) << row << "," << std::setw(2) << col << ") = " << pd(row,col) << std::endl; } } @@ -312,7 +314,7 @@ void do_vode_rhs() std::cout << "now do a burn" << std::endl; - integrator(burn_state, tmax); + integrator(burn_state, unit_test_rp::tmax); for (int n = 0; n < SVAR; n++) { if (n == SFS) {