Skip to content

Commit

Permalink
Fixes for position dependent BCs
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilet committed Mar 20, 2024
1 parent cd29b56 commit 2df5730
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions EBGodunov/hydro_ebgodunov_edge_state_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
EBPLM::PredictStateOnXFace( xebx, ncomp, Imx, Ipx, q, u_mac,
flag_arr, vfrac_arr,
AMREX_D_DECL(fcx,fcy,fcz),ccent_arr,
geom, l_dt, h_bcrec, pbc, is_velocity);
geom, l_dt, h_bcrec, pbc, is_velocity, bc_arr);

EBPLM::PredictStateOnYFace( yebx, ncomp, Imy, Ipy, q, v_mac,
flag_arr, vfrac_arr,
AMREX_D_DECL(fcx,fcy,fcz),ccent_arr,
geom, l_dt, h_bcrec, pbc, is_velocity);
geom, l_dt, h_bcrec, pbc, is_velocity, bc_arr);

// No need for the intermediate upwinded edge state like in 3D. Could combine
// with x/yzlo loop below ...
Expand Down
6 changes: 3 additions & 3 deletions EBGodunov/hydro_ebgodunov_edge_state_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
EBPLM::PredictStateOnXFace( xebx, ncomp, Imx, Ipx, q, u_mac,
flag_arr, vfrac_arr,
AMREX_D_DECL(fcx,fcy,fcz),ccent_arr,
geom, l_dt, h_bcrec, pbc, is_velocity);
geom, l_dt, h_bcrec, pbc, is_velocity, bc_arr);

EBPLM::PredictStateOnYFace( yebx, ncomp, Imy, Ipy, q, v_mac,
flag_arr, vfrac_arr,
AMREX_D_DECL(fcx,fcy,fcz),ccent_arr,
geom, l_dt, h_bcrec, pbc, is_velocity);
geom, l_dt, h_bcrec, pbc, is_velocity, bc_arr);

EBPLM::PredictStateOnZFace( zebx, ncomp, Imz, Ipz, q, w_mac,
flag_arr, vfrac_arr,
AMREX_D_DECL(fcx,fcy,fcz),ccent_arr,
geom, l_dt, h_bcrec, pbc, is_velocity);
geom, l_dt, h_bcrec, pbc, is_velocity, bc_arr);

amrex::ParallelFor(
xebx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
Expand Down
14 changes: 6 additions & 8 deletions EBGodunov/hydro_ebgodunov_plm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,12 @@ EBPLM::PredictVelOnZFace (Box const& zebox,
auto extdir_lohi_y = has_extdir_or_ho(h_bcrec.data(), AMREX_SPACEDIM, static_cast<int>(Direction::y));
auto extdir_lohi_z = has_extdir_or_ho(h_bcrec.data(), AMREX_SPACEDIM, static_cast<int>(Direction::z));

bool has_extdir_or_ho_lo_x = extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = extdir_lohi_y.second;
bool has_extdir_or_ho_lo_z = extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = extdir_lohi_z.second;
bool has_extdir_or_ho_lo_x = bc_arr ? true : extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = bc_arr ? true : extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = bc_arr ? true : extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = bc_arr ? true : extdir_lohi_y.second;
bool has_extdir_or_ho_lo_z = bc_arr ? true : extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = bc_arr ? true : extdir_lohi_z.second;

if ( (has_extdir_or_ho_lo_x && domain_ilo >= zebox.smallEnd(0)-1) ||
(has_extdir_or_ho_hi_x && domain_ihi <= zebox.bigEnd(0) ) ||
Expand Down Expand Up @@ -807,7 +807,6 @@ EBPLM::PredictVelOnZFace (Box const& zebox,
qpls = amrex::max(amrex::min(qpls, qcc_max), qcc_min);
qpls -= Real(0.5) * dtdz * ccvel(i,j,k,2) * slopes_eb_hi[2];


} // end of making qpls

// *************************************************
Expand Down Expand Up @@ -859,7 +858,6 @@ EBPLM::PredictVelOnZFace (Box const& zebox,

qmns = amrex::max(amrex::min(qmns, qcc_max), qcc_min);
qmns -= Real(0.5) * dtdz * ccvel(i,j,k-1,2) * slopes_eb_lo[2];

} // end of making qmns
}

Expand Down
40 changes: 21 additions & 19 deletions EBGodunov/hydro_ebgodunov_plm_fpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ EBPLM::PredictStateOnXFace (Box const& xebox, int ncomp,
auto extdir_lohi_x = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::x));
auto extdir_lohi_y = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::y));

