Skip to content

Commit

Permalink
Make clipping true default for pressure_outflow and deprecate pressur…
Browse files Browse the repository at this point in the history
…e_inflow (Exawind#1287)

* remove pressure_inflow from code and docs
* incorporate option for inflow -- equation-specific
* remove pressure_inflow from unit tests
  • Loading branch information
mbkuhn authored Oct 24, 2024
1 parent 517ff62 commit b9858be
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 27 deletions.
8 changes: 2 additions & 6 deletions amr-wind/boundary_conditions/BCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ void BCIface::read_bctype()
continue;
}

if ((bcstr == "pressure_inflow") || (bcstr == "pi")) {
ibctype[ori] = BC::pressure_inflow;
} else if ((bcstr == "pressure_outflow") || (bcstr == "po")) {
if ((bcstr == "pressure_outflow") || (bcstr == "po")) {
ibctype[ori] = BC::pressure_outflow;
} else if ((bcstr == "mass_inflow") || (bcstr == "mi")) {
ibctype[ori] = BC::mass_inflow;
Expand Down Expand Up @@ -202,7 +200,6 @@ void BCVelocity::set_bcrec()
}
break;

case BC::pressure_inflow:
case BC::pressure_outflow:
case BC::zero_gradient:
if (side == amrex::Orientation::low) {
Expand Down Expand Up @@ -303,7 +300,6 @@ void BCScalar::set_bcrec()
}
break;

case BC::pressure_inflow:
case BC::pressure_outflow:
case BC::zero_gradient:
case BC::symmetric_wall:
Expand Down Expand Up @@ -387,7 +383,7 @@ void BCPressure::read_values()
const auto bct = bctype[ori];

amrex::ParmParse pp(bcid);
if ((bct == BC::pressure_inflow) || (bct == BC::pressure_outflow)) {
if ((bct == BC::pressure_outflow)) {
pp.queryarr(fname.c_str(), bcval[ori], 0, ndim);
}
}
Expand Down
7 changes: 2 additions & 5 deletions amr-wind/boundary_conditions/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ The boundary conditions that can be specified in the input file are:
- =pressure_outflow= :: =BCRec = foextrap= and =LinOpBCType = Neumann=. This is
the standard outflow BC for velocity and scalars. For MAC projection and
nodal-projection, it uses a Dirichlet BC for pressure. The value of pressure
at the boundary is specified in the input file (default = 0).
at the boundary is specified in the input file (default = 0). This can be
used as an inflow condition if ...

- =no_slip_wall= :: Like =mass_inflow=, this sets =BCRec= to =ext_dir= and
specifies Dirichlet BC for the linear solvers. However, it differs from
Expand Down Expand Up @@ -85,7 +86,6 @@ possible for scalars and tangential component of velocity.

| Name | Short | V_n | V_t | Scalar | Source |
|------------------+-------+-------------+----------+----------+----------|
| pressure_inflow | pi | foextrap | foextrap | foextrap | foextrap |
| pressure_outflow | po | foextrap | foextrap | foextrap | foextrap |
| mass_inflow | mi | ext_dir | ext_dir | ext_dir | foextrap |
| no_slip_wall | nsw | ext_dir (0) | ext_dir | ext_dir | foextrap |
Expand All @@ -103,7 +103,6 @@ projection (pressure) and MAC projections.

| Name | Short | Linear solver BC |
|------------------+-------+------------------|
| pressure_inflow | pi | Dirichlet |
| pressure_outflow | po | Dirichlet |
| mass_inflow | mi | Neumann |
| zero_gradient | zg | Neumann |
Expand All @@ -118,7 +117,6 @@ projection (pressure) and MAC projections.

| Name | Short | Normal component | Tangential component |
|------------------+-------+------------------+----------------------|
| pressure_inflow | pi | Neumann | Neumann |
| pressure_outflow | po | Neumann | Neumann |
| mass_inflow | mi | Dirichlet | Dirichlet |
| zero_gradient | zg | Dirichlet (0) | Neumann |
Expand All @@ -134,7 +132,6 @@ projection (pressure) and MAC projections.

| Name | Short | Linear solver BC |
|------------------+-------+------------------|
| pressure_inflow | pi | Neumann |
| pressure_outflow | po | Neumann |
| mass_inflow | mi | Dirichlet |
| zero_gradient | zg | Neumann |
Expand Down
2 changes: 0 additions & 2 deletions amr-wind/diffusion/incflo_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Vector<Array<LinOpBCType, AMREX_SPACEDIM>> get_diffuse_tensor_bc(
} else {
auto bc = velocity.bc_type()[Orientation(dir, side)];
switch (bc) {
case BC::pressure_inflow:
case BC::pressure_outflow:
case BC::zero_gradient: {
// All three components are Neumann
Expand Down Expand Up @@ -76,7 +75,6 @@ get_diffuse_scalar_bc(amr_wind::Field& scalar, Orientation::Side side) noexcept
} else {
auto bc = scalar.bc_type()[Orientation(dir, side)];
switch (bc) {
case BC::pressure_inflow:
case BC::pressure_outflow:
case BC::zero_gradient:
case BC::symmetric_wall:
Expand Down
10 changes: 6 additions & 4 deletions amr-wind/equation_systems/AdvOp_Godunov.H
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ struct AdvectionOp<
"between plm, ppm, ppm_nolim, bds, weno_js, and weno_z. If no "
"godunov_type is specified, the default weno_z is used.");
}

amrex::ParmParse pp_eq{fields_in.field.base_name()};
pp_eq.query(
"allow_inflow_at_pressure_outflow", m_allow_inflow_on_outflow);

// TODO: Need iconserv flag to be adjusted???
iconserv.resize(PDE::ndim, 1);
}
Expand Down Expand Up @@ -174,10 +179,7 @@ struct AdvectionOp<
} else {
limiter_type = PPM::default_limiter;
}
if ((godunov_scheme == godunov::scheme::WENOZ) ||
(godunov_scheme == godunov::scheme::WENO_JS)) {
m_allow_inflow_on_outflow = true;
}

// if state is NPH, then n and n+1 are known, and only
// spatial extrapolation is performed
const amrex::Real dt_extrap =
Expand Down
6 changes: 5 additions & 1 deletion amr-wind/equation_systems/icns/icns_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ struct AdvectionOp<ICNS, fvm::Godunov>

// Get copy of verbose
pp.query("verbose", m_verbose);

amrex::ParmParse pp_eq("ICNS");
pp_eq.query(
"allow_inflow_at_pressure_outflow", m_allow_inflow_on_outflow);
}

