Skip to content

Commit

Permalink
pass in the correct dloga when doing tracing (#2994)
Browse files Browse the repository at this point in the history
computes dloga in y-direction and pass in the correct dloga for the corresponding dir. This was missed in pr #2964 .
  • Loading branch information
zhichen3 authored Nov 17, 2024
1 parent be78430 commit 2fb7228
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 24 deletions.
5 changes: 3 additions & 2 deletions Source/driver/Castro.H
Original file line number Diff line number Diff line change
Expand Up @@ -1381,9 +1381,10 @@ protected:
///
amrex::MultiFab volume;
amrex::Array<amrex::MultiFab,3> area;
amrex::MultiFab dLogArea[1];
amrex::Vector< amrex::Vector<amrex::Real> > radius;

#if AMREX_SPACEDIM <= 2
amrex::Array<amrex::MultiFab,2> dLogArea;
#endif

///
/// For initialization of the C++ values of the runtime parameters
Expand Down
13 changes: 11 additions & 2 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,18 @@ Castro::buildMetrics ()
area[dir].setVal(0.0);
}

dLogArea[0].clear();
#if (AMREX_SPACEDIM <= 2)
geom.GetDLogA(dLogArea[0],grids,dmap,0,NUM_GROW);
for (int dir = 0; dir < AMREX_SPACEDIM; dir++)
{
dLogArea[dir].clear();
geom.GetDLogA(dLogArea[dir],grids,dmap,dir,NUM_GROW);
}
for (int dir = AMREX_SPACEDIM; dir < 2; dir++)
{
dLogArea[dir].clear();
dLogArea[dir].define(grids, dmap, 1, 0);
dLogArea[dir].setVal(0.0);
}
#endif

wall_time_start = 0.0;
Expand Down
27 changes: 18 additions & 9 deletions Source/hydro/Castro_ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ Castro::ctu_ppm_states(const Box& bx, const Box& vbx,
Array4<Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
Array4<Real const> const& dloga,
Array4<Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
Array4<Real const> const& dlogaY,
#endif
const Real dt) {

Expand All @@ -118,7 +121,7 @@ Castro::ctu_ppm_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr, srcQ,
qxm, qxp,
#if AMREX_SPACEDIM <= 2
dloga,
dlogaX,
#endif
vbx, dt);

Expand All @@ -131,7 +134,7 @@ Castro::ctu_ppm_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr, srcQ,
qym, qyp,
#if AMREX_SPACEDIM <= 2
dloga,
dlogaY,
#endif
vbx, dt);

Expand Down Expand Up @@ -173,7 +176,10 @@ Castro::ctu_ppm_rad_states(const Box& bx, const Box& vbx,
Array4<Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
Array4<Real const> const& dloga,
Array4<Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
Array4<Real const> const& dlogaY,
#endif
const Real dt) {

Expand All @@ -187,7 +193,7 @@ Castro::ctu_ppm_rad_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr, srcQ,
qxm, qxp,
#if AMREX_SPACEDIM <= 2
dloga,
dlogaX,
#endif
vbx, dt);

Expand All @@ -200,7 +206,7 @@ Castro::ctu_ppm_rad_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr, srcQ,
qym, qyp,
#if AMREX_SPACEDIM <= 2
dloga,
dlogaY,
#endif
vbx, dt);

Expand Down Expand Up @@ -243,7 +249,10 @@ Castro::ctu_plm_states(const Box& bx, const Box& vbx,
Array4<Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
Array4<Real const> const& dloga,
Array4<Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
Array4<Real const> const& dlogaY,
#endif
const Real dt) {

Expand Down Expand Up @@ -273,7 +282,7 @@ Castro::ctu_plm_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr,
qxm, qxp,
#if AMREX_SPACEDIM < 3
dloga,
dlogaX,
#endif
srcQ, vbx, dt);

Expand All @@ -285,7 +294,7 @@ Castro::ctu_plm_states(const Box& bx, const Box& vbx,
U_arr, rho_inv_arr, q_arr, qaux_arr,
qym, qyp,
#if AMREX_SPACEDIM < 3
dloga,
dlogaY,
#endif
srcQ, vbx, dt);

Expand Down
22 changes: 17 additions & 5 deletions Source/hydro/Castro_ctu_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
#endif

