Skip to content

Commit

Permalink
fix faulty logic
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren committed Aug 10, 2024
1 parent b4b1c69 commit 7c50d29
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions MOL/hydro_mol_extrap_vel_to_faces_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ MOL::ExtrapVelToFacesBox ( AMREX_D_DECL( Box const& ubx,
Real umns = vcc_mns + Real(0.5) * amrex_calc_xslope_extdir(
i-1,j,k,0,order,vcc,extdir_or_ho_ilo, extdir_or_ho_ihi, domain_ilo, domain_ihi);

HydroBC::SetExtrapVelBCsLo(0,i, j, k, n, vcc, umns, upls, d_bcrec[0].lo(0), domain_ilo);
HydroBC::SetExtrapVelBCsHi(0,i, j, k, n, vcc, umns, upls, d_bcrec[0].hi(0), domain_ihi);
HydroBC::SetExtrapVelBCsLo(0, i, j, k, n, vcc, umns, upls, d_bcrec[0].lo(0), domain_ilo);
HydroBC::SetExtrapVelBCsHi(0, i, j, k, n, vcc, umns, upls, d_bcrec[0].hi(0), domain_ihi);

if (!allow_inflow_on_outflow) {
if ( (i==domain_ilo) && (d_bcrec[0].lo(0) == BCType::foextrap || d_bcrec[0].lo(0) == BCType::hoextrap) )
Expand Down
53 changes: 30 additions & 23 deletions Utils/hydro_bcs_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ void SetExtrapVelBCsLo (int edge_dir, int i, int j, int k, int n,
//

GpuArray<int,3> iv = {i,j,k};
iv[edge_dir] = domlo-1;

Real s_ext = s(iv[0],iv[1],iv[2],n);

if (i == domlo)
if (iv[edge_dir] == domlo)
{
iv[edge_dir] = domlo-1;
Real s_ext = s(iv[0],iv[1],iv[2],n);

if ( (bclo == BCType::ext_dir) ||
(bclo == BCType::direction_dependent && s_ext > 0.0) )
{
Expand All @@ -102,7 +102,9 @@ void SetExtrapVelBCsLo (int edge_dir, int i, int j, int k, int n,
hi = Real(0.);
lo = Real(0.);
}
else
else if ( bclo == BCType::foextrap || bclo == BCType::hoextrap ||
bclo == BCType::reflect_even ||
(bclo == BCType::direction_dependent && s_ext <= 0.0))
{
lo = hi;
}
Expand Down Expand Up @@ -134,12 +136,12 @@ void SetExtrapVelBCsHi (int edge_dir, int i, int j, int k, int n,
//

GpuArray<int,3> iv = {i,j,k};
iv[edge_dir] = domhi+1;

Real s_ext = s(iv[0],iv[1],iv[2],n);

if (i == domhi+1)
if (iv[edge_dir] == domhi+1)
{
iv[edge_dir] = domhi+1;
Real s_ext = s(iv[0],iv[1],iv[2],n);

if ( (bchi == BCType::ext_dir) ||
(bchi == BCType::direction_dependent && s_ext < 0.0) )
{
Expand All @@ -151,7 +153,9 @@ void SetExtrapVelBCsHi (int edge_dir, int i, int j, int k, int n,
lo = Real(0.);
hi = Real(0.);
}
else
else if ( bchi == BCType::foextrap || bchi == BCType::hoextrap ||
bchi == BCType::reflect_even ||
(bchi == BCType::direction_dependent && s_ext >= 0.0))
{
hi = lo;
}
Expand Down Expand Up @@ -185,14 +189,14 @@ void SetEdgeBCsLo (int edge_dir, int i, int j, int k, int n,
//

GpuArray<int,3> iv = {i,j,k};
iv[edge_dir] = domlo-1;

Real s_ext = s(iv[0],iv[1],iv[2],n);
if (iv[edge_dir] == domlo)
{
iv[edge_dir] = domlo-1;
Real s_ext = s(iv[0],iv[1],iv[2],n);

bool is_vel_in_dir = is_velocity && (n == edge_dir);
bool is_vel_in_dir = is_velocity && (n == edge_dir);

if (i == domlo)
{
if (bclo == BCType::direction_dependent && macvel > 0.0)
{
if (is_vel_in_dir) {
Expand Down Expand Up @@ -221,7 +225,9 @@ void SetEdgeBCsLo (int edge_dir, int i, int j, int k, int n,
hi = Real(0.);
lo = Real(0.);
}
else
else if ( bclo == BCType::foextrap || bclo == BCType::hoextrap ||
bclo == BCType::reflect_even ||
(bclo == BCType::direction_dependent && macvel <= 0.0))
{
lo = hi;
}
Expand Down Expand Up @@ -255,14 +261,14 @@ void SetEdgeBCsHi (int edge_dir, int i, int j, int k, int n,
//

GpuArray<int,3> iv = {i,j,k};
iv[edge_dir] = domhi+1;

Real s_ext = s(iv[0],iv[1],iv[2],n);
if (iv[edge_dir] == domhi+1)
{
iv[edge_dir] = domhi+1;
Real s_ext = s(iv[0],iv[1],iv[2],n);

bool is_vel_in_dir = is_velocity && (n == edge_dir);
bool is_vel_in_dir = is_velocity && (n == edge_dir);

if (i == domhi+1)
{
if (bchi == BCType::direction_dependent && macvel < 0.0)
{
if (is_vel_in_dir) {
Expand Down Expand Up @@ -291,13 +297,14 @@ void SetEdgeBCsHi (int edge_dir, int i, int j, int k, int n,
lo = Real(0.);
hi = Real(0.);
}
else
else if ( bchi == BCType::foextrap || bchi == BCType::hoextrap ||
bchi == BCType::reflect_even ||
(bchi == BCType::direction_dependent && macvel >= 0.0))
{
hi = lo;
}
}
}

} // namespace
#endif
/** @}*/

0 comments on commit 7c50d29

Please sign in to comment.