void preadvect(
Expand Down Expand Up @@ -378,7 +382,7 @@ struct AdvectionOp<ICNS, fvm::Godunov>
dof_field, dof_nph, src_term, rho_o, rho_nph, u_mac, v_mac,
w_mac, dof_field.bcrec(), dof_field.bcrec_device().data(),
rho_o.bcrec(), rho_o.bcrec_device().data(), dt, mflux_scheme,
godunov_use_forces_in_trans);
m_allow_inflow_on_outflow, godunov_use_forces_in_trans);
}

amrex::Vector<amrex::Array<amrex::MultiFab*, AMREX_SPACEDIM>> fluxes(
Expand Down
1 change: 0 additions & 1 deletion amr-wind/equation_systems/icns/icns_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ amrex::Array<amrex::LinOpBCType, AMREX_SPACEDIM> get_projection_bc(
} else {
auto bc = bctype[amrex::Orientation(dir, side)];
switch (bc) {
case BC::pressure_inflow:
case BC::pressure_outflow: {
r[dir] = amrex::LinOpBCType::Dirichlet;
break;
Expand Down
1 change: 0 additions & 1 deletion amr-wind/equation_systems/vof/vof_bciface.H
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ protected:

// For the wall cases, the fillpatch BC is effectively a
// contact-line model
case BC::pressure_inflow:
case BC::pressure_outflow:
case BC::zero_gradient:
case BC::no_slip_wall:
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/vof/vof_momentum_flux.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static void hybrid_fluxes(
amrex::BCRec const* rhobc_d,
const amrex::Real dt,
godunov::scheme mflux_scheme,
bool allow_inflow_on_outflow,
bool use_forces_in_trans)
{
// Get geometry
Expand Down Expand Up @@ -106,7 +107,6 @@ static void hybrid_fluxes(
const bool known_edge_state = false;
const bool godunov_use_ppm = true;
const bool is_velocity = false;
const bool allow_inflow_on_outflow = true;
const bool fluxes_are_area_weighted = false;

amrex::MFItInfo mfi_info;
Expand Down
1 change: 0 additions & 1 deletion amr-wind/incflo_enums.H
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
enum struct DiffusionType { Invalid, Explicit, Crank_Nicolson, Implicit };

enum struct BC {
pressure_inflow,
pressure_outflow,
mass_inflow,
mass_inflow_outflow,
Expand Down
2 changes: 0 additions & 2 deletions amr-wind/physics/VortexRing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ void VortexRing::initialize_velocity(const VortexRingType& vorticity_theta)
} else {

switch (bctype[amrex::Orientation(dir, amrex::Orientation::low)]) {
case BC::pressure_inflow:
case BC::pressure_outflow: {
bclo[dir] = amrex::LinOpBCType::Dirichlet;
break;
Expand All @@ -216,7 +215,6 @@ void VortexRing::initialize_velocity(const VortexRingType& vorticity_theta)
};

switch (bctype[amrex::Orientation(dir, amrex::Orientation::high)]) {
case BC::pressure_inflow:
case BC::pressure_outflow: {
bchi[dir] = amrex::LinOpBCType::Dirichlet;
break;
Expand Down
1 change: 0 additions & 1 deletion amr-wind/projection/incflo_apply_nodal_projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ amr_wind::nodal_projection::get_projection_bc(
} else {
auto bc = bctype[Orientation(dir, side)];
switch (bc) {
case BC::pressure_inflow:
case BC::pressure_outflow: {
r[dir] = LinOpBCType::Dirichlet;
break;
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/user/inputs_Boundary_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This section controls the boundary conditions. Only non-periodic BC's need to be
**type:** String, mandatory if non-periodic

Boundary condition type on the lo (or hi) side of the domain.
Current options are: periodic, pressure_inflow, pressure_outflow, mass_inflow,
Current options are: periodic, pressure_outflow, mass_inflow,
mass_inflow_outflow, no_slip_wall, slip_wall, symmetric_wall and wall_model.

.. input_param:: xlo.temperature (or ylo.temperature, etc)
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/projection/test_pressure_offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class ProjPerturb : public AmrexTest
amrex::ParmParse ppyhi("yhi");
ppyhi.add("type", (std::string) "slip_wall");
amrex::ParmParse ppzhi("zhi");
ppzhi.add("type", (std::string) "pressure_inflow");
ppzhi.add("type", (std::string) "pressure_outflow");
}

const amrex::Real m_rho_0 = 1.0;
Expand Down

0 comments on commit b9858be

Please sign in to comment.