Skip to content

Commit

Permalink
Ref temp return
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Nov 26, 2024
1 parent f329979 commit 01edfc1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ private:

amrex::Vector<amrex::Real> 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<transport::TransportModel> m_transport;

//! Thermal expansion coefficient
std::unique_ptr<ScratchField> m_beta;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::TransportModel> 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) {
Expand All @@ -51,7 +47,7 @@ void BoussinesqBuoyancy::operator()(
const FieldState fstate,
const amrex::Array4<amrex::Real>& src_term) const
{
const amrex::Real T0 = m_ref_theta;
const amrex::Real T0 = m_transport->reference_temperature();
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> gravity{
m_gravity[0], m_gravity[1], m_gravity[2]};

Expand Down
5 changes: 4 additions & 1 deletion amr-wind/transport_models/ConstTransport.H
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public:
return diff;
}

//! Return the thermal diffusivity field
//! Return the thermal expansion coefficient
inline std::unique_ptr<ScratchField> beta() override
{
auto beta = m_repo.create_scratch_field(1, 1);
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions amr-wind/transport_models/TransportModel.H
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public:

//! Thermal expansion coefficient
virtual std::unique_ptr<ScratchField> beta() = 0;

//! Reference temperature
virtual amrex::Real reference_temperature() = 0;
};
} // namespace amr_wind::transport

Expand Down
8 changes: 7 additions & 1 deletion amr-wind/transport_models/TwoPhaseTransport.H
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public:
return diff;
}

//! Return the thermal diffusivity field
//! Return the thermal expansion coefficient
inline std::unique_ptr<ScratchField> beta() override
{
amrex::Abort("TwoPhase thermal expansion coefficient not implemented");
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 01edfc1

Please sign in to comment.