Skip to content

Commit

Permalink
fix pressure source
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jul 27, 2024
1 parent 02e3a9e commit 8828c4b
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions Source/hydro/reconstruction.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef CASTRO_RECONSTRUCTION_H
#define CASTRO_RECONSTRUCTION_H

#include <state_indices.H>

namespace reconstruction {
enum slope_indices {
im2 = 0,
Expand All @@ -14,9 +16,9 @@ namespace reconstruction {

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void
load_stencil(Array4<Real const> const& q_arr, const int idir,
load_stencil(amrex::Array4<amrex::Real const> const& q_arr, const int idir,
const int i, const int j, const int k, const int ncomp,
Real* s) {
amrex::Real* s) {

using namespace reconstruction;

Expand Down Expand Up @@ -47,9 +49,11 @@ load_stencil(Array4<Real const> const& q_arr, const int idir,

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void
load_passive_stencil(Array4<Real const> const& U_arr, Array4<Real const> const& rho_inv_arr, const int idir,
load_passive_stencil(amrex::Array4<amrex::Real const> const& U_arr,
amrex::Array4<amrex::Real const> const& rho_inv_arr,
const int idir,
const int i, const int j, const int k, const int ncomp,
Real* s) {
amrex::Real* s) {

using namespace reconstruction;

Expand Down Expand Up @@ -80,13 +84,16 @@ load_passive_stencil(Array4<Real const> const& U_arr, Array4<Real const> const&

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void
add_geometric_rho_source(Array4<Real const> const& q_arr,
Array4<Real const> const& dloga,
add_geometric_rho_source(amrex::Array4<amrex::Real const> const& q_arr,
amrex::Array4<amrex::Real const> const& dloga,
const int i, const int j, const int k,
Real* s) {
amrex::Real* s) {

using namespace reconstruction;

// this takes the form: -alpha rho u / r
// where alpha = 1 for cylindrical and 2 for spherical

// note: this is assumed to be working only in the x-direction

s[im2] += -dloga(i-2,j,k) * q_arr(i-2,j,k,QRHO) * q_arr(i-2,j,k,QU);
Expand All @@ -98,13 +105,16 @@ add_geometric_rho_source(Array4<Real const> const& q_arr,

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void
add_geometric_rhoe_source(Array4<Real const> const& q_arr,
Array4<Real const> const& dloga,
add_geometric_rhoe_source(amrex::Array4<amrex::Real const> const& q_arr,
amrex::Array4<amrex::Real const> const& dloga,
const int i, const int j, const int k,
Real* s) {
amrex::Real* s) {

using namespace reconstruction;

// this takes the form: -alpha (rho e + p) u / r
// where alpha = 1 for cylindrical and 2 for spherical

// note: this is assumed to be working only in the x-direction

s[im2] += -dloga(i-2,j,k) * (q_arr(i-2,j,k,QREINT) + q_arr(i-2,j,k,QPRES)) * q_arr(i-2,j,k,QU);
Expand All @@ -116,23 +126,25 @@ add_geometric_rhoe_source(Array4<Real const> const& q_arr,

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void
add_geometric_p_source(Array4<Real const> const& q_arr,
Array4<Real const> const& qaux_arr,
Array4<Real const> const& dloga,
add_geometric_p_source(amrex::Array4<amrex::Real const> const& q_arr,
amrex::Array4<amrex::Real const> const& qaux_arr,
amrex::Array4<amrex::Real const> const& dloga,
const int i, const int j, const int k,
Real* s) {
amrex::Real* s) {

using namespace reconstruction;

// this takes the form: -alpha Gamma1 p u / r
// where alpha = 1 for cylindrical and 2 for spherical

// note: this is assumed to be working only in the x-direction

s[im2] += -dloga(i-2,j,k) * q_arr(i-2,j,k,QRHO) * qaux_arr(i-2,j,k,QC) * q_arr(i-2,j,k,QU);
s[im1] += -dloga(i-1,j,k) * q_arr(i-1,j,k,QRHO) * qaux_arr(i-1,j,k,QC) * q_arr(i-1,j,k,QU);
s[i0] += -dloga(i,j,k) * q_arr(i,j,k,QRHO) * qaux_arr(i,j,k,QC) * q_arr(i,j,k,QU);
s[ip1] += -dloga(i+1,j,k) * q_arr(i+1,j,k,QRHO) * qaux_arr(i+1,j,k,QC) * q_arr(i+1,j,k,QU);
s[ip2] += -dloga(i+2,j,k) * q_arr(i+2,j,k,QRHO) * qaux_arr(i+2,j,k,QC) * q_arr(i+2,j,k,QU);
s[im2] += -dloga(i-2,j,k) * q_arr(i-2,j,k,QPRES) * qaux_arr(i-2,j,k,QGAMC) * q_arr(i-2,j,k,QU);
s[im1] += -dloga(i-1,j,k) * q_arr(i-1,j,k,QPRES) * qaux_arr(i-1,j,k,QGAMC) * q_arr(i-1,j,k,QU);
s[i0] += -dloga(i,j,k) * q_arr(i,j,k,QPRES) * qaux_arr(i,j,k,QGAMC) * q_arr(i,j,k,QU);
s[ip1] += -dloga(i+1,j,k) * q_arr(i+1,j,k,QPRES) * qaux_arr(i+1,j,k,QGAMC) * q_arr(i+1,j,k,QU);
s[ip2] += -dloga(i+2,j,k) * q_arr(i+2,j,k,QPRES) * qaux_arr(i+2,j,k,QGAMC) * q_arr(i+2,j,k,QU);
}


#endif

0 comments on commit 8828c4b

Please sign in to comment.