bool has_extdir_or_ho_lo_x = extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = extdir_lohi_y.second;
// If we have a BC Array4, then we can't make these blanket statements about the domain face
// Best to assume we could have face-based BC somewhere
bool has_extdir_or_ho_lo_x = bc_arr ? true : extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = bc_arr ? true : extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = bc_arr ? true : extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = bc_arr ? true : extdir_lohi_y.second;

#if (AMREX_SPACEDIM == 3)
const int domain_klo = domain_box.smallEnd(2);
const int domain_khi = domain_box.bigEnd(2);
auto extdir_lohi_z = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::z));
bool has_extdir_or_ho_lo_z = extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = extdir_lohi_z.second;
bool has_extdir_or_ho_lo_z = bc_arr ? true : extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = bc_arr ? true : extdir_lohi_z.second;
#endif

if ( (has_extdir_or_ho_lo_x && domain_ilo >= xebox.smallEnd(0)-1) ||
Expand Down Expand Up @@ -111,7 +113,7 @@ EBPLM::PredictStateOnXFace (Box const& xebox, int ncomp,

// We have enough cells to do 4th order slopes centered on (i,j,k) with all values at cell centers
if (vfrac(i,j,k) == 1. && vfrac(i-1,j,k) == 1. && vfrac(i-2,j,k) == 1. &&
vfrac(i+1,j,k) == 1. && vfrac(i+2,j,k) == 1.)
vfrac(i+1,j,k) == 1. && vfrac(i+2,j,k) == 1.)
{
int order = 4;
qpls = q(i,j,k,n) + Real(0.5) * (-Real(1.0) - umac(i,j,k,0) * dtdx) *
Expand Down Expand Up @@ -391,17 +393,17 @@ EBPLM::PredictStateOnYFace ( Box const& yebox, int ncomp,
auto extdir_lohi_x = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::x));
auto extdir_lohi_y = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::y));

bool has_extdir_or_ho_lo_x = extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = extdir_lohi_y.second;
bool has_extdir_or_ho_lo_x = bc_arr ? true : extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = bc_arr ? true : extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = bc_arr ? true : extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = bc_arr ? true : extdir_lohi_y.second;

#if (AMREX_SPACEDIM == 3)
const int domain_klo = domain_box.smallEnd(2);
const int domain_khi = domain_box.bigEnd(2);
auto extdir_lohi_z = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::z));
bool has_extdir_or_ho_lo_z = extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = extdir_lohi_z.second;
bool has_extdir_or_ho_lo_z = bc_arr ? true : extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = bc_arr ? true : extdir_lohi_z.second;
#endif

if ( (has_extdir_or_ho_lo_x && domain_ilo >= yebox.smallEnd(0)-1) ||
Expand Down Expand Up @@ -731,12 +733,12 @@ EBPLM::PredictStateOnZFace ( Box const& zebox, int ncomp,
auto extdir_lohi_y = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::y));
auto extdir_lohi_z = has_extdir_or_ho(h_bcrec.data(), ncomp, static_cast<int>(Direction::z));

bool has_extdir_or_ho_lo_x = extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = extdir_lohi_y.second;
bool has_extdir_or_ho_lo_z = extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = extdir_lohi_z.second;
bool has_extdir_or_ho_lo_x = bc_arr ? true : extdir_lohi_x.first;
bool has_extdir_or_ho_hi_x = bc_arr ? true : extdir_lohi_x.second;
bool has_extdir_or_ho_lo_y = bc_arr ? true : extdir_lohi_y.first;
bool has_extdir_or_ho_hi_y = bc_arr ? true : extdir_lohi_y.second;
bool has_extdir_or_ho_lo_z = bc_arr ? true : extdir_lohi_z.first;
bool has_extdir_or_ho_hi_z = bc_arr ? true : extdir_lohi_z.second;

if ( (has_extdir_or_ho_lo_x && domain_ilo >= zebox.smallEnd(0)-1) ||
(has_extdir_or_ho_hi_x && domain_ihi <= zebox.bigEnd(0) ) ||
Expand Down
4 changes: 2 additions & 2 deletions Godunov/hydro_godunov_extrap_vel_to_faces_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Godunov::ExtrapVelToFaces ( MultiFab const& a_vel,
else
{
PLM::PredictVelOnXFace( Box(u_ad), AMREX_SPACEDIM, Imx, Ipx, vel, vel,
geom, l_dt, h_bcrec, d_bcrec);
geom, l_dt, h_bcrec, d_bcrec, bc_arr);
PLM::PredictVelOnYFace( Box(v_ad), AMREX_SPACEDIM, Imy, Ipy, vel, vel,
geom, l_dt, h_bcrec, d_bcrec);
geom, l_dt, h_bcrec, d_bcrec, bc_arr);
}

ComputeAdvectiveVel( Box(u_ad), Box(v_ad),
Expand Down

0 comments on commit 2df5730

Please sign in to comment.