Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #757

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-symlinks
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
rev: v19.1.0
hooks:
- id: clang-format
ci:
Expand Down
1,351 changes: 1,189 additions & 162 deletions extern/sedov/sedov.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/QuokkaSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ template <typename problem_t> class QuokkaSimulation : public AMRSimulation<prob
void addFluxArrays(std::array<amrex::MultiFab, AMREX_SPACEDIM> &dstfluxes, std::array<amrex::MultiFab, AMREX_SPACEDIM> &srcfluxes, int srccomp,
int dstcomp);

auto expandFluxArrays(std::array<amrex::FArrayBox, AMREX_SPACEDIM> &fluxes, int nstartNew,
int ncompNew) -> std::array<amrex::FArrayBox, AMREX_SPACEDIM>;
auto expandFluxArrays(std::array<amrex::FArrayBox, AMREX_SPACEDIM> &fluxes, int nstartNew, int ncompNew)
-> std::array<amrex::FArrayBox, AMREX_SPACEDIM>;

void printCoordinates(int lev, const amrex::IntVect &cell_idx);

Expand Down Expand Up @@ -258,11 +258,11 @@ template <typename problem_t> class QuokkaSimulation : public AMRSimulation<prob
amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx)
-> std::tuple<std::array<amrex::FArrayBox, AMREX_SPACEDIM>, std::array<amrex::FArrayBox, AMREX_SPACEDIM>>;

auto computeHydroFluxes(amrex::MultiFab const &consVar, int nvars,
int lev) -> std::pair<std::array<amrex::MultiFab, AMREX_SPACEDIM>, std::array<amrex::MultiFab, AMREX_SPACEDIM>>;
auto computeHydroFluxes(amrex::MultiFab const &consVar, int nvars, int lev)
-> std::pair<std::array<amrex::MultiFab, AMREX_SPACEDIM>, std::array<amrex::MultiFab, AMREX_SPACEDIM>>;

auto computeFOHydroFluxes(amrex::MultiFab const &consVar, int nvars,
int lev) -> std::pair<std::array<amrex::MultiFab, AMREX_SPACEDIM>, std::array<amrex::MultiFab, AMREX_SPACEDIM>>;
auto computeFOHydroFluxes(amrex::MultiFab const &consVar, int nvars, int lev)
-> std::pair<std::array<amrex::MultiFab, AMREX_SPACEDIM>, std::array<amrex::MultiFab, AMREX_SPACEDIM>>;

template <FluxDir DIR>
void fluxFunction(amrex::Array4<const amrex::Real> const &consState, amrex::FArrayBox &x1Flux, amrex::FArrayBox &x1FluxDiffusive,
Expand Down Expand Up @@ -1381,8 +1381,8 @@ void QuokkaSimulation<problem_t>::addFluxArrays(std::array<amrex::MultiFab, AMRE
}

template <typename problem_t>
auto QuokkaSimulation<problem_t>::expandFluxArrays(std::array<amrex::FArrayBox, AMREX_SPACEDIM> &fluxes, const int nstartNew,
const int ncompNew) -> std::array<amrex::FArrayBox, AMREX_SPACEDIM>
auto QuokkaSimulation<problem_t>::expandFluxArrays(std::array<amrex::FArrayBox, AMREX_SPACEDIM> &fluxes, const int nstartNew, const int ncompNew)
-> std::array<amrex::FArrayBox, AMREX_SPACEDIM>
{
BL_PROFILE("QuokkaSimulation::expandFluxArrays()");

Expand Down
41 changes: 21 additions & 20 deletions src/hydro/EOS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ template <typename problem_t> class EOS
ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {}) -> amrex::Real;

[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {}) -> amrex::Real;
ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {})
-> amrex::Real;

