Skip to content

Commit

Permalink
beta in turb models
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Nov 26, 2024
1 parent 9ac5508 commit f329979
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 0 additions & 4 deletions amr-wind/turbulence/LES/AMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ AMD<Transport>::AMD(CFDSim& sim)
{
auto& phy_mgr = this->m_sim.physics_manager();
if (phy_mgr.contains("ABL")) {
{
amrex::ParmParse pp("ABL");
pp.get("reference_temperature", m_ref_theta);
}
{
amrex::ParmParse pp("incflo");
pp.queryarr("gravity", m_gravity);
Expand Down
6 changes: 3 additions & 3 deletions amr-wind/turbulence/LES/OneEqKsgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ OneEqKsgsM84<Transport>::OneEqKsgsM84(CFDSim& sim)

{
amrex::ParmParse pp("ABL");
pp.get("reference_temperature", m_ref_theta);
pp.query("enable_hybrid_rl_mode", m_hybrid_rl);
}

Expand Down Expand Up @@ -101,7 +100,7 @@ void OneEqKsgsM84<Transport>::update_turbulent_viscosity(

const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> gravity{
m_gravity[0], m_gravity[1], m_gravity[2]};
const amrex::Real beta = 1.0 / m_ref_theta;
const auto beta = (this->m_transport).beta();

auto& mu_turb = this->mu_turb();
const amrex::Real Ce = this->m_Ce;
Expand All @@ -127,14 +126,15 @@ void OneEqKsgsM84<Transport>::update_turbulent_viscosity(
const auto& tke_arr = (*this->m_tke)(lev).array(mfi);
const auto& buoy_prod_arr = (this->m_buoy_prod)(lev).array(mfi);
const auto& shear_prod_arr = (this->m_shear_prod)(lev).array(mfi);
const auto& beta_arr = (*beta)(lev).array(mfi);

amrex::ParallelFor(
bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
amrex::Real stratification =
-(gradT_arr(i, j, k, 0) * gravity[0] +
gradT_arr(i, j, k, 1) * gravity[1] +
gradT_arr(i, j, k, 2) * gravity[2]) *
beta;
beta_arr(i,j,k);
if (stratification > 1e-10) {
tlscale_arr(i, j, k) = amrex::min<amrex::Real>(
ds, 0.76 * std::sqrt(
Expand Down
9 changes: 5 additions & 4 deletions amr-wind/turbulence/RANS/KLAxell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ KLAxell<Transport>::KLAxell(CFDSim& sim)
}
{
amrex::ParmParse pp("ABL");
pp.get("reference_temperature", m_ref_theta);
pp.get("surface_temp_flux", m_surf_flux);
pp.query("length_scale_switch", m_lengthscale_switch);
}
Expand Down Expand Up @@ -84,7 +83,7 @@ void KLAxell<Transport>::update_turbulent_viscosity(

const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> gravity{
m_gravity[0], m_gravity[1], m_gravity[2]};
const amrex::Real beta = 1.0 / m_ref_theta;
const auto beta = (this->m_transport).beta();
const amrex::Real Cmu = m_Cmu;
const amrex::Real Cb_stable = m_Cb_stable;
const amrex::Real Cb_unstable = m_Cb_unstable;
Expand Down Expand Up @@ -113,6 +112,8 @@ void KLAxell<Transport>::update_turbulent_viscosity(
const auto& tke_arr = (*this->m_tke)(lev).array(mfi);
const auto& buoy_prod_arr = (this->m_buoy_prod)(lev).array(mfi);
const auto& shear_prod_arr = (this->m_shear_prod)(lev).array(mfi);
const auto& beta_arr = (*beta)(lev).array(mfi);

//! Add terrain components
const bool has_terrain =
this->m_sim.repo().int_field_exists("terrain_blank");
Expand All @@ -130,7 +131,7 @@ void KLAxell<Transport>::update_turbulent_viscosity(
-(gradT_arr(i, j, k, 0) * gravity[0] +
gradT_arr(i, j, k, 1) * gravity[1] +
gradT_arr(i, j, k, 2) * gravity[2]) *
beta;
beta_arr(i,j,k);
const amrex::Real z = std::max(
problo[2] + (k + 0.5) * dz - ht_arr(i, j, k),
0.5 * dz);
Expand Down Expand Up @@ -201,7 +202,7 @@ void KLAxell<Transport>::update_turbulent_viscosity(
-(gradT_arr(i, j, k, 0) * gravity[0] +
gradT_arr(i, j, k, 1) * gravity[1] +
gradT_arr(i, j, k, 2) * gravity[2]) *
beta;
beta_arr(i,j,k);
const amrex::Real z = problo[2] + (k + 0.5) * dz;
const amrex::Real lscale_s =
(lambda * kappa * z) / (lambda + kappa * z);
Expand Down

0 comments on commit f329979

Please sign in to comment.