Skip to content

Commit

Permalink
modify to support time-dependent inflow (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Aug 12, 2024
1 parent 186df80 commit a51a1b3
Show file tree
Hide file tree
Showing 19 changed files with 578 additions and 411 deletions.
12 changes: 8 additions & 4 deletions Docs/source/bcs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Domain boundary conditions affect the pre-MAC extrapolated velocities in three w
specified by the BC, but then allow that outflowing velocity to transport values that come
from the interior.

* Direction-dependent (``direction_dependent``): if the face velocity is inflowing, this bc
is identical to ``extdir``; if the face velocity is outflowing, this is equivalent to ``foextrap``.

* First-order extrapolation (``foextrap``), higher order extrapolation (``hoextrap``), or
even reflection about the boundary (``reflecteven``):

Expand Down Expand Up @@ -103,8 +106,9 @@ For the post-MAC edge state,
Boundary conditions are imposed before the upwinding described in the :ref:`schemes` section.

API documentation can be found in the Doxygen Technical Reference,
functions `SetXEdgeBCs`_, `SetYEdgeBCs`_, `SetZEdgeBCs`_ .
functions `SetExtrapVelBCsLo`_ , `SetExtrapVeldgeBCsHi`_ ,`SetEdgeBCsLo`_ , and `SetEdgeBCsHi`_ .

.. _`SetXEdgeBCs`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#ab90f8ce229a7ebbc521dc27d65f2db9a
.. _`SetYEdgeBCs`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#a6865c2cfd50cc95f9b69ded1e8ac78ab
.. _`SetZEdgeBCs`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#a19ddc5ac50e9a6b9a98bc17f3815a62e
.. _`SetExtrapVelBCsLo`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#ab90f8ce229a7ebbc521dc27d65f2db9a
.. _`SetExtrapVelBCsHi`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#ab90f8ce229a7ebbc521dc27d65f2db9a
.. _`SetEdgeBCsLo`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#ab90f8ce229a7ebbc521dc27d65f2db9a
.. _`SetEdgeBCsHi`: https://amrex-fluids.github.io/amrex-hydro/Doxygen/html/namespaceHydroBC.html#a6865c2cfd50cc95f9b69ded1e8ac78ab
1 change: 1 addition & 0 deletions EBGodunov/hydro_ebgodunov.H
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ namespace EBGodunov {

void ComputeEdgeState ( amrex::Box const& bx, int ncomp,
amrex::Array4<amrex::Real const> const& q,
amrex::Array4<amrex::Real const> const& qnph,
AMREX_D_DECL( amrex::Array4<amrex::Real> const& xedge,
amrex::Array4<amrex::Real> const& yedge,
amrex::Array4<amrex::Real> const& zedge),
Expand Down
25 changes: 13 additions & 12 deletions EBGodunov/hydro_ebgodunov_bcs_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void SetXBCs (const int i, const int j, const int k, const int n,
lo = hi;

if ( i<domlo)
Abort("EBGodunovBC::SetXBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
//
// Note that this is only relevant for 3D, as only 3D ever needs to
// set the BC beyond the domain face.
Expand All @@ -82,7 +82,7 @@ void SetXBCs (const int i, const int j, const int k, const int n,
hi = Real(0.);
lo = Real(0.);
} else {
Abort("EBGodunovBC::SetXBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// lo = -hi_arr(2*domlo-i ,j,k,n);
// hi = -lo_arr(2*domlo-i-1,j,k,n);
}
Expand Down Expand Up @@ -113,7 +113,7 @@ void SetXBCs (const int i, const int j, const int k, const int n,
hi = lo;

if ( i>domhi+1 )
Abort("EBGodunovBC::SetXBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
// hi = lo_arr(2*(domhi+1)-i-1,j,k,n);
// lo = hi_arr(2*(domhi+1)-i ,j,k,n);
}
Expand All @@ -123,7 +123,8 @@ void SetXBCs (const int i, const int j, const int k, const int n,
hi = Real(0.);
lo = Real(0.);
} else {
Abort("EBGodunovBC::SetXBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// hi = lo_arr(2*(domhi+1)-i-1,j,k,n);
// hi = -lo_arr(2*(domhi+1)-i-1,j,k,n);
// lo = -hi_arr(2*(domhi+1)-i ,j,k,n);
}
Expand Down Expand Up @@ -170,7 +171,7 @@ void SetYBCs (const int i, const int j, const int k, const int n,
lo = hi;

if ( j<domlo )
Abort("EBGodunovBC::SetYBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
// lo = hi_arr(i,2*domlo-j ,k,n);
// hi = lo_arr(i,2*domlo-j-1,k,n);
}
Expand All @@ -180,7 +181,7 @@ void SetYBCs (const int i, const int j, const int k, const int n,
hi = Real(0.);
lo = Real(0.);
} else {
Abort("EBGodunovBC::SetYBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// lo = -hi_arr(i,2*domlo-j ,k,n);
// hi = -lo_arr(i,2*domlo-j-1,k,n);
}
Expand Down Expand Up @@ -211,7 +212,7 @@ void SetYBCs (const int i, const int j, const int k, const int n,
hi = lo;

if ( j>domhi+1)
Abort("EBGodunovBC::SetYBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
// hi = lo_arr(i,2*(domhi+1)-j-1,k,n);
// lo = hi_arr(i,2*(domhi+1)-j ,k,n);
}
Expand All @@ -221,7 +222,7 @@ void SetYBCs (const int i, const int j, const int k, const int n,
hi = Real(0.);
lo = Real(0.);
} else {
Abort("EBGodunovBC::SetYBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet fully implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// hi = -lo_arr(i,2*(domhi+1)-j-1,k,n);
// lo = -hi_arr(i,2*(domhi+1)-j ,k,n);
}
Expand Down Expand Up @@ -266,13 +267,13 @@ void SetZBCs (const int i, const int j, const int k, const int n,
}
else if (bclo == BCType::reflect_even)
{
Abort("EBGodunovBC::SetZBCs not yet implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
// lo = hi_arr(i,j,2*domlo-k ,n);
// hi = lo_arr(i,j,2*domlo-k-1,n);
}
else if(bclo == BCType::reflect_odd)
{
Abort("EBGodunovBC::SetZBCs not yet implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// if ( k==domlo ) {
// hi = Real(0.);
// lo = Real(0.);
Expand Down Expand Up @@ -304,13 +305,13 @@ void SetZBCs (const int i, const int j, const int k, const int n,
}
else if (bchi == BCType::reflect_even)
{
Abort("EBGodunovBC::SetZBCs not yet implemented for reflect_even BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet implemented for reflect_even BC. See comments in EBGodunovBC::SetBCs.");
// hi = lo_arr(i,j,2*(domhi+1)-k-1,n);
// lo = hi_arr(i,j,2*(domhi+1)-k ,n);
}
else if (bchi == BCType::reflect_odd)
{
Abort("EBGodunovBC::SetZBCs not yet implemented for reflect_odd BC. See comments in EBGodunovBC::SetXBCs.");
Abort("EBGodunovBC::SetBCs not yet implemented for reflect_odd BC. See comments in EBGodunovBC::SetBCs.");
// if ( k==domhi+1 ) {
// hi = Real(0.);
// lo = Real(0.);
Expand Down
25 changes: 13 additions & 12 deletions EBGodunov/hydro_ebgodunov_edge_state_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ using namespace amrex;
void
EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
Array4<Real const> const& q,
Array4<Real const> const& qnph,
Array4<Real> const& xedge,
Array4<Real> const& yedge,
Array4<Real const> const& u_mac,
Expand Down Expand Up @@ -110,8 +111,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,

const auto bc = HydroBC::getBC(i, j, k, n, domain, pbc, bc_arr);

HydroBC::SetXEdgeBCs(i, j, k, n, q, lo, hi, u_mac(i,j,k), u_mac(i,j,k),
bc.lo(0), dlo.x, bc.hi(0), dhi.x, is_velocity);
HydroBC::SetEdgeBCsLo(0,i, j, k, n, qnph, lo, hi, u_mac(i,j,k), bc.lo(0), dlo.x, is_velocity);
HydroBC::SetEdgeBCsHi(0,i, j, k, n, qnph, lo, hi, u_mac(i,j,k), bc.hi(0), dhi.x, is_velocity);

xlo(i,j,k,n) = lo;
xhi(i,j,k,n) = hi;
Expand All @@ -123,8 +124,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,

const auto bc = HydroBC::getBC(i, j, k, n, domain, pbc, bc_arr);

HydroBC::SetYEdgeBCs(i, j, k, n, q, lo, hi, v_mac(i,j,k), v_mac(i,j,k),
bc.lo(1), dlo.y, bc.hi(1), dhi.y, is_velocity);
HydroBC::SetEdgeBCsLo(1, i, j, k, n, qnph, lo, hi, v_mac(i,j,k), bc.lo(1), dlo.y, is_velocity);
HydroBC::SetEdgeBCsHi(1, i, j, k, n, qnph, lo, hi, v_mac(i,j,k), bc.hi(1), dhi.y, is_velocity);

ylo(i,j,k,n) = lo;
yhi(i,j,k,n) = hi;
Expand All @@ -145,8 +146,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,

l_yzlo = ylo(i,j,k,n);
l_yzhi = yhi(i,j,k,n);
HydroBC::SetYEdgeBCs(i, j, k, n, q, l_yzlo, l_yzhi, v_mac(i,j,k), v_mac(i,j,k),
bc.lo(1), dlo.y, bc.hi(1), dhi.y, is_velocity);
HydroBC::SetEdgeBCsLo(1, i, j, k, n, qnph, l_yzlo, l_yzhi, v_mac(i,j,k), bc.lo(1), dlo.y, is_velocity);
HydroBC::SetEdgeBCsHi(1, i, j, k, n, qnph, l_yzlo, l_yzhi, v_mac(i,j,k), bc.hi(1), dhi.y, is_velocity);

Real vad = v_mac(i,j,k);
Real st = (vad >= 0.) ? l_yzlo : l_yzhi;
Expand Down Expand Up @@ -224,8 +225,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
}

const auto bc = HydroBC::getBC(i, j, k, n, domain, pbc, bc_arr);
HydroBC::SetXEdgeBCs(i, j, k, n, q, stl, sth, u_mac(i,j,k), u_mac(i,j,k),
bc.lo(0), dlo.x, bc.hi(0), dhi.x, is_velocity);
HydroBC::SetEdgeBCsLo(0, i, j, k, n, qnph, stl, sth, u_mac(i,j,k), bc.lo(0), dlo.x, is_velocity);
HydroBC::SetEdgeBCsHi(0, i, j, k, n, qnph, stl, sth, u_mac(i,j,k), bc.hi(0), dhi.x, is_velocity);

if (!allow_inflow_on_outflow) {
if ( (i==dlo.x) && (bc.lo(0) == BCType::foextrap || bc.lo(0) == BCType::hoextrap) )
Expand Down Expand Up @@ -265,8 +266,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
l_xzlo = xlo(i,j,k,n);
l_xzhi = xhi(i,j,k,n);

HydroBC::SetXEdgeBCs(i, j, k, n, q, l_xzlo, l_xzhi, u_mac(i,j,k), u_mac(i,j,k),
bc.lo(0), dlo.x, bc.hi(0), dhi.x, is_velocity);
HydroBC::SetEdgeBCsLo(0, i, j, k, n, qnph, l_xzlo, l_xzhi, u_mac(i,j,k), bc.lo(0), dlo.x, is_velocity);
HydroBC::SetEdgeBCsHi(0, i, j, k, n, qnph, l_xzlo, l_xzhi, u_mac(i,j,k), bc.hi(0), dhi.x, is_velocity);

Real uad = u_mac(i,j,k);
Real st = (uad >= 0.) ? l_xzlo : l_xzhi;
Expand Down Expand Up @@ -344,8 +345,8 @@ EBGodunov::ComputeEdgeState ( Box const& bx, int ncomp,
}

const auto bc = HydroBC::getBC(i, j, k, n, domain, pbc, bc_arr);
HydroBC::SetYEdgeBCs(i, j, k, n, q, stl, sth, v_mac(i,j,k), v_mac(i,j,k),
bc.lo(1), dlo.y, bc.hi(1), dhi.y, is_velocity);
HydroBC::SetEdgeBCsLo(1, i, j, k, n, qnph, stl, sth, v_mac(i,j,k), bc.lo(1), dlo.y, is_velocity);
HydroBC::SetEdgeBCsHi(1, i, j, k, n, qnph, stl, sth, v_mac(i,j,k), bc.hi(1), dhi.y, is_velocity);

if (!allow_inflow_on_outflow) {
if ( (j==dlo.y) && (bc.lo(1) == BCType::foextrap || bc.lo(1) == BCType::hoextrap) )
Expand Down
Loading

0 comments on commit a51a1b3

Please sign in to comment.