ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
surface_flux_charnock Struct Reference

#include <ERF_MOSTStress.H>

Collaboration diagram for surface_flux_charnock:

Public Member Functions

 surface_flux_charnock (amrex::Real zref, amrex::Real flux, amrex::Real cnk_a, bool cnk_visc)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void iterate_flux (const int &i, const int &j, const int &k, const int &max_iters, const amrex::Array4< amrex::Real > &z0_arr, const amrex::Array4< const amrex::Real > &umm_arr, const amrex::Array4< const amrex::Real > &tm_arr, const amrex::Array4< const amrex::Real > &tvm_arr, const amrex::Array4< const amrex::Real > &qvm_arr, const amrex::Array4< amrex::Real > &u_star_arr, const amrex::Array4< amrex::Real > &w_star_arr, const amrex::Array4< amrex::Real > &t_star_arr, const amrex::Array4< amrex::Real > &q_star_arr, const amrex::Array4< amrex::Real > &t_surf_arr, const amrex::Array4< amrex::Real > &olen_arr, const amrex::Array4< amrex::Real > &pblh_arr, const amrex::Array4< amrex::Real > &, const amrex::Array4< amrex::Real > &, const amrex::Array4< amrex::Real > &) const
 

Private Attributes

most_data mdata
 
similarity_funs sfuns
 
const amrex::Real tol = 1.0e-5
 
const amrex::Real WSMIN = 0.1
 

Detailed Description

Surface flux with charnock roughness

Constructor & Destructor Documentation

◆ surface_flux_charnock()

surface_flux_charnock::surface_flux_charnock ( amrex::Real  zref,
amrex::Real  flux,
amrex::Real  cnk_a,
bool  cnk_visc 
)
inline
482  {
483  mdata.zref = zref;
484  mdata.surf_temp_flux = flux;
485  mdata.Cnk_a = cnk_a;
486  mdata.visc = cnk_visc;
487  }
amrex::Real zref
Reference height (m)
Definition: ERF_MOSTStress.H:15
amrex::Real Cnk_a
Standard Charnock constant https://doi.org/10.1175/JAMC-D-17-0137.1.
Definition: ERF_MOSTStress.H:21
bool visc
Use viscous Charnock formulation.
Definition: ERF_MOSTStress.H:26
amrex::Real surf_temp_flux
Heat flux.
Definition: ERF_MOSTStress.H:19
most_data mdata
Definition: ERF_MOSTStress.H:558

Member Function Documentation

