From b25fdce81a2241e853290bea15dbfed53f02df52 Mon Sep 17 00:00:00 2001 From: Mukul Dave Date: Wed, 14 Aug 2024 14:11:32 -0700 Subject: [PATCH] use simpler path to use internal inout flag in advection --- amr-wind/equation_systems/AdvOp_Godunov.H | 3 +-- amr-wind/equation_systems/AdvOp_MOL.H | 3 +-- amr-wind/equation_systems/PDE.H | 6 ++---- amr-wind/equation_systems/icns/icns_advection.H | 16 +++++----------- .../equation_systems/icns/icns_advection.cpp | 8 ++++---- amr-wind/equation_systems/vof/vof_advection.H | 1 - .../equation_systems/test_icns_cstdens.cpp | 3 +-- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/amr-wind/equation_systems/AdvOp_Godunov.H b/amr-wind/equation_systems/AdvOp_Godunov.H index 4ef0e84457..09eaebadf8 100644 --- a/amr-wind/equation_systems/AdvOp_Godunov.H +++ b/amr-wind/equation_systems/AdvOp_Godunov.H @@ -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")) diff --git a/amr-wind/equation_systems/AdvOp_MOL.H b/amr-wind/equation_systems/AdvOp_MOL.H index 328fbe5aa7..b276e39d78 100644 --- a/amr-wind/equation_systems/AdvOp_MOL.H +++ b/amr-wind/equation_systems/AdvOp_MOL.H @@ -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")) diff --git a/amr-wind/equation_systems/PDE.H b/amr-wind/equation_systems/PDE.H index 9601cf454f..485616d680 100644 --- a/amr-wind/equation_systems/PDE.H +++ b/amr-wind/equation_systems/PDE.H @@ -69,8 +69,7 @@ public: m_adv_op.reset(new AdvectionOp( 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 @@ -93,8 +92,7 @@ public: m_adv_op.reset(new AdvectionOp( 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()); diff --git a/amr-wind/equation_systems/icns/icns_advection.H b/amr-wind/equation_systems/icns/icns_advection.H index 161f7212e9..1ebe3bf195 100644 --- a/amr-wind/equation_systems/icns/icns_advection.H +++ b/amr-wind/equation_systems/icns/icns_advection.H @@ -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); @@ -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}; }; @@ -79,8 +77,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) , u_mac(fields_in.repo.get_field("u_mac")) , v_mac(fields_in.repo.get_field("v_mac")) @@ -91,8 +88,7 @@ struct AdvectionOp has_overset, variable_density, mesh_mapping, - is_anelastic, - has_inout_bndry) + is_anelastic) { amrex::ParmParse pp("incflo"); @@ -458,8 +454,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) , u_mac(fields_in.repo.get_field("u_mac")) , v_mac(fields_in.repo.get_field("v_mac")) @@ -471,8 +466,7 @@ struct AdvectionOp has_overset, variable_density, m_mesh_mapping, - is_anelastic, - has_inout_bndry) + is_anelastic) {} void preadvect( diff --git a/amr-wind/equation_systems/icns/icns_advection.cpp b/amr-wind/equation_systems/icns/icns_advection.cpp index 6cc502921d..e191801e3c 100644 --- a/amr-wind/equation_systems/icns/icns_advection.cpp +++ b/amr-wind/equation_systems/icns/icns_advection.cpp @@ -47,8 +47,7 @@ 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") @@ -56,7 +55,6 @@ MacProjOp::MacProjOp( , 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); @@ -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); } diff --git a/amr-wind/equation_systems/vof/vof_advection.H b/amr-wind/equation_systems/vof/vof_advection.H index 4f387fe90a..94eaab2af4 100644 --- a/amr-wind/equation_systems/vof/vof_advection.H +++ b/amr-wind/equation_systems/vof/vof_advection.H @@ -20,7 +20,6 @@ struct AdvectionOp bool /*unused*/, bool /*unused*/, bool /*unused*/, - bool /*unused*/, bool /*unused*/) : fields(fields_in) , u_mac(fields_in.repo.get_field("u_mac")) diff --git a/unit_tests/equation_systems/test_icns_cstdens.cpp b/unit_tests/equation_systems/test_icns_cstdens.cpp index 5995ef80ee..806a9804e9 100644 --- a/unit_tests/equation_systems/test_icns_cstdens.cpp +++ b/unit_tests/equation_systems/test_icns_cstdens.cpp @@ -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);