From 01edfc1120af0854a6c14efd39b9e2b91d2d1e52 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Mon, 25 Nov 2024 19:32:50 -0700 Subject: [PATCH] Ref temp return --- .../icns/source_terms/BoussinesqBuoyancy.H | 6 +++--- .../icns/source_terms/BoussinesqBuoyancy.cpp | 10 +++------- amr-wind/transport_models/ConstTransport.H | 5 ++++- amr-wind/transport_models/TransportModel.H | 3 +++ amr-wind/transport_models/TwoPhaseTransport.H | 8 +++++++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.H b/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.H index e69fa29cd5..16def1a1fa 100644 --- a/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.H +++ b/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.H @@ -36,12 +36,12 @@ private: amrex::Vector m_gravity{0.0, 0.0, -9.81}; - //! Reference temperature (Kelvin) - amrex::Real m_ref_theta{300.0}; - //! Check for VOF bool m_is_vof{false}; + //! Transport model + std::unique_ptr m_transport; + //! Thermal expansion coefficient std::unique_ptr m_beta; }; diff --git a/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.cpp b/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.cpp index d5ac65055b..7c0ad452b5 100644 --- a/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.cpp +++ b/amr-wind/equation_systems/icns/source_terms/BoussinesqBuoyancy.cpp @@ -17,17 +17,13 @@ namespace amr_wind::pde::icns { BoussinesqBuoyancy::BoussinesqBuoyancy(const CFDSim& sim) : m_temperature(sim.repo().get_field("temperature")) { - amrex::ParmParse pp_boussinesq_buoyancy( - amr_wind::pde::icns::BoussinesqBuoyancy::identifier()); - pp_boussinesq_buoyancy.get("reference_temperature", m_ref_theta); - std::string transport_model_name = "ConstTransport"; { amrex::ParmParse pp("transport"); pp.query("model", transport_model_name); } - std::unique_ptr transport = transport::TransportModel::create(transport_model_name, sim); - m_beta = transport->beta(); + m_transport = transport::TransportModel::create(transport_model_name, sim); + m_beta = m_transport->beta(); m_is_vof = sim.repo().field_exists("vof"); if (m_is_vof) { @@ -51,7 +47,7 @@ void BoussinesqBuoyancy::operator()( const FieldState fstate, const amrex::Array4& src_term) const { - const amrex::Real T0 = m_ref_theta; + const amrex::Real T0 = m_transport->reference_temperature(); const amrex::GpuArray gravity{ m_gravity[0], m_gravity[1], m_gravity[2]}; diff --git a/amr-wind/transport_models/ConstTransport.H b/amr-wind/transport_models/ConstTransport.H index b70b806371..6bbb0ddfba 100644 --- a/amr-wind/transport_models/ConstTransport.H +++ b/amr-wind/transport_models/ConstTransport.H @@ -150,7 +150,7 @@ public: return diff; } - //! Return the thermal diffusivity field + //! Return the thermal expansion coefficient inline std::unique_ptr beta() override { auto beta = m_repo.create_scratch_field(1, 1); @@ -167,6 +167,9 @@ public: return beta; } + inline amrex::Real reference_temperature() override {return m_reference_temperature;} + + private: //! Reference to the field repository (for creating scratch fields) FieldRepo& m_repo; diff --git a/amr-wind/transport_models/TransportModel.H b/amr-wind/transport_models/TransportModel.H index 2b520e7edf..064aa75a45 100644 --- a/amr-wind/transport_models/TransportModel.H +++ b/amr-wind/transport_models/TransportModel.H @@ -45,6 +45,9 @@ public: //! Thermal expansion coefficient virtual std::unique_ptr beta() = 0; + + //! Reference temperature + virtual amrex::Real reference_temperature() = 0; }; } // namespace amr_wind::transport diff --git a/amr-wind/transport_models/TwoPhaseTransport.H b/amr-wind/transport_models/TwoPhaseTransport.H index de82b65f88..7ce5187939 100644 --- a/amr-wind/transport_models/TwoPhaseTransport.H +++ b/amr-wind/transport_models/TwoPhaseTransport.H @@ -221,7 +221,7 @@ public: return diff; } - //! Return the thermal diffusivity field + //! Return the thermal expansion coefficient inline std::unique_ptr beta() override { amrex::Abort("TwoPhase thermal expansion coefficient not implemented"); @@ -232,6 +232,9 @@ public: return beta; } + inline amrex::Real reference_temperature() override {return m_reference_temperature;} + + private: //! Reference to the CFD sim const CFDSim& m_sim; @@ -256,6 +259,9 @@ private: //! Turbulent Prandtl number amrex::Real m_Prt{1.0}; + + //! Reference temperature + amrex::Real m_reference_temperature{-1.0}; }; } // namespace amr_wind::transport