Skip to content

Commit

Permalink
add num mass scalars in template
Browse files Browse the repository at this point in the history
  • Loading branch information
psharda committed Jul 31, 2023
1 parent c257a1c commit 5598a2f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/HLLC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace quokka::Riemann
// Minoshima & Miyoshi, "A low-dissipation HLLD approximate Riemann solver
// for a very wide range of Mach numbers," JCP (2021).]
//
template <typename problem_t, int N_scalars, int fluxdim>
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto HLLC(quokka::HydroState<N_scalars> const &sL, quokka::HydroState<N_scalars> const &sR, const double gamma,
template <typename problem_t, int N_scalars, int N_mscalars, int fluxdim>
AMREX_FORCE_INLINE AMREX_GPU_DEVICE auto HLLC(quokka::HydroState<N_scalars, N_mscalars> const &sL, quokka::HydroState<N_scalars, N_mscalars> const &sR, const double gamma,
const double du, const double dw) -> quokka::valarray<double, fluxdim>
{
// compute Roe averages
Expand Down
6 changes: 3 additions & 3 deletions src/HydroState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace quokka
{
template <int N> struct HydroState {
template <int Nall, int Nmass> struct HydroState {
double rho; // density
double u; // normal velocity component
double v; // transverse velocity component
Expand All @@ -14,8 +14,8 @@ template <int N> struct HydroState {
double cs; // adiabatic sound speed
double E; // total energy density
double Eint; // internal energy density
std::array<double, N> scalar; // passive scalars
amrex::GpuArray<double, N> massScalar; // mass scalars
std::array<double, Nall> scalar; // passive scalars
amrex::GpuArray<double, Nmass> massScalar; // mass scalars
};

} // namespace quokka
Expand Down
6 changes: 3 additions & 3 deletions src/hydro_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ void HydroSystem<problem_t>::ComputeFluxes(amrex::MultiFab &x1Flux_mf, amrex::Mu
velW_index = x2Velocity_index;
}

quokka::HydroState<nscalars_> sL{};
quokka::HydroState<nscalars_, nmscalars_> sL{};
sL.rho = rho_L;
sL.u = x1LeftState(i, j, k, velN_index);
sL.v = x1LeftState(i, j, k, velV_index);
Expand All @@ -927,7 +927,7 @@ void HydroSystem<problem_t>::ComputeFluxes(amrex::MultiFab &x1Flux_mf, amrex::Mu
sL.E = E_L;
sL.Eint = Eint_L;

quokka::HydroState<nscalars_> sR{};
quokka::HydroState<nscalars_, nmscalars_> sR{};
sR.rho = rho_R;
sR.u = x1RightState(i, j, k, velN_index);
sR.v = x1RightState(i, j, k, velV_index);
Expand Down Expand Up @@ -969,7 +969,7 @@ void HydroSystem<problem_t>::ComputeFluxes(amrex::MultiFab &x1Flux_mf, amrex::Mu
#endif

// solve the Riemann problem in canonical form
quokka::valarray<double, nvar_> F_canonical = quokka::Riemann::HLLC<problem_t, nscalars_, nvar_>(sL, sR, gamma_, du, dw);
quokka::valarray<double, nvar_> F_canonical = quokka::Riemann::HLLC<problem_t, nscalars_, nmscalars_, nvar_>(sL, sR, gamma_, du, dw);
quokka::valarray<double, nvar_> F = F_canonical;

// add artificial viscosity
Expand Down

0 comments on commit 5598a2f

Please sign in to comment.