Skip to content

Commit

Permalink
Properly handle variable reconstruction to cell faces in non-cartesia…
Browse files Browse the repository at this point in the history
…n grids (#196)

* check whether the grid is regular or not

* slopelimiter construction now pushed during initialisation to allow the
computation of plm coefficients

* Add PLM reconstruction coefficient in non-cartesian grids

* refactor slope limiters

* add Paul Segretain's fix to curvature term in spherical coordinates (no motion in constant pressure setups)

* fix axis flux on which we had a small (but measurable) leek of conserved quantities when in perfect equilibrium
fix tolerance in planet planet case

* update reference for CI/CD
  • Loading branch information
glesur authored Oct 18, 2023
1 parent f0c3dfa commit 6aaec33
Show file tree
Hide file tree
Showing 45 changed files with 1,709 additions and 1,574 deletions.
1 change: 1 addition & 0 deletions src/fluid/RiemannSolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory(Dustsolvers)

target_sources(idefix
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/calcFlux.hpp
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/extrapolateToFaces.hpp
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/flux.hpp
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/riemannSolver.hpp
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/shockFlattening.hpp
Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/Dustsolvers/hllDust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../idefix.hpp"
#include "fluid.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"

Expand All @@ -31,7 +31,7 @@ void RiemannSolver<Phys>::HllDust(IdefixArray4D<real> &Flux) {
IdefixArray1D<real> dx = this->data->dx[DIR];


SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

idefix_for("HLL_Kernel",
data->beg[KDIR],data->end[KDIR]+koffset,
Expand All @@ -55,7 +55,7 @@ void RiemannSolver<Phys>::HllDust(IdefixArray4D<real> &Flux) {


// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);

// 2-- Get the wave speed

Expand Down
7 changes: 3 additions & 4 deletions src/fluid/RiemannSolver/HDsolvers/hllHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../idefix.hpp"
#include "fluid.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"

Expand All @@ -32,8 +32,7 @@ void RiemannSolver<Phys>::HllHD(IdefixArray4D<real> &Flux) {
// Required for high order interpolations
IdefixArray1D<real> dx = this->data->dx[DIR];

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;

ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();
idefix_for("HLL_Kernel",
data->beg[KDIR],data->end[KDIR]+koffset,
data->beg[JDIR],data->end[JDIR]+joffset,
Expand All @@ -58,7 +57,7 @@ void RiemannSolver<Phys>::HllHD(IdefixArray4D<real> &Flux) {
real cL, cR, cmax;

// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);

// 2-- Get the wave speed
#if HAVE_ENERGY
Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/HDsolvers/hllcHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../idefix.hpp"
#include "fluid.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"

Expand All @@ -30,7 +30,7 @@ void RiemannSolver<Phys>::HllcHD(IdefixArray4D<real> &Flux) {

EquationOfState eos = *(hydro->eos.get());

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

idefix_for("HLLC_Kernel",
data->beg[KDIR],data->end[KDIR]+koffset,
Expand Down Expand Up @@ -58,7 +58,7 @@ void RiemannSolver<Phys>::HllcHD(IdefixArray4D<real> &Flux) {
real cL, cR, cmax;

// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);

// 2-- Get the wave speed
#if HAVE_ENERGY
Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/HDsolvers/roeHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../idefix.hpp"
#include "fluid.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"

Expand Down Expand Up @@ -51,7 +51,7 @@ void RiemannSolver<Phys>::RoeHD(IdefixArray4D<real> &Flux) {

EquationOfState eos = *(hydro->eos.get());

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

idefix_for("ROE_Kernel",
data->beg[KDIR],data->end[KDIR]+koffset,
Expand Down Expand Up @@ -80,7 +80,7 @@ void RiemannSolver<Phys>::RoeHD(IdefixArray4D<real> &Flux) {
real um[Phys::nvar];

// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);
#pragma unroll
for(int nv = 0 ; nv < Phys::nvar; nv++) {
dv[nv] = vR[nv] - vL[nv];
Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/HDsolvers/tvdlfHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../idefix.hpp"
#include "fluid.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"

Expand All @@ -32,7 +32,7 @@ void RiemannSolver<Phys>::TvdlfHD(IdefixArray4D<real> &Flux) {
// Required for high order interpolations
IdefixArray1D<real> dx = this->data->dx[DIR];

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

idefix_for("TVDLF_Kernel",
data->beg[KDIR],data->end[KDIR]+koffset,
Expand All @@ -59,7 +59,7 @@ void RiemannSolver<Phys>::TvdlfHD(IdefixArray4D<real> &Flux) {
real cRL, cmax;

// 1-- Read primitive variables
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);

#pragma unroll
for(int nv = 0 ; nv < Phys::nvar; nv++) {
Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/MHDsolvers/hllMHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define FLUID_RIEMANNSOLVER_MHDSOLVERS_HLLMHD_HPP_

#include "../idefix.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"
#include "storeFlux.hpp"
Expand Down Expand Up @@ -78,7 +78,7 @@ void RiemannSolver<Phys>::HllMHD(IdefixArray4D<real> &Flux) {

[[maybe_unused]] real xHConstant = hydro->xH;

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

// Define normal, tangent and bi-tanget indices
// st and sb will be useful only when Hall is included
Expand Down Expand Up @@ -180,7 +180,7 @@ void RiemannSolver<Phys>::HllMHD(IdefixArray4D<real> &Flux) {
c2Iso = ZERO_F;

// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);
vL[BXn] = Vs(DIR,k,j,i);
vR[BXn] = vL[BXn];

Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/MHDsolvers/hlldMHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define FLUID_RIEMANNSOLVER_MHDSOLVERS_HLLDMHD_HPP_

#include "../idefix.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"
#include "storeFlux.hpp"
Expand Down Expand Up @@ -73,7 +73,7 @@ void RiemannSolver<Phys>::HlldMHD(IdefixArray4D<real> &Flux) {

EquationOfState eos = *(hydro->eos.get());

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

// st and sb will be useful only when Hall is included
real st = ONE_F, sb = ONE_F;
Expand Down Expand Up @@ -162,7 +162,7 @@ void RiemannSolver<Phys>::HlldMHD(IdefixArray4D<real> &Flux) {
real vL[Phys::nvar];
real vR[Phys::nvar];

slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);
vL[BXn] = Vs(DIR,k,j,i);
vR[BXn] = vL[BXn];

Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/MHDsolvers/roeMHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define FLUID_RIEMANNSOLVER_MHDSOLVERS_ROEMHD_HPP_

#include "../idefix.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"
#include "storeFlux.hpp"
Expand Down Expand Up @@ -104,7 +104,7 @@ void RiemannSolver<Phys>::RoeMHD(IdefixArray4D<real> &Flux) {
// st and sb will be useful only when Hall is included
real st = ONE_F, sb = ONE_F;

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();

switch(DIR) {
case(IDIR):
Expand Down Expand Up @@ -205,7 +205,7 @@ void RiemannSolver<Phys>::RoeMHD(IdefixArray4D<real> &Flux) {


// 1-- Store the primitive variables on the left, right, and averaged states
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);
vL[BXn] = Vs(DIR,k,j,i);
vR[BXn] = vL[BXn];

Expand Down
6 changes: 3 additions & 3 deletions src/fluid/RiemannSolver/MHDsolvers/tvdlfMHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define FLUID_RIEMANNSOLVER_MHDSOLVERS_TVDLFMHD_HPP_

#include "../idefix.hpp"
#include "slopeLimiter.hpp"
#include "extrapolateToFaces.hpp"
#include "flux.hpp"
#include "convertConsToPrim.hpp"
#include "storeFlux.hpp"
Expand Down Expand Up @@ -64,7 +64,7 @@ void RiemannSolver<Phys>::TvdlfMHD(IdefixArray4D<real> &Flux) {

EquationOfState eos = *(hydro->eos.get());

SlopeLimiter<Phys,DIR> slopeLim(Vc,data->dx[DIR],haveShockFlattening,shockFlattening.get());;
ExtrapolateToFaces<Phys,DIR> extrapol = *this->GetExtrapolator<DIR>();
// Define normal, tangent and bi-tanget indices
// st and sb will be useful only when Hall is included
real st = ONE_F, sb = ONE_F;
Expand Down Expand Up @@ -157,7 +157,7 @@ void RiemannSolver<Phys>::TvdlfMHD(IdefixArray4D<real> &Flux) {
real fluxR[Phys::nvar];

// Load primitive variables
slopeLim.ExtrapolatePrimVar(i, j, k, vL, vR);
extrapol.ExtrapolatePrimVar(i, j, k, vL, vR);
vL[BXn] = Vs(DIR,k,j,i);
vR[BXn] = vL[BXn];
#pragma unroll
Expand Down
Loading

0 comments on commit 6aaec33

Please sign in to comment.