Skip to content

Commit

Permalink
use simpler path to use internal inout flag in advection
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul1992 committed Aug 14, 2024
1 parent 95320e4 commit b25fdce
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 26 deletions.
3 changes: 1 addition & 2 deletions amr-wind/equation_systems/AdvOp_Godunov.H
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ struct AdvectionOp<
bool /* has_overset */,
bool /* variable density */,
bool /* mesh mapping */,
bool /* is_anelastic */,
bool /* has_inout_bndry */)
bool /* is_anelastic */)
: fields(fields_in)
, density(fields_in.repo.get_field("density"))
, u_mac(fields_in.repo.get_field("u_mac"))
Expand Down
3 changes: 1 addition & 2 deletions amr-wind/equation_systems/AdvOp_MOL.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ struct AdvectionOp<
bool /* has_overset */,
bool /* variable density */,
bool /* mesh mapping */,
bool /* is_anelastic */,
bool /* has_inout_bndry */)
bool /* is_anelastic */)
: fields(fields_in)
, density(fields_in.repo.get_field("density"))
, u_mac(fields_in.repo.get_field("u_mac"))
Expand Down
6 changes: 2 additions & 4 deletions amr-wind/equation_systems/PDE.H
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public:

m_adv_op.reset(new AdvectionOp<PDE, Scheme>(
m_sim, m_fields, m_sim.has_overset(), variable_density,
m_sim.has_mesh_mapping(), m_sim.is_anelastic(),
m_fields.field.has_inout_bndry()));
m_sim.has_mesh_mapping(), m_sim.is_anelastic()));
m_src_op.init_source_terms(m_sim);

// Post-solve operations should also apply after initialization
Expand All @@ -93,8 +92,7 @@ public:

m_adv_op.reset(new AdvectionOp<PDE, Scheme>(
m_sim, m_fields, m_sim.has_overset(), variable_density,
m_sim.has_mesh_mapping(), m_sim.is_anelastic(),
m_fields.field.has_inout_bndry()));
m_sim.has_mesh_mapping(), m_sim.is_anelastic()));

// Post-solve operations should also apply after a regrid
m_post_solve_op(m_time.current_time());
Expand Down
16 changes: 5 additions & 11 deletions amr-wind/equation_systems/icns/icns_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public:
bool /*has_overset*/,
bool /*variable_density*/,
bool /*mesh_mapping*/,
bool /*is_anelastic*/,
bool /*has_inout_bndry*/);
bool /*is_anelastic*/);

void set_inflow_velocity(amrex::Real time);

Expand Down Expand Up @@ -63,7 +62,6 @@ private:
bool m_variable_density{false};
bool m_mesh_mapping{false};
bool m_is_anelastic{false};
bool m_has_inout_bndry{false};
amrex::Real m_rho_0{1.0};
};

Expand All @@ -79,8 +77,7 @@ struct AdvectionOp<ICNS, fvm::Godunov>
bool has_overset,
bool variable_density,
bool mesh_mapping,
bool is_anelastic,
bool has_inout_bndry)
bool is_anelastic)
: fields(fields_in)
, u_mac(fields_in.repo.get_field("u_mac"))
, v_mac(fields_in.repo.get_field("v_mac"))
Expand All @@ -91,8 +88,7 @@ struct AdvectionOp<ICNS, fvm::Godunov>
has_overset,
variable_density,
mesh_mapping,
is_anelastic,
has_inout_bndry)
is_anelastic)
{

amrex::ParmParse pp("incflo");
Expand Down Expand Up @@ -458,8 +454,7 @@ struct AdvectionOp<ICNS, fvm::MOL>
bool has_overset,
bool variable_density,
bool mesh_mapping,
bool is_anelastic,
bool has_inout_bndry)
bool is_anelastic)
: fields(fields_in)
, u_mac(fields_in.repo.get_field("u_mac"))
, v_mac(fields_in.repo.get_field("v_mac"))
Expand All @@ -471,8 +466,7 @@ struct AdvectionOp<ICNS, fvm::MOL>
has_overset,
variable_density,
m_mesh_mapping,
is_anelastic,
has_inout_bndry)
is_anelastic)
{}

void preadvect(
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/equation_systems/icns/icns_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@ MacProjOp::MacProjOp(
bool has_overset,
bool variable_density,
bool mesh_mapping,
bool is_anelastic,
bool has_inout_bndry)
bool is_anelastic)
: m_repo(repo)
, m_phy_mgr(phy_mgr)
, m_options("mac_proj")
, m_has_overset(has_overset)
, m_variable_density(variable_density)
, m_mesh_mapping(mesh_mapping)
, m_is_anelastic(is_anelastic)
, m_has_inout_bndry(has_inout_bndry)
{
amrex::ParmParse pp("incflo");
pp.query("density", m_rho_0);
Expand Down Expand Up @@ -279,7 +277,9 @@ void MacProjOp::operator()(const FieldState fstate, const amrex::Real dt)
}
}

if (m_has_inout_bndry) {
const bool has_inout_bndry =
(m_repo.get_field("velocity")).has_inout_bndry();
if (has_inout_bndry) {
enforce_inout_solvability(mac_vec);
}

Expand Down
1 change: 0 additions & 1 deletion amr-wind/equation_systems/vof/vof_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct AdvectionOp<VOF, fvm::Godunov>
bool /*unused*/,
bool /*unused*/,
bool /*unused*/,
bool /*unused*/,
bool /*unused*/)
: fields(fields_in)
, u_mac(fields_in.repo.get_field("u_mac"))
Expand Down
3 changes: 1 addition & 2 deletions unit_tests/equation_systems/test_icns_cstdens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class ICNSConstDensTest : public MeshTest

// Initialize MAC projection operator
const auto& mco = amr_wind::pde::MacProjOp(
sim().repo(), sim().physics_manager(), false, false, false, false,
false);
sim().repo(), sim().physics_manager(), false, false, false, false);
// Get background density and check
const amrex::Real rho0 = mco.rho0();
EXPECT_EQ(rho0, m_rho_0);
Expand Down

0 comments on commit b25fdce

Please sign in to comment.