[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeEintTempDerivative(amrex::Real rho, amrex::Real Tgas,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {}) -> amrex::Real;
ComputeEintTempDerivative(amrex::Real rho, amrex::Real Tgas, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {})
-> amrex::Real;

[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeOtherDerivatives(amrex::Real rho, amrex::Real P, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {});
Expand All @@ -62,8 +62,8 @@ template <typename problem_t> class EOS
ComputePressure(amrex::Real rho, amrex::Real Eint, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {}) -> amrex::Real;

[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {}) -> amrex::Real;
ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars = {})
-> amrex::Real;

private:
static constexpr amrex::Real gamma_ = EOS_Traits<problem_t>::gamma;
Expand All @@ -72,9 +72,9 @@ template <typename problem_t> class EOS
};

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputeTgasFromEint(amrex::Real rho, amrex::Real Eint,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeTgasFromEint(amrex::Real rho, amrex::Real Eint,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars)
-> amrex::Real
{
// return temperature for an ideal gas given density and internal energy
amrex::Real Tgas = NAN;
Expand Down Expand Up @@ -114,9 +114,9 @@ EOS<problem_t>::ComputeTgasFromEint(amrex::Real rho, amrex::Real Eint,
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars)
-> amrex::Real
{
// return internal energy density given density and temperature
amrex::Real Eint = NAN;
Expand Down Expand Up @@ -157,9 +157,9 @@ EOS<problem_t>::ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas,
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars)
-> amrex::Real
{
// return internal energy density given density and pressure
amrex::Real Eint = NAN;
Expand Down Expand Up @@ -297,8 +297,9 @@ EOS<problem_t>::ComputeOtherDerivatives(const amrex::Real rho, const amrex::Real
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputePressure(amrex::Real rho, amrex::Real Eint, std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputePressure(amrex::Real rho, amrex::Real Eint,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars)
-> amrex::Real
{
// return pressure for an ideal gas
amrex::Real P = NAN;
Expand Down Expand Up @@ -341,9 +342,9 @@ EOS<problem_t>::ComputePressure(amrex::Real rho, amrex::Real Eint, std::optional
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure,
std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> const &massScalars)
-> amrex::Real
{
// return sound speed for an ideal gas
amrex::Real cs = NAN;
Expand Down
4 changes: 2 additions & 2 deletions src/hydro/LLF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace quokka::Riemann
{
// Local Lax-Friedrichs (LLF) / Rusanov solver
template <typename problem_t, int N_scalars, int N_mscalars, int fluxdim>
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto LLF(quokka::HydroState<N_scalars, N_mscalars> const &sL,
quokka::HydroState<N_scalars, N_mscalars> const &sR) -> quokka::valarray<double, fluxdim>
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto LLF(quokka::HydroState<N_scalars, N_mscalars> const &sL, quokka::HydroState<N_scalars, N_mscalars> const &sR)
-> quokka::valarray<double, fluxdim>
{
// Toro (Eq. 10.56)
const amrex::Real Sp = std::max(std::abs(sL.u) + sL.cs, std::abs(sR.u) + sR.cs);
Expand Down
9 changes: 5 additions & 4 deletions src/hydro/NSCBC_inflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ namespace NSCBC
namespace detail
{
template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto
dQ_dx_inflow_x1_lower(quokka::valarray<Real, HydroSystem<problem_t>::nvar_> const &Q, quokka::valarray<Real, HydroSystem<problem_t>::nvar_> const &dQ_dx_data,
const Real T_t, const Real u_t, const Real v_t, const Real w_t, amrex::GpuArray<Real, HydroSystem<problem_t>::nscalars_> const &s_t,
const Real L_x) -> quokka::valarray<Real, HydroSystem<problem_t>::nvar_>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto dQ_dx_inflow_x1_lower(quokka::valarray<Real, HydroSystem<problem_t>::nvar_> const &Q,
quokka::valarray<Real, HydroSystem<problem_t>::nvar_> const &dQ_dx_data, const Real T_t,
const Real u_t, const Real v_t, const Real w_t,
amrex::GpuArray<Real, HydroSystem<problem_t>::nscalars_> const &s_t, const Real L_x)
-> quokka::valarray<Real, HydroSystem<problem_t>::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.)
Expand Down
8 changes: 4 additions & 4 deletions src/hydro/NSCBC_outflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto transverse_zdir_dQ_data(const amrex::In
}

template <typename problem_t, FluxDir DIR>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto
permute_vel(quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_> const &Q) -> quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto permute_vel(quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_> const &Q)
-> quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_>
{
// with normal direction DIR, permutes the velocity components so that
// u, v, w are the normal and transverse components, respectively.
Expand All @@ -232,8 +232,8 @@ permute_vel(quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_> const &
}

template <typename problem_t, FluxDir DIR>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto
unpermute_vel(quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_> const &Q) -> quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto unpermute_vel(quokka::valarray<amrex::Real, HydroSystem<problem_t>::nvar_> const &Q)
-> quokka::valarray<amrex::Real, HydroSystem<problem_t>::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*.
Expand Down
28 changes: 14 additions & 14 deletions src/hydro/hydro_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ template <typename problem_t> auto HydroSystem<problem_t>::CheckStatesValid(amre
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePrimVars(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> quokka::valarray<amrex::Real, nvar_>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePrimVars(amrex::Array4<const amrex::Real> const &cons, int i, int j, int k)
-> quokka::valarray<amrex::Real, nvar_>
{
// convert to primitive vars
const auto rho = cons(i, j, k, density_index);
Expand Down Expand Up @@ -324,8 +324,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePrimVars
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto
HydroSystem<problem_t>::ComputeConsVars(quokka::valarray<amrex::Real, nvar_> const &prim) -> quokka::valarray<amrex::Real, nvar_>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeConsVars(quokka::valarray<amrex::Real, nvar_> const &prim)
-> quokka::valarray<amrex::Real, nvar_>
{
// convert to conserved vars
Real const rho = prim[0];
Expand All @@ -347,8 +347,8 @@ HydroSystem<problem_t>::ComputeConsVars(quokka::valarray<amrex::Real, nvar_> con
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePressure(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> amrex::Real
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePressure(amrex::Array4<const amrex::Real> 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);
Expand All @@ -372,8 +372,8 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputePressure
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeSoundSpeed(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> amrex::Real
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeSoundSpeed(amrex::Array4<const amrex::Real> 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);
Expand All @@ -394,26 +394,26 @@ AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeSoundSpe
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX1(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> amrex::Real
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX1(amrex::Array4<const amrex::Real> 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;
return vel_x;
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX2(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> amrex::Real
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX2(amrex::Array4<const amrex::Real> 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;
return vel_y;
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX3(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> amrex::Real
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto HydroSystem<problem_t>::ComputeVelocityX3(amrex::Array4<const amrex::Real> 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;
Expand Down
4 changes: 2 additions & 2 deletions src/hyperbolic_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ template <typename problem_t> 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<double, double>;
[[nodiscard]] AMREX_GPU_DEVICE AMREX_FORCE_INLINE static auto GetMinmaxSurroundingCell(arrayconst_t &q, int i, int j, int k, int n)
-> std::pair<double, double>;

template <FluxDir DIR>
static void ReconstructStatesConstant(amrex::MultiFab const &q, amrex::MultiFab &leftState, amrex::MultiFab &rightState, int nghost, int nvars);
Expand Down
4 changes: 2 additions & 2 deletions src/linear_advection/AdvectionSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ template <typename problem_t> void AdvectionSimulation<problem_t>::advanceSingle
}

template <typename problem_t>
auto AdvectionSimulation<problem_t>::computeFluxes(amrex::MultiFab const &consVar, const int nvars,
const int lev) -> std::array<amrex::MultiFab, AMREX_SPACEDIM>
auto AdvectionSimulation<problem_t>::computeFluxes(amrex::MultiFab const &consVar, const int nvars, const int lev)
-> std::array<amrex::MultiFab, AMREX_SPACEDIM>
{
auto ba = grids[lev];
auto dm = dmap[lev];
Expand Down
4 changes: 2 additions & 2 deletions src/linear_advection/linear_advection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void LinearAdvectionSystem<problem_t>::ConservedToPrimitive(amrex::MultiFab cons
}

template <typename problem_t>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto LinearAdvectionSystem<problem_t>::isStateValid(amrex::Array4<const amrex::Real> const &cons, int i, int j,
int k) -> bool
AMREX_GPU_DEVICE AMREX_FORCE_INLINE auto LinearAdvectionSystem<problem_t>::isStateValid(amrex::Array4<const amrex::Real> 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);
Expand Down
4 changes: 2 additions & 2 deletions src/math/quadrature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto kernel_wendland_c2(const amrex::Real r)
}

template <typename F>
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto quad_3d(F &&f, amrex::Real x0, amrex::Real x1, amrex::Real y0, amrex::Real y1, amrex::Real z0,
amrex::Real z1) -> amrex::Real
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto quad_3d(F &&f, amrex::Real x0, amrex::Real x1, amrex::Real y0, amrex::Real y1, amrex::Real z0, amrex::Real z1)
-> amrex::Real
{
// integrate F over the rectangular domain [x0, y0, z0] -> [x1, y1, z1].
auto integrand = [=] AMREX_GPU_DEVICE(amrex::Real z) {
Expand Down
Loading
Loading