#if AMREX_SPACEDIM < 3
Array4<Real const> const dLogArea_arr = (dLogArea[0]).array(mfi);
Array4<Real const> const dLogAreaX_arr = (dLogArea[0]).array(mfi);
#endif
#if AMREX_SPACEDIM == 2
Array4<Real const> const dLogAreaY_arr = (dLogArea[1]).array(mfi);
#endif

const Box& xbx = amrex::surroundingNodes(bx, 0);
Expand Down Expand Up @@ -342,8 +345,11 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
#if AMREX_SPACEDIM == 3
qzm_arr, qzp_arr,
#endif
#if (AMREX_SPACEDIM < 3)
dLogArea_arr,
#if AMREX_SPACEDIM < 3
dLogAreaX_arr,
#endif
#if AMREX_SPACEDIM == 2
dLogAreaY_arr,
#endif
dt);

Expand All @@ -361,7 +367,10 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
qzm_arr, qzp_arr,
#endif
#if AMREX_SPACEDIM < 3
dLogArea_arr,
dLogAreaX_arr,
#endif
#if AMREX_SPACEDIM == 2
dLogAreaY_arr,
#endif
dt);
#else
Expand All @@ -377,7 +386,10 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
qzm_arr, qzp_arr,
#endif
#if AMREX_SPACEDIM < 3
dLogArea_arr,
dLogAreaX_arr,
#endif
#if AMREX_SPACEDIM == 2
dLogAreaY_arr,
#endif
dt);
#endif
Expand Down
24 changes: 18 additions & 6 deletions Source/hydro/Castro_hydro.H
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@
/// @param qyp right interface state in y, q_{i,j-1/2,k,R}
/// @param qzm left interface state in z, q_{i,j,k-1/2,L}
/// @param qzp right interface state in z, q_{i,j,k-1/2,R}
/// @param dloga the geometric factor d(log area)
/// @param dlogaX the geometric factor d(log area) in x (r) dir
/// @param dlogaY the geometric factor d(log area) in y (theta) dir
/// @param dt timestep
///
void ctu_ppm_states(const amrex::Box& bx, const amrex::Box& vbx,
Expand All @@ -238,7 +239,10 @@
amrex::Array4<amrex::Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
amrex::Array4<amrex::Real const> const& dloga,
amrex::Array4<amrex::Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
amrex::Array4<amrex::Real const> const& dlogaY,
#endif
const amrex::Real dt);

Expand All @@ -259,7 +263,8 @@
/// @param qyp right interface state in y, q_{i,j-1/2,k,R}
/// @param qzm left interface state in z, q_{i,j,k-1/2,L}
/// @param qzp right interface state in z, q_{i,j,k-1/2,R}
/// @param dloga the geometric factor d(log area)
/// @param dlogaX the geometric factor d(log area) in x (r) dir
/// @param dlogaY the geometric factor d(log area) in y (theta) dir
/// @param dt timestep
///
void ctu_plm_states(const amrex::Box& bx, const amrex::Box& vbx,
Expand All @@ -279,7 +284,10 @@
amrex::Array4<amrex::Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
amrex::Array4<amrex::Real const> const& dloga,
amrex::Array4<amrex::Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
amrex::Array4<amrex::Real const> const& dlogaY,
#endif
const amrex::Real dt);

Expand All @@ -301,7 +309,8 @@
/// @param qyp right interface state in y, q_{i,j-1/2,k,R}
/// @param qzm left interface state in z, q_{i,j,k-1/2,L}
/// @param qzp right interface state in z, q_{i,j,k-1/2,R}
/// @param dloga the geometric factor d(log area)
/// @param dlogaX the geometric factor d(log area) in x (r) dir
/// @param dlogaY the geometric factor d(log area) in y (theta) dir
/// @param dt timestep
///
void ctu_ppm_rad_states(const amrex::Box& bx, const amrex::Box& vbx,
Expand All @@ -321,7 +330,10 @@
amrex::Array4<amrex::Real> const& qzp,
#endif
#if AMREX_SPACEDIM < 3
amrex::Array4<amrex::Real const> const& dloga,
amrex::Array4<amrex::Real const> const& dlogaX,
#endif
#if AMREX_SPACEDIM == 2
amrex::Array4<amrex::Real const> const& dlogaY,
#endif
const amrex::Real dt);
#endif
Expand Down

0 comments on commit 2fb7228

Please sign in to comment.