◆ iterate_flux()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void surface_flux_charnock::iterate_flux ( const int &  i,
const int &  j,
const int &  k,
const int &  max_iters,
const amrex::Array4< amrex::Real > &  z0_arr,
const amrex::Array4< const amrex::Real > &  umm_arr,
const amrex::Array4< const amrex::Real > &  tm_arr,
const amrex::Array4< const amrex::Real > &  tvm_arr,
const amrex::Array4< const amrex::Real > &  qvm_arr,
const amrex::Array4< amrex::Real > &  u_star_arr,
const amrex::Array4< amrex::Real > &  w_star_arr,
const amrex::Array4< amrex::Real > &  t_star_arr,
const amrex::Array4< amrex::Real > &  q_star_arr,
const amrex::Array4< amrex::Real > &  t_surf_arr,
const amrex::Array4< amrex::Real > &  olen_arr,
const amrex::Array4< amrex::Real > &  pblh_arr,
const amrex::Array4< amrex::Real > &  ,
const amrex::Array4< amrex::Real > &  ,
const amrex::Array4< amrex::Real > &   
) const
inline
511  {
512  int iter = 0;
513  amrex::Real ustar = 0.0;
514  amrex::Real wstar = 0.0;
515  amrex::Real tflux = 0.0;
516  amrex::Real z0 = 0.0;
517  amrex::Real zeta = 0.0;
518  amrex::Real psi_m = 0.0;
519  amrex::Real psi_h = 0.0;
520  amrex::Real Olen = 0.0;
521  amrex::Real umm = std::max(umm_arr(i,j,k), WSMIN);
522  u_star_arr(i,j,k) = mdata.kappa * umm / std::log(mdata.zref / z0_arr(i,j,k));
523  do {
524  ustar = u_star_arr(i,j,k);
525  if (mdata.Cnk_a > 0) {
526  z0 = (mdata.Cnk_a / mdata.gravity) * ustar * ustar;
527  if (mdata.visc) {
528  z0 += air_viscosity(tm_arr(i,j,k)) / std::max(ustar, 0.05);
529  }
530  } else {
531  z0 = COARE3_roughness(mdata.zref, umm, ustar);
532  }
533  tflux = mdata.surf_temp_flux*(1 + 0.61*qvm_arr(i,j,k)) - 0.61*tm_arr(i,j,k)*ustar*q_star_arr(i,j,k);
534  if (w_star_arr) {
535  // update w* and Umagmean
536  w_star_arr(i,j,k) = calc_wstar(tflux, pblh_arr(i,j,k), tvm_arr(i,j,k));
537  wstar = mdata.Bjr_beta * w_star_arr(i,j,k);
538  umm = std::sqrt(umm_arr(i,j,k)*umm_arr(i,j,k) + wstar*wstar);
539  umm = std::max(umm, WSMIN);
540  }
541  Olen = -ustar * ustar * ustar * tvm_arr(i,j,k) / (mdata.kappa * mdata.gravity * tflux);
542  zeta = mdata.zref / Olen;
543  psi_m = sfuns.calc_psi_m(zeta);
544  psi_h = sfuns.calc_psi_h(zeta);
545  u_star_arr(i,j,k) = mdata.kappa * umm / (std::log(mdata.zref / z0) - psi_m);
546  ++iter;
547  } while ((std::abs(u_star_arr(i,j,k) - ustar) > tol) && iter <= max_iters);
548  AMREX_ASSERT_WITH_MESSAGE(iter < max_iters, "Maximum number of MOST iterations reached.");
549 
550  t_surf_arr(i,j,k) = mdata.surf_temp_flux * (std::log(mdata.zref / z0) - psi_h) /
551  (u_star_arr(i,j,k) * mdata.kappa) + tm_arr(i,j,k);
552  t_star_arr(i,j,k) = -mdata.surf_temp_flux / u_star_arr(i,j,k);
553  olen_arr(i,j,k) = Olen;
554  z0_arr(i,j,k) = z0;
555  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real COARE3_roughness(amrex::Real zref, amrex::Real umm, amrex::Real ustar)
Definition: ERF_MOSTRoughness.H:9
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real air_viscosity(amrex::Real T_degK)
Definition: ERF_MOSTStress.H:79
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real calc_wstar(const amrex::Real &ust, const amrex::Real &tst, const amrex::Real &qst, const amrex::Real &pblh, const amrex::Real &th, const amrex::Real &thv, const amrex::Real &qv=0.0)
Definition: ERF_Wstar.H:13
amrex::Real kappa
von Karman constant
Definition: ERF_MOSTStress.H:17
amrex::Real gravity
Acceleration due to gravity (m/s^2)
Definition: ERF_MOSTStress.H:18
const amrex::Real Bjr_beta
Definition: ERF_MOSTStress.H:28
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_psi_m(amrex::Real zeta) const
Definition: ERF_MOSTStress.H:40
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real calc_psi_h(amrex::Real zeta) const
Definition: ERF_MOSTStress.H:54
const amrex::Real tol
Definition: ERF_MOSTStress.H:560
similarity_funs sfuns
Definition: ERF_MOSTStress.H:559
const amrex::Real WSMIN
Definition: ERF_MOSTStress.H:561
Here is the call graph for this function:

Member Data Documentation

◆ mdata

most_data surface_flux_charnock::mdata
private

◆ sfuns

similarity_funs surface_flux_charnock::sfuns
private

Referenced by iterate_flux().

◆ tol

const amrex::Real surface_flux_charnock::tol = 1.0e-5
private

Referenced by iterate_flux().

◆ WSMIN

const amrex::Real surface_flux_charnock::WSMIN = 0.1
private

Referenced by iterate_flux().


The documentation for this struct was generated from the following file: