From b35e24be0d77fb33663b59c3b4f72f64b2540db6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:13:40 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/AdvectionSimulation.hpp | 4 +- src/CheckNaN.hpp | 4 +- src/DiagPDF.cpp | 14 +++---- src/EOS.hpp | 27 ++++++------- src/LLF.hpp | 4 +- src/NSCBC/vortex.cpp | 2 +- src/NSCBC_inflow.hpp | 9 ++--- src/NSCBC_outflow.hpp | 8 ++-- src/RadForce/test_radiation_force.cpp | 8 ++-- src/RadMarshak/test_radiation_marshak.cpp | 6 +-- .../test_radiation_marshak_asymptotic.cpp | 12 +++--- .../test_radiation_marshak_cgs.cpp | 22 +++++----- .../test_radiation_matter_coupling.cpp | 6 +-- .../test_radiation_matter_coupling_rsla.cpp | 6 +-- src/RadPulse/test_radiation_pulse.cpp | 4 +- src/RadStreaming/test_radiation_streaming.cpp | 4 +- src/RadSuOlson/test_radiation_SuOlson.cpp | 6 +-- src/RadTophat/test_radiation_tophat.cpp | 16 ++++---- .../test_radhydro_pulse_MG.cpp | 8 ++-- src/RadhydroShock/test_radhydro_shock.cpp | 4 +- .../test_radhydro_shock_cgs.cpp | 4 +- .../test_radhydro_shock_multigroup.cpp | 4 +- src/RadhydroSimulation.hpp | 16 ++++---- src/fextract.cpp | 4 +- src/fextract.hpp | 4 +- src/hydro_system.hpp | 40 +++++++++++-------- src/hyperbolic_system.hpp | 4 +- src/linear_advection.hpp | 4 +- src/radiation_system.hpp | 40 +++++++++---------- src/simulation.hpp | 5 +-- 30 files changed, 148 insertions(+), 151 deletions(-) diff --git a/src/AdvectionSimulation.hpp b/src/AdvectionSimulation.hpp index 905849cbc..920bffe7e 100644 --- a/src/AdvectionSimulation.hpp +++ b/src/AdvectionSimulation.hpp @@ -375,8 +375,8 @@ template void AdvectionSimulation::advanceSingle } template -auto AdvectionSimulation::computeFluxes(amrex::MultiFab const &consVar, const int nvars, const int lev) - -> std::array +auto AdvectionSimulation::computeFluxes(amrex::MultiFab const &consVar, const int nvars, + const int lev) -> std::array { auto ba = grids[lev]; auto dm = dmap[lev]; diff --git a/src/CheckNaN.hpp b/src/CheckNaN.hpp index 107f73693..b81122043 100644 --- a/src/CheckNaN.hpp +++ b/src/CheckNaN.hpp @@ -23,8 +23,8 @@ AMREX_GPU_HOST_DEVICE auto CheckSymmetryArray(amrex::Array4 c template AMREX_GPU_HOST_DEVICE auto CheckSymmetryFluxes(amrex::Array4 const & /*arr1*/, amrex::Array4 const & /*arr2*/, - amrex::Box const & /*indexRange*/, const int /*ncomp*/, amrex::GpuArray /*dx*/) - -> bool + amrex::Box const & /*indexRange*/, const int /*ncomp*/, + amrex::GpuArray /*dx*/) -> bool { return true; // problem-specific implementation for test problems } diff --git a/src/DiagPDF.cpp b/src/DiagPDF.cpp index cca9f6d6c..d5154d5ef 100644 --- a/src/DiagPDF.cpp +++ b/src/DiagPDF.cpp @@ -300,10 +300,8 @@ void DiagPDF::writePDFToFile(int a_nstep, const amrex::Real &a_time, const amrex } // write cycle and simulation time - pdfFile << "# " << std::setw(width) << "time:" - << " " << std::setw(width) << std::setprecision(prec) << std::scientific << a_time << "\n"; - pdfFile << "# " << std::setw(width) << "cycle:" - << " " << std::setw(width) << a_nstep << "\n"; + pdfFile << "# " << std::setw(width) << "time:" << " " << std::setw(width) << std::setprecision(prec) << std::scientific << a_time << "\n"; + pdfFile << "# " << std::setw(width) << "cycle:" << " " << std::setw(width) << a_nstep << "\n"; // write variable names pdfFile << "# " << std::setw(width) << "variables:"; @@ -321,13 +319,11 @@ void DiagPDF::writePDFToFile(int a_nstep, const amrex::Real &a_time, const amrex // write column names for variables for (int n = 0; n < nvars; ++n) { - pdfFile << std::setw(widths[n][0]) << m_varNames[n] + "_idx" - << " " << std::setw(widths[n][0]) << m_varNames[n] + "_min" - << " " << std::setw(widths[n][1]) << m_varNames[n] + "_max"; + pdfFile << std::setw(widths[n][0]) << m_varNames[n] + "_idx" << " " << std::setw(widths[n][0]) << m_varNames[n] + "_min" << " " + << std::setw(widths[n][1]) << m_varNames[n] + "_max"; } // write out column name for histogram value: "mass_sum", "volume_sum", or "cell_counts_sum" - pdfFile << " " << std::setw(width) << m_weightType + "_sum" - << "\n"; + pdfFile << " " << std::setw(width) << m_weightType + "_sum" << "\n"; std::vector transformed_range(nvars); std::vector transformed_binWidth(nvars); diff --git a/src/EOS.hpp b/src/EOS.hpp index 644af4f77..9e81d3a7a 100644 --- a/src/EOS.hpp +++ b/src/EOS.hpp @@ -68,9 +68,8 @@ template class EOS }; template -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeTgasFromEint(amrex::Real rho, amrex::Real Eint, - const std::optional> massScalars) - -> amrex::Real +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto +EOS::ComputeTgasFromEint(amrex::Real rho, amrex::Real Eint, const std::optional> massScalars) -> amrex::Real { // return temperature for an ideal gas given density and internal energy amrex::Real Tgas = NAN; @@ -108,9 +107,8 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeTgasFromEin } template -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas, - const std::optional> massScalars) - -> amrex::Real +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto +EOS::ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas, const std::optional> massScalars) -> amrex::Real { // return internal energy density given density and temperature amrex::Real Eint = NAN; @@ -149,9 +147,9 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeEintFromTga } template -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure, - const std::optional> massScalars) - -> amrex::Real +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto +EOS::ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure, + const std::optional> massScalars) -> amrex::Real { // return internal energy density given density and pressure amrex::Real Eint = NAN; @@ -283,9 +281,8 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeOtherDeriva } template -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputePressure(amrex::Real rho, amrex::Real Eint, - const std::optional> massScalars) - -> amrex::Real +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto +EOS::ComputePressure(amrex::Real rho, amrex::Real Eint, const std::optional> massScalars) -> amrex::Real { // return pressure for an ideal gas amrex::Real P = NAN; @@ -326,9 +323,9 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputePressure(am } template -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure, - const std::optional> massScalars) - -> amrex::Real +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto +EOS::ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure, + const std::optional> massScalars) -> amrex::Real { // return sound speed for an ideal gas amrex::Real cs = NAN; diff --git a/src/LLF.hpp b/src/LLF.hpp index 5bf6a745f..9a265c6f0 100644 --- a/src/LLF.hpp +++ b/src/LLF.hpp @@ -13,8 +13,8 @@ namespace quokka::Riemann { // Local Lax-Friedrichs (LLF) / Rusanov solver template -AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto LLF(quokka::HydroState const &sL, quokka::HydroState const &sR) - -> quokka::valarray +AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto LLF(quokka::HydroState const &sL, + quokka::HydroState const &sR) -> quokka::valarray { // Toro (Eq. 10.56) const amrex::Real Sp = std::max(std::abs(sL.u) + sL.cs, std::abs(sR.u) + sR.cs); diff --git a/src/NSCBC/vortex.cpp b/src/NSCBC/vortex.cpp index 77e9186d3..0c9d305e6 100644 --- a/src/NSCBC/vortex.cpp +++ b/src/NSCBC/vortex.cpp @@ -71,7 +71,7 @@ AMREX_GPU_MANAGED amrex::Real u0 = NAN; // NOLINT(cppcoreguidelines-av AMREX_GPU_MANAGED amrex::Real v0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) AMREX_GPU_MANAGED amrex::Real w0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) AMREX_GPU_MANAGED amrex::GpuArray::nscalars_> s0{}; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) -}; // namespace +}; // namespace template <> void RadhydroSimulation::setInitialConditionsOnGrid(quokka::grid grid_elem) { diff --git a/src/NSCBC_inflow.hpp b/src/NSCBC_inflow.hpp index 823580062..8d6f9241f 100644 --- a/src/NSCBC_inflow.hpp +++ b/src/NSCBC_inflow.hpp @@ -21,11 +21,10 @@ namespace NSCBC namespace detail { template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto dQ_dx_inflow_x1_lower(quokka::valarray::nvar_> const &Q, - quokka::valarray::nvar_> const &dQ_dx_data, const Real T_t, - const Real u_t, const Real v_t, const Real w_t, - amrex::GpuArray::nscalars_> const &s_t, const Real L_x) - -> quokka::valarray::nvar_> +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto +dQ_dx_inflow_x1_lower(quokka::valarray::nvar_> const &Q, quokka::valarray::nvar_> const &dQ_dx_data, + const Real T_t, const Real u_t, const Real v_t, const Real w_t, amrex::GpuArray::nscalars_> const &s_t, + const Real L_x) -> quokka::valarray::nvar_> { // return dQ/dx corresponding to subsonic inflow on the x1 lower boundary // (This is only necessary for continuous inflows, i.e., where a shock or contact discontinuity is not desired.) diff --git a/src/NSCBC_outflow.hpp b/src/NSCBC_outflow.hpp index 55a442395..2b358895f 100644 --- a/src/NSCBC_outflow.hpp +++ b/src/NSCBC_outflow.hpp @@ -199,8 +199,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto transverse_zdir_dQ_data(const amrex::In } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto permute_vel(quokka::valarray::nvar_> const &Q) - -> quokka::valarray::nvar_> +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto +permute_vel(quokka::valarray::nvar_> const &Q) -> quokka::valarray::nvar_> { // with normal direction DIR, permutes the velocity components so that // u, v, w are the normal and transverse components, respectively. @@ -225,8 +225,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto permute_vel(quokka::valarray -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto unpermute_vel(quokka::valarray::nvar_> const &Q) - -> quokka::valarray::nvar_> +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto +unpermute_vel(quokka::valarray::nvar_> const &Q) -> quokka::valarray::nvar_> { // with normal direction DIR, un-permutes the velocity components so that // u, v, w are the normal and transverse components *prior to calling permute_vel*. diff --git a/src/RadForce/test_radiation_force.cpp b/src/RadForce/test_radiation_force.cpp index f7fc0ba0a..084e7b957 100644 --- a/src/RadForce/test_radiation_force.cpp +++ b/src/RadForce/test_radiation_force.cpp @@ -74,8 +74,8 @@ template <> struct RadSystem_Traits { }; template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) - -> quokka::valarray::nGroups> +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(const double /*rho*/, + const double /*Tgas*/) -> quokka::valarray::nGroups> { quokka::valarray::nGroups> kappaPVec{}; for (int g = 0; g < nGroups_; ++g) { @@ -85,8 +85,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(const do } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, const double /*Tgas*/) - -> quokka::valarray::nGroups> +AMREX_GPU_HOST_DEVICE auto +RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, const double /*Tgas*/) -> quokka::valarray::nGroups> { quokka::valarray::nGroups> kappaFVec{}; kappaFVec[0] = kappa0 * 1.5; diff --git a/src/RadMarshak/test_radiation_marshak.cpp b/src/RadMarshak/test_radiation_marshak.cpp index b1996d4d3..11edf31d1 100644 --- a/src/RadMarshak/test_radiation_marshak.cpp +++ b/src/RadMarshak/test_radiation_marshak.cpp @@ -87,9 +87,9 @@ AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintFromTgas(cons } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { // This is also known as the heat capacity, i.e. // \del E_g / \del T = \rho c_v, diff --git a/src/RadMarshakAsymptotic/test_radiation_marshak_asymptotic.cpp b/src/RadMarshakAsymptotic/test_radiation_marshak_asymptotic.cpp index a529210c9..d5734c184 100644 --- a/src/RadMarshakAsymptotic/test_radiation_marshak_asymptotic.cpp +++ b/src/RadMarshakAsymptotic/test_radiation_marshak_asymptotic.cpp @@ -53,8 +53,8 @@ template <> struct Physics_Traits { }; template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, + const double Tgas) -> quokka::valarray { auto sigma = kappa * std::pow(Tgas / T_hohlraum, -3); // cm^-1 quokka::valarray kappaPVec{}; @@ -65,15 +65,15 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::Comp } template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputeFluxMeanOpacity(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputeFluxMeanOpacity(const double rho, + const double Tgas) -> quokka::valarray { return ComputePlanckOpacity(rho, Tgas); } template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto +RadSystem::ComputePlanckOpacityTempDerivative(const double rho, const double Tgas) -> quokka::valarray { quokka::valarray opacity_deriv{}; auto sigma_dT = (-3.0 * kappa / Tgas) * std::pow(Tgas / T_hohlraum, -3); // cm^-1 diff --git a/src/RadMarshakCGS/test_radiation_marshak_cgs.cpp b/src/RadMarshakCGS/test_radiation_marshak_cgs.cpp index 44a4a6849..5ba47c94a 100644 --- a/src/RadMarshakCGS/test_radiation_marshak_cgs.cpp +++ b/src/RadMarshakCGS/test_radiation_marshak_cgs.cpp @@ -68,33 +68,33 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(co } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, const double /*Tgas*/) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, + const double /*Tgas*/) -> quokka::valarray { return ComputePlanckOpacity(0.0, 0.0); } static constexpr int nmscalars_ = Physics_Traits::numMassScalars; template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeTgasFromEint(const double /*rho*/, const double Egas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeTgasFromEint(const double /*rho*/, const double Egas, + std::optional> /*massScalars*/) -> double { return std::pow(4.0 * Egas / alpha_SuOlson, 1. / 4.); } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintFromTgas(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintFromTgas(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { return (alpha_SuOlson / 4.0) * std::pow(Tgas, 4); } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { // This is also known as the heat capacity, i.e. // \del E_g / \del T = \rho c_v, diff --git a/src/RadMatterCoupling/test_radiation_matter_coupling.cpp b/src/RadMatterCoupling/test_radiation_matter_coupling.cpp index 2ff2040c2..66183eddc 100644 --- a/src/RadMatterCoupling/test_radiation_matter_coupling.cpp +++ b/src/RadMatterCoupling/test_radiation_matter_coupling.cpp @@ -87,9 +87,9 @@ AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintFromTgas(con } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { // This is also known as the heat capacity, i.e. // \del E_g / \del T = \rho c_v, diff --git a/src/RadMatterCouplingRSLA/test_radiation_matter_coupling_rsla.cpp b/src/RadMatterCouplingRSLA/test_radiation_matter_coupling_rsla.cpp index fb0dfb169..fd1d29a0d 100644 --- a/src/RadMatterCouplingRSLA/test_radiation_matter_coupling_rsla.cpp +++ b/src/RadMatterCouplingRSLA/test_radiation_matter_coupling_rsla.cpp @@ -89,9 +89,9 @@ AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintFromTgas(con } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { // This is also known as the heat capacity, i.e. // \del E_g / \del T = \rho c_v, diff --git a/src/RadPulse/test_radiation_pulse.cpp b/src/RadPulse/test_radiation_pulse.cpp index 514e05b30..b98db27f4 100644 --- a/src/RadPulse/test_radiation_pulse.cpp +++ b/src/RadPulse/test_radiation_pulse.cpp @@ -82,8 +82,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, + const double Tgas) -> quokka::valarray { quokka::valarray opacity_deriv{}; double opacity_deriv_scalar = 0.; diff --git a/src/RadStreaming/test_radiation_streaming.cpp b/src/RadStreaming/test_radiation_streaming.cpp index fd4e9fd51..7e93694fb 100644 --- a/src/RadStreaming/test_radiation_streaming.cpp +++ b/src/RadStreaming/test_radiation_streaming.cpp @@ -59,8 +59,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(con } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, const double /*Tgas*/) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double /*rho*/, + const double /*Tgas*/) -> quokka::valarray { return ComputePlanckOpacity(0.0, 0.0); } diff --git a/src/RadSuOlson/test_radiation_SuOlson.cpp b/src/RadSuOlson/test_radiation_SuOlson.cpp index 221e14789..65606ba0b 100644 --- a/src/RadSuOlson/test_radiation_SuOlson.cpp +++ b/src/RadSuOlson/test_radiation_SuOlson.cpp @@ -96,9 +96,9 @@ AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintFromTgas(cons } template <> -AMREX_GPU_HOST_DEVICE auto quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, - std::optional> /*massScalars*/) - -> double +AMREX_GPU_HOST_DEVICE auto +quokka::EOS::ComputeEintTempDerivative(const double /*rho*/, const double Tgas, + std::optional> /*massScalars*/) -> double { // This is also known as the heat capacity, i.e. // \del E_g / \del T = \rho c_v, diff --git a/src/RadTophat/test_radiation_tophat.cpp b/src/RadTophat/test_radiation_tophat.cpp index 773c3896f..55932f6c4 100644 --- a/src/RadTophat/test_radiation_tophat.cpp +++ b/src/RadTophat/test_radiation_tophat.cpp @@ -60,8 +60,8 @@ template <> struct Physics_Traits { }; template <> -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(const double rho, const double /*Tgas*/) - -> quokka::valarray +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacity(const double rho, + const double /*Tgas*/) -> quokka::valarray { quokka::valarray kappaPVec{}; amrex::Real kappa = 0.; @@ -77,8 +77,8 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeP } template <> -AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double rho, const double /*Tgas*/) - -> quokka::valarray +AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(const double rho, + const double /*Tgas*/) -> quokka::valarray { return ComputePlanckOpacity(rho, 0.); } @@ -86,16 +86,16 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeF static constexpr int nmscalars_ = Physics_Traits::numMassScalars; template <> AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto -quokka::EOS::ComputeTgasFromEint(const double rho, const double Egas, std::optional> /*massScalars*/) - -> double +quokka::EOS::ComputeTgasFromEint(const double rho, const double Egas, + std::optional> /*massScalars*/) -> double { return Egas / (rho * c_v); } template <> AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto -quokka::EOS::ComputeEintFromTgas(const double rho, const double Tgas, std::optional> /*massScalars*/) - -> double +quokka::EOS::ComputeEintFromTgas(const double rho, const double Tgas, + std::optional> /*massScalars*/) -> double { return rho * c_v * Tgas; } diff --git a/src/RadhydroPulseMG/test_radhydro_pulse_MG.cpp b/src/RadhydroPulseMG/test_radhydro_pulse_MG.cpp index 163e0324a..d00d8c3d3 100644 --- a/src/RadhydroPulseMG/test_radhydro_pulse_MG.cpp +++ b/src/RadhydroPulseMG/test_radhydro_pulse_MG.cpp @@ -190,8 +190,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeFluxMeanOpacity(co } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, + const double Tgas) -> quokka::valarray { quokka::valarray opacity_deriv{}; const auto nu_rep = compute_repres_nu(); @@ -208,8 +208,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDeri return opacity_deriv; } template <> -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, const double Tgas) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double rho, + const double Tgas) -> quokka::valarray { return RadSystem::ComputePlanckOpacityTempDerivative(rho, Tgas); } diff --git a/src/RadhydroShock/test_radhydro_shock.cpp b/src/RadhydroShock/test_radhydro_shock.cpp index 611050b9c..d826e4073 100644 --- a/src/RadhydroShock/test_radhydro_shock.cpp +++ b/src/RadhydroShock/test_radhydro_shock.cpp @@ -79,8 +79,8 @@ template <> struct Physics_Traits { }; template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, const double /*Tgas*/) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, + const double /*Tgas*/) -> quokka::valarray { quokka::valarray kappaPVec{}; for (int i = 0; i < nGroups_; ++i) { diff --git a/src/RadhydroShockCGS/test_radhydro_shock_cgs.cpp b/src/RadhydroShockCGS/test_radhydro_shock_cgs.cpp index 5601668d0..e5f331525 100644 --- a/src/RadhydroShockCGS/test_radhydro_shock_cgs.cpp +++ b/src/RadhydroShockCGS/test_radhydro_shock_cgs.cpp @@ -80,8 +80,8 @@ template <> struct Physics_Traits { }; template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, const double /*Tgas*/) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, + const double /*Tgas*/) -> quokka::valarray { quokka::valarray kappaPVec{}; for (int i = 0; i < nGroups_; ++i) { diff --git a/src/RadhydroShockMultigroup/test_radhydro_shock_multigroup.cpp b/src/RadhydroShockMultigroup/test_radhydro_shock_multigroup.cpp index a66f83b30..3fdb74230 100644 --- a/src/RadhydroShockMultigroup/test_radhydro_shock_multigroup.cpp +++ b/src/RadhydroShockMultigroup/test_radhydro_shock_multigroup.cpp @@ -71,8 +71,8 @@ template <> struct quokka::EOS_Traits { }; template <> -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, const double /*Tgas*/) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto RadSystem::ComputePlanckOpacity(const double rho, + const double /*Tgas*/) -> quokka::valarray { quokka::valarray kappaPVec{}; for (int i = 0; i < nGroups_; ++i) { diff --git a/src/RadhydroSimulation.hpp b/src/RadhydroSimulation.hpp index 77df2b79f..c7ac8f9c6 100644 --- a/src/RadhydroSimulation.hpp +++ b/src/RadhydroSimulation.hpp @@ -219,8 +219,8 @@ template class RadhydroSimulation : public AMRSimulation &dstfluxes, std::array &srcfluxes, int srccomp, int dstcomp); - auto expandFluxArrays(std::array &fluxes, int nstartNew, int ncompNew) - -> std::array; + auto expandFluxArrays(std::array &fluxes, int nstartNew, + int ncompNew) -> std::array; void printCoordinates(int lev, const amrex::IntVect &cell_idx); @@ -256,11 +256,11 @@ template class RadhydroSimulation : public AMRSimulation dx) -> std::tuple, std::array>; - auto computeHydroFluxes(amrex::MultiFab const &consVar, int nvars, int lev) - -> std::pair, std::array>; + auto computeHydroFluxes(amrex::MultiFab const &consVar, int nvars, + int lev) -> std::pair, std::array>; - auto computeFOHydroFluxes(amrex::MultiFab const &consVar, int nvars, int lev) - -> std::pair, std::array>; + auto computeFOHydroFluxes(amrex::MultiFab const &consVar, int nvars, + int lev) -> std::pair, std::array>; template void fluxFunction(amrex::Array4 const &consState, amrex::FArrayBox &x1Flux, amrex::FArrayBox &x1FluxDiffusive, @@ -1342,8 +1342,8 @@ void RadhydroSimulation::addFluxArrays(std::array -auto RadhydroSimulation::expandFluxArrays(std::array &fluxes, const int nstartNew, const int ncompNew) - -> std::array +auto RadhydroSimulation::expandFluxArrays(std::array &fluxes, const int nstartNew, + const int ncompNew) -> std::array { BL_PROFILE("RadhydroSimulation::expandFluxArrays()"); diff --git a/src/fextract.cpp b/src/fextract.cpp index a36c805fb..5ed4729c9 100644 --- a/src/fextract.cpp +++ b/src/fextract.cpp @@ -12,8 +12,8 @@ using namespace amrex; // NOLINT -auto fextract(MultiFab &mf, Geometry &geom, const int idir, const Real slice_coord, const bool center = false) - -> std::tuple, Vector>> +auto fextract(MultiFab &mf, Geometry &geom, const int idir, const Real slice_coord, + const bool center = false) -> std::tuple, Vector>> { AMREX_D_TERM(Real xcoord = slice_coord;, Real ycoord = slice_coord;, Real zcoord = slice_coord;) diff --git a/src/fextract.hpp b/src/fextract.hpp index 2343732a8..2267133f9 100644 --- a/src/fextract.hpp +++ b/src/fextract.hpp @@ -9,7 +9,7 @@ #include #include -auto fextract(amrex::MultiFab &mf, amrex::Geometry &geom, int idir, amrex::Real slice_coord, bool center = false) - -> std::tuple, amrex::Vector>>; +auto fextract(amrex::MultiFab &mf, amrex::Geometry &geom, int idir, amrex::Real slice_coord, + bool center = false) -> std::tuple, amrex::Vector>>; #endif // FEXTRACT_HPP_ \ No newline at end of file diff --git a/src/hydro_system.hpp b/src/hydro_system.hpp index 02089939c..767851df1 100644 --- a/src/hydro_system.hpp +++ b/src/hydro_system.hpp @@ -292,8 +292,8 @@ template auto HydroSystem::CheckStatesValid(amre } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePrimVars(amrex::Array4 const &cons, int i, int j, int k) - -> quokka::valarray +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePrimVars(amrex::Array4 const &cons, int i, int j, + int k) -> quokka::valarray { // convert to primitive vars const auto rho = cons(i, j, k, density_index); @@ -325,8 +325,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePrimVars } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeConsVars(quokka::valarray const &prim) - -> quokka::valarray +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto +HydroSystem::ComputeConsVars(quokka::valarray const &prim) -> quokka::valarray { // convert to conserved vars Real const rho = prim[0]; @@ -348,8 +348,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeConsVars } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePressure(amrex::Array4 const &cons, int i, int j, int k) - -> amrex::Real +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePressure(amrex::Array4 const &cons, int i, int j, + int k) -> amrex::Real { const auto rho = cons(i, j, k, density_index); const auto px = cons(i, j, k, x1Momentum_index); @@ -373,8 +373,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputePressure } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeSoundSpeed(amrex::Array4 const &cons, int i, int j, int k) - -> amrex::Real +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeSoundSpeed(amrex::Array4 const &cons, int i, int j, + int k) -> amrex::Real { const auto rho = cons(i, j, k, density_index); const auto px = cons(i, j, k, x1Momentum_index); @@ -395,8 +395,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeSoundSpe } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX1(amrex::Array4 const &cons, int i, int j, int k) - -> amrex::Real +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX1(amrex::Array4 const &cons, int i, int j, + int k) -> amrex::Real { amrex::Real const rho = cons(i, j, k, density_index); amrex::Real const vel_x = cons(i, j, k, x1Momentum_index) / rho; @@ -404,8 +404,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocity } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX2(amrex::Array4 const &cons, int i, int j, int k) - -> amrex::Real +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX2(amrex::Array4 const &cons, int i, int j, + int k) -> amrex::Real { amrex::Real const rho = cons(i, j, k, density_index); amrex::Real const vel_y = cons(i, j, k, x2Momentum_index) / rho; @@ -413,8 +413,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocity } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX3(amrex::Array4 const &cons, int i, int j, int k) - -> amrex::Real +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem::ComputeVelocityX3(amrex::Array4 const &cons, int i, int j, + int k) -> amrex::Real { amrex::Real const rho = cons(i, j, k, density_index); amrex::Real const vel_z = cons(i, j, k, x3Momentum_index) / rho; @@ -654,12 +654,18 @@ void HydroSystem::FlattenShocks(amrex::MultiFab const &q_mf, amrex::M // axis* // (Eq. 86 of Miller & Colella 2001; Eq. 78 of Miller & Colella 2002) double chi_ijk = std::min({ - x1Chi_in[bx](i_in - 1, j_in, k_in), x1Chi_in[bx](i_in, j_in, k_in), x1Chi_in[bx](i_in + 1, j_in, k_in), + x1Chi_in[bx](i_in - 1, j_in, k_in), + x1Chi_in[bx](i_in, j_in, k_in), + x1Chi_in[bx](i_in + 1, j_in, k_in), #if (AMREX_SPACEDIM >= 2) - x2Chi_in[bx](i_in, j_in - 1, k_in), x2Chi_in[bx](i_in, j_in, k_in), x2Chi_in[bx](i_in, j_in + 1, k_in), + x2Chi_in[bx](i_in, j_in - 1, k_in), + x2Chi_in[bx](i_in, j_in, k_in), + x2Chi_in[bx](i_in, j_in + 1, k_in), #endif #if (AMREX_SPACEDIM == 3) - x3Chi_in[bx](i_in, j_in, k_in - 1), x3Chi_in[bx](i_in, j_in, k_in), x3Chi_in[bx](i_in, j_in, k_in + 1), + x3Chi_in[bx](i_in, j_in, k_in - 1), + x3Chi_in[bx](i_in, j_in, k_in), + x3Chi_in[bx](i_in, j_in, k_in + 1), #endif }); diff --git a/src/hyperbolic_system.hpp b/src/hyperbolic_system.hpp index 73163a7b9..b35e9dab7 100644 --- a/src/hyperbolic_system.hpp +++ b/src/hyperbolic_system.hpp @@ -51,8 +51,8 @@ template class HyperbolicSystem return 0.5 * (sgn(a) + sgn(b)) * std::min(std::abs(a), std::abs(b)); } - [[nodiscard]] AMREX_GPU_DEVICE AMREX_FORCE_INLINE static auto GetMinmaxSurroundingCell(arrayconst_t &q, int i, int j, int k, int n) - -> std::pair; + [[nodiscard]] AMREX_GPU_DEVICE AMREX_FORCE_INLINE static auto GetMinmaxSurroundingCell(arrayconst_t &q, int i, int j, int k, + int n) -> std::pair; template static void ReconstructStatesConstant(amrex::MultiFab const &q, amrex::MultiFab &leftState, amrex::MultiFab &rightState, int nghost, int nvars); diff --git a/src/linear_advection.hpp b/src/linear_advection.hpp index a7046e539..153e862b5 100644 --- a/src/linear_advection.hpp +++ b/src/linear_advection.hpp @@ -72,8 +72,8 @@ void LinearAdvectionSystem::ConservedToPrimitive(amrex::MultiFab cons } template -AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto LinearAdvectionSystem::isStateValid(amrex::Array4 const &cons, int i, int j, int k) - -> bool +AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto LinearAdvectionSystem::isStateValid(amrex::Array4 const &cons, int i, int j, + int k) -> bool { // check if cons(i, j, k) is a valid state const auto rho = cons(i, j, k, density_index); diff --git a/src/radiation_system.hpp b/src/radiation_system.hpp index ea035d639..3903b95d0 100644 --- a/src/radiation_system.hpp +++ b/src/radiation_system.hpp @@ -182,36 +182,36 @@ template class RadSystem : public HyperbolicSystem quokka::valarray; - AMREX_GPU_HOST_DEVICE static auto ComputePlanckEnergyFractions(amrex::GpuArray const &boundaries, amrex::Real temperature) - -> quokka::valarray; + AMREX_GPU_HOST_DEVICE static auto ComputePlanckEnergyFractions(amrex::GpuArray const &boundaries, + amrex::Real temperature) -> quokka::valarray; - AMREX_GPU_HOST_DEVICE static auto ComputeThermalRadiation(amrex::Real temperature, amrex::GpuArray const &boundaries) - -> quokka::valarray; + AMREX_GPU_HOST_DEVICE static auto + ComputeThermalRadiation(amrex::Real temperature, amrex::GpuArray const &boundaries) -> quokka::valarray; - AMREX_GPU_HOST_DEVICE static auto ComputeThermalRadiationTempDerivative(amrex::Real temperature, - amrex::GpuArray const &boundaries) - -> quokka::valarray; + AMREX_GPU_HOST_DEVICE static auto + ComputeThermalRadiationTempDerivative(amrex::Real temperature, + amrex::GpuArray const &boundaries) -> quokka::valarray; template AMREX_GPU_DEVICE static auto ComputeCellOpticalDepth(const quokka::Array4View &consVar, - amrex::GpuArray dx, int i, int j, int k) - -> quokka::valarray; + amrex::GpuArray dx, int i, int j, + int k) -> quokka::valarray; AMREX_GPU_DEVICE static auto isStateValid(std::array &cons) -> bool; AMREX_GPU_DEVICE static void amendRadState(std::array &cons); template - AMREX_GPU_DEVICE static auto ComputeRadPressure(double erad_L, double Fx_L, double Fy_L, double Fz_L, double fx_L, double fy_L, double fz_L) - -> RadPressureResult; + AMREX_GPU_DEVICE static auto ComputeRadPressure(double erad_L, double Fx_L, double Fy_L, double Fz_L, double fx_L, double fy_L, + double fz_L) -> RadPressureResult; AMREX_GPU_DEVICE static auto ComputeEddingtonTensor(double fx_L, double fy_L, double fz_L) -> std::array, 3>; }; // Compute radiation energy fractions for each photon group from a Planck function, given nGroups, radBoundaries, and temperature template -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckEnergyFractions(amrex::GpuArray const &boundaries, amrex::Real temperature) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckEnergyFractions(amrex::GpuArray const &boundaries, + amrex::Real temperature) -> quokka::valarray { quokka::valarray radEnergyFractions{}; if constexpr (nGroups_ == 1) { @@ -252,9 +252,9 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeThermalRadiation(amrex:: } template -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeThermalRadiationTempDerivative(amrex::Real temperature, - amrex::GpuArray const &boundaries) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto +RadSystem::ComputeThermalRadiationTempDerivative(amrex::Real temperature, + amrex::GpuArray const &boundaries) -> quokka::valarray { // by default, d emission/dT = 4 emission / T auto erad = ComputeThermalRadiation(temperature, boundaries); @@ -696,8 +696,8 @@ AMREX_GPU_DEVICE auto RadSystem::ComputeMassScalars(ArrayType const & template template AMREX_GPU_DEVICE auto RadSystem::ComputeCellOpticalDepth(const quokka::Array4View &consVar, - amrex::GpuArray dx, int i, int j, int k) - -> quokka::valarray + amrex::GpuArray dx, int i, int j, + int k) -> quokka::valarray { // compute interface-averaged cell optical depth @@ -1044,8 +1044,8 @@ AMREX_GPU_HOST_DEVICE auto RadSystem::ComputeEnergyMeanOpacity(const } template -AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double /* rho */, const double /* Tgas */) - -> quokka::valarray +AMREX_GPU_HOST_DEVICE auto RadSystem::ComputePlanckOpacityTempDerivative(const double /* rho */, + const double /* Tgas */) -> quokka::valarray { quokka::valarray kappa{}; kappa.fillin(0.0); diff --git a/src/simulation.hpp b/src/simulation.hpp index 200865f8c..aa4208890 100644 --- a/src/simulation.hpp +++ b/src/simulation.hpp @@ -491,9 +491,8 @@ template void AMRSimulation::PerformanceHints() const amrex::Long nboxes = boxArray(ilev).size(); if (amrex::ParallelDescriptor::NProcs() > nboxes) { amrex::Print() << "\n[Warning] [Performance] Too many resources / too little work!\n" - << " It looks like you requested more compute resources than " - << " the number of boxes of cells available on level " << ilev << " (" << nboxes << "). " - << "You started with (" << amrex::ParallelDescriptor::NProcs() << ") MPI ranks, so (" + << " It looks like you requested more compute resources than " << " the number of boxes of cells available on level " + << ilev << " (" << nboxes << "). " << "You started with (" << amrex::ParallelDescriptor::NProcs() << ") MPI ranks, so (" << amrex::ParallelDescriptor::NProcs() - nboxes << ") rank(s) will have no work on this level.\n" #ifdef AMREX_USE_GPU << " On GPUs, consider using 1-8 boxes per GPU per level that "