ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
SurfaceLayer Class Reference

#include <ERF_SurfaceLayer.H>

Collaboration diagram for SurfaceLayer:

Public Types

enum class  FluxCalcType {
  MOENG = 0 , DONELAN , CUSTOM , BULK_COEFF ,
  ROTATE , RICO
}
 
enum class  ThetaCalcType { ADIABATIC = 0 , HEAT_FLUX , SURFACE_TEMPERATURE }
 
enum class  MoistCalcType { ADIABATIC = 0 , MOISTURE_FLUX , SURFACE_MOISTURE }
 
enum class  RoughCalcType {
  CONSTANT = 0 , CHARNOCK , MODIFIED_CHARNOCK , DONELAN ,
  WAVE_COUPLED
}
 
enum class  PBLHeightCalcType { None , MYNN25 , YSU , MRF }
 

Public Member Functions

 SurfaceLayer (const amrex::Vector< amrex::Geometry > &geom, bool &use_rot_surface_flux, std::string a_pp_prefix, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Qv_prim, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &z_phys_nd, const MeshType &a_mesh_type, const TerrainType &a_terrain_type, const TurbChoice &a_turb_choice, amrex::Real start_low_time, amrex::Real final_low_time, amrex::Real low_time_interval=0.0)
 
void make_SurfaceLayer_at_level (const int &lev, int nlevs, const amrex::Vector< amrex::MultiFab * > &mfv, std::unique_ptr< amrex::MultiFab > &Theta_prim, std::unique_ptr< amrex::MultiFab > &Qv_prim, std::unique_ptr< amrex::MultiFab > &Qr_prim, std::unique_ptr< amrex::MultiFab > &z_phys_nd, amrex::MultiFab *Hwave, amrex::MultiFab *Lwave, amrex::MultiFab *eddyDiffs, amrex::Vector< amrex::MultiFab * > lsm_data, amrex::Vector< std::string > lsm_data_name, amrex::Vector< amrex::MultiFab * > lsm_flux, amrex::Vector< std::string > lsm_flux_name, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &sst_lev, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &tsk_lev, amrex::Vector< std::unique_ptr< amrex::iMultiFab >> &lmask_lev)
 
void update_fluxes (const int &lev, const amrex::Real &elapsed_time_since_start_low, amrex::MultiFab &cons_in, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &walldist, int max_iters=100)
 
template<typename FluxIter >
void compute_fluxes (const int &lev, const int &max_iters, amrex::MultiFab &cons_in, const FluxIter &most_flux, bool is_land)
 
void init_tke_from_ustar (const int &lev, amrex::MultiFab &cons, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const amrex::Real tkefac=1.0, const amrex::Real zscale=700.0)
 
void impose_SurfaceLayer_bcs (const int &lev, amrex::Vector< const amrex::MultiFab * > mfs, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Tau_lev, amrex::MultiFab *xheat_flux, amrex::MultiFab *yheat_flux, amrex::MultiFab *zheat_flux, amrex::MultiFab *xqv_flux, amrex::MultiFab *yqv_flux, amrex::MultiFab *zqv_flux, const amrex::MultiFab *z_phys)
 
template<typename FluxCalc >
void compute_SurfaceLayer_bcs (const int &lev, amrex::Vector< const amrex::MultiFab * > mfs, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Tau_lev, amrex::MultiFab *xheat_flux, amrex::MultiFab *yheat_flux, amrex::MultiFab *zheat_flux, amrex::MultiFab *xqv_flux, amrex::MultiFab *yqv_flux, amrex::MultiFab *zqv_flux, const amrex::MultiFab *z_phys, const FluxCalc &flux_comp)
 
void fill_tsurf_with_sst_and_tsk (const int &lev, const amrex::Real &time)
 
void fill_qsurf_with_qsat (const int &lev, const amrex::MultiFab &cons_in, const std::unique_ptr< amrex::MultiFab > &z_phys_nd)
 
void get_lsm_tsurf (const int &lev)
 
void update_pblh (const int &lev, amrex::Vector< amrex::Vector< amrex::MultiFab >> &vars, amrex::MultiFab *z_phys_cc, const MoistureComponentIndices &moisture_indices)
 
template<typename PBLHeightEstimator >
void compute_pblh (const int &lev, amrex::Vector< amrex::Vector< amrex::MultiFab >> &vars, amrex::MultiFab *z_phys_cc, const PBLHeightEstimator &est, const MoistureComponentIndices &moisture_indice)
 
void read_custom_roughness (const int &lev, const std::string &fname)
 
void update_surf_temp (const amrex::Real &time)
 
void update_mac_ptrs (const int &lev, amrex::Vector< amrex::Vector< amrex::MultiFab >> &vars_old, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Theta_prim, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Qv_prim, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Qr_prim)
 
amrex::MultiFab * get_u_star (const int &lev)
 
amrex::MultiFab * get_w_star (const int &lev)
 
amrex::MultiFab * get_t_star (const int &lev)
 
amrex::MultiFab * get_q_star (const int &lev)
 
amrex::MultiFab * get_olen (const int &lev)
 
amrex::MultiFab * get_pblh (const int &lev)
 
const amrex::MultiFab * get_mac_avg (const int &lev, int comp)
 
amrex::MultiFab * get_t_surf (const int &lev)
 
void set_t_surf (const int &lev, const amrex::Real tsurf)
 
amrex::MultiFab * get_q_surf (const int &lev)
 
void set_q_surf (const int &lev, const amrex::Real qsurf)
 
amrex::Real get_zref (const int &lev)
 
amrex::MultiFab * get_z0 (const int &lev)
 
bool have_variable_sea_roughness ()
 
amrex::iMultiFab * get_lmask (const int &lev)
 
int lmask_min_reduce (amrex::iMultiFab &lmask, const int &nghost)
 
void update_sst_ptr (const int lev, const int itime, amrex::MultiFab *sst_ptr)
 
void update_tsk_ptr (const int lev, const int itime, amrex::MultiFab *tsk_ptr)
 
template<typename FluxIter >
void compute_fluxes (const int &lev, const int &max_iters, MultiFab &cons_in, const FluxIter &most_flux, bool is_land)
 
template<typename FluxCalc >
void compute_SurfaceLayer_bcs (const int &lev, Vector< const MultiFab * > mfs, Vector< std::unique_ptr< MultiFab >> &Tau_lev, MultiFab *xheat_flux, MultiFab *yheat_flux, MultiFab *zheat_flux, MultiFab *xqv_flux, MultiFab *yqv_flux, MultiFab *zqv_flux, const MultiFab *z_phys, const FluxCalc &flux_comp)
 
template<typename PBLHeightEstimator >
void compute_pblh (const int &lev, Vector< Vector< MultiFab >> &vars, MultiFab *z_phys_cc, const PBLHeightEstimator &est, const MoistureComponentIndices &moisture_indices)
 

Public Attributes

FluxCalcType flux_type {FluxCalcType::MOENG}
 
ThetaCalcType theta_type {ThetaCalcType::ADIABATIC}
 
MoistCalcType moist_type {MoistCalcType::ADIABATIC}
 
RoughCalcType rough_type_land {RoughCalcType::CONSTANT}
 
RoughCalcType rough_type_sea {RoughCalcType::CHARNOCK}
 
PBLHeightCalcType pblh_type {PBLHeightCalcType::None}
 

Private Attributes

amrex::Vector< amrex::Geometry > m_geom
 
bool m_rotate = false
 
amrex::Real m_start_low_time
 
amrex::Real m_final_low_time
 
amrex::Real m_low_time_interval
 
bool m_include_wstar = false
 
amrex::Real z0_const {0.1}
 
amrex::Real default_land_surf_temp {300.}
 
amrex::Real surf_temp
 
amrex::Real surf_heating_rate {0}
 
amrex::Real surf_temp_flux {0}
 
amrex::Real default_land_surf_moist {0.}
 
amrex::Real surf_moist
 
amrex::Real surf_moist_flux {0}
 
amrex::Real custom_ustar {0}
 
amrex::Real custom_tstar {0}
 
amrex::Real custom_qstar {0}
 
amrex::Real custom_rhosurf {0}
 
bool specified_rho_surf {false}
 
amrex::Real cnk_a {0.0185}
 
bool cnk_visc {false}
 
amrex::Real depth {30.0}
 
amrex::Vector< amrex::MultiFab > z_0
 
bool m_var_z0 {false}
 
amrex::Real rico_theta_z0 {298.0}
 
amrex::Real rico_qsat_z0 {0.001}
 
bool use_moisture
 
bool m_has_lsm_tsurf = false
 
int m_lsm_tsurf_indx = -1
 
amrex::Real m_Cd = 0.0
 
amrex::Real m_Ch = 0.0
 
amrex::Real m_Cq = 0.0
 
bool m_ignore_sst = false
 
MOSTAverage m_ma
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > u_star
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > w_star
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > t_star
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > q_star
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > olen
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > pblh
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > t_surf
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > q_surf
 
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_sst_lev
 
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_tsk_lev
 
amrex::Vector< amrex::Vector< amrex::iMultiFab * > > m_lmask_lev
 
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_lsm_data_lev
 
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_lsm_flux_lev
 
amrex::Vector< std::string > m_lsm_data_name
 
amrex::Vector< std::string > m_lsm_flux_name
 
amrex::Vector< amrex::MultiFab * > m_Hwave_lev
 
amrex::Vector< amrex::MultiFab * > m_Lwave_lev
 
amrex::Vector< amrex::MultiFab * > m_eddyDiffs_lev
 
bool m_update_k_rans = false
 
amrex::Real inv_Cmu2 = 0.0
 
amrex::Real theta_ref = 0.0
 

Detailed Description

Abstraction layer for different surface layer schemes (e.g. MOST, Cd)

van der Laan, P., Kelly, M. C., & Sørensen, N. N. (2017). A new k-epsilon model consistent with Monin-Obukhov similarity theory. Wind Energy, 20(3), 479–489. https://doi.org/10.1002/we.2017

Consistent with Dyer (1974) formulation from page 57, Chapter 2, Modeling the vertical ABL structure in Modelling of Atmospheric Flow Fields, Demetri P Lalas and Corrado F Ratto, January 1996, https://doi.org/10.1142/2975.

Member Enumeration Documentation

◆ FluxCalcType

Enumerator
MOENG 

Moeng functional form.

DONELAN 

Donelan functional form.

CUSTOM 

Custom constant flux functional form.

BULK_COEFF 

Bulk transfer coefficient functional form.

ROTATE 

Terrain rotation flux functional form.

RICO 
622  {
623  MOENG = 0, ///< Moeng functional form
624  DONELAN, ///< Donelan functional form
625  CUSTOM, ///< Custom constant flux functional form
626  BULK_COEFF, ///< Bulk transfer coefficient functional form
627  ROTATE, ///< Terrain rotation flux functional form
628  RICO
629  };

◆ MoistCalcType

Enumerator
ADIABATIC 
MOISTURE_FLUX 

Qv-flux specified.

SURFACE_MOISTURE 

Surface Qv specified.

637  {
638  ADIABATIC = 0,
639  MOISTURE_FLUX, ///< Qv-flux specified
640  SURFACE_MOISTURE ///< Surface Qv specified
641  };

◆ PBLHeightCalcType

Enumerator
None 
MYNN25 
YSU 
MRF 
651 { None, MYNN25, YSU, MRF };

◆ RoughCalcType

Enumerator
CONSTANT 

Constant z0.

CHARNOCK 
MODIFIED_CHARNOCK 
DONELAN 
WAVE_COUPLED 
643  {
644  CONSTANT = 0, ///< Constant z0
645  CHARNOCK,
646  MODIFIED_CHARNOCK,
647  DONELAN,
648  WAVE_COUPLED
649  };

◆ ThetaCalcType

Enumerator
ADIABATIC 
HEAT_FLUX 

Heat-flux specified.

SURFACE_TEMPERATURE 

Surface temperature specified.

631  {
632  ADIABATIC = 0,
633  HEAT_FLUX, ///< Heat-flux specified
634  SURFACE_TEMPERATURE ///< Surface temperature specified
635  };

Constructor & Destructor Documentation

◆ SurfaceLayer()

SurfaceLayer::SurfaceLayer ( const amrex::Vector< amrex::Geometry > &  geom,
bool &  use_rot_surface_flux,
std::string  a_pp_prefix,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Qv_prim,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  z_phys_nd,
const MeshType &  a_mesh_type,
const TerrainType &  a_terrain_type,
const TurbChoice a_turb_choice,
amrex::Real  start_low_time,
amrex::Real  final_low_time,
amrex::Real  low_time_interval = 0.0 
)
inlineexplicit
46  : m_geom(geom),
47  m_rotate(use_rot_surface_flux),
48  m_start_low_time(start_low_time),
49  m_final_low_time(final_low_time),
50  m_low_time_interval(low_time_interval),
51  m_ma(geom, (z_phys_nd[0] != nullptr), a_pp_prefix, a_mesh_type, a_terrain_type)
52  {
53  // We have a moisture model if Qv_prim is a valid pointer
54  use_moisture = (Qv_prim[0].get());
55 
56  // Get roughness
57  amrex::ParmParse pp("erf");
58  pp.query("most.z0", z0_const);
59 
60  // Specify how to compute the flux
61  if (use_rot_surface_flux) {
63  } else {
64  std::string flux_string_in;
65  std::string flux_string{"moeng"};
66  auto read_flux = pp.query("surface_layer.flux_type", flux_string_in);
67  if (read_flux) {
68  flux_string = amrex::toLower(flux_string_in);
69  }
70  if (flux_string == "donelan") {
72  } else if (flux_string == "moeng") {
74  } else if (flux_string == "rico") {
76  } else if (flux_string == "bulk_coeff") {
78  } else if (flux_string == "custom") {
80  } else {
81  amrex::Abort("Undefined MOST flux type!");
82  }
83  }
84 
85  // Include w* to handle free convection (Beljaars 1995, QJRMS)
86  pp.query("most.include_wstar", m_include_wstar);
87 
88  std::string pblh_string_in;
89  std::string pblh_string{"none"};
90  auto read_pblh = pp.query("most.pblh_calc", pblh_string_in);
91  if (read_pblh) {
92  pblh_string = amrex::toLower(pblh_string_in);
93  }
94  if (pblh_string == "none") {
96  } else if (pblh_string == "mynn25") {
98  } else if (pblh_string == "mynnedmf") {
100  } else if (pblh_string == "ysu") {
102  } else if (pblh_string == "mrf") {
104  } else {
105  amrex::Abort("Undefined PBLH calc type!");
106  }
107 
108  // Get surface temperature
109  auto erf_st = pp.query("most.surf_temp", surf_temp);
110  if (erf_st) { default_land_surf_temp = surf_temp; }
111 
112  // Get surface moisture
113  bool erf_sq = false;
114  if (use_moisture) { erf_sq = pp.query("most.surf_moist", surf_moist); }
115  if (erf_sq) { default_land_surf_moist = surf_moist; }
116 
117  // Custom type user must specify the fluxes
122  pp.get("most.ustar", custom_ustar);
123  pp.get("most.tstar", custom_tstar);
124  pp.get("most.qstar", custom_qstar);
125  pp.query("most.rhosurf", custom_rhosurf);
126  if (custom_qstar != 0) {
128  "Specified custom MOST qv flux without moisture model!");
129  }
130  amrex::Print() << "Using specified ustar, tstar, qstar for MOST = "
131  << custom_ustar << " " << custom_tstar << " "
132  << custom_qstar << std::endl;
133 
134  // Bulk transfer coefficient (must specify coeffs and surface values)
135  } else if (flux_type == FluxCalcType::BULK_COEFF) {
136  pp.get("most.Cd", m_Cd);
137  pp.get("most.Ch", m_Ch);
138  pp.get("most.Cq", m_Cq);
139  pp.get("most.surf_temp", default_land_surf_temp);
140  pp.get("most.surf_moist", default_land_surf_moist);
141  amrex::Print() << "Using specified Cd, Ch, Cq for MOST = "
142  << m_Cd << " " << m_Ch << " "
143  << m_Cq << std::endl;
144 
145  // Specify surface temperature/moisture or surface flux
146  } else {
147  if (erf_st) {
149  pp.query("most.surf_heating_rate", surf_heating_rate); // [K/h]
150  surf_heating_rate = surf_heating_rate / 3600.0; // [K/s]
151  if (pp.query("most.surf_temp_flux", surf_temp_flux)) {
152  amrex::Abort("Can only specify one of surf_temp_flux or surf_heating_rate");
153  }
154  } else {
155  pp.query("most.surf_temp_flux", surf_temp_flux);
156 
157  if (pp.query("most.surf_heating_rate", surf_heating_rate)) {
158  amrex::Abort("Can only specify one of surf_temp_flux or surf_heating_rate");
159  }
160  if (std::abs(surf_temp_flux) >
163  } else {
165  }
166  }
167 
168  if (erf_sq) {
170  } else {
171  pp.query("most.surf_moist_flux", surf_moist_flux);
172  if (std::abs(surf_moist_flux) >
175  } else {
177  }
178  }
179  }
180 
182  {
183  pp.query("most.rico.theta_z0", rico_theta_z0);
184  pp.query("most.rico.qsat_z0", rico_qsat_z0);
185  }
186 
187  // Make sure the inputs file doesn't try to use most.roughness_type
188  std::string bogus_input;
189  if (pp.query("most.roughness_type", bogus_input) > 0) {
190  amrex::Abort("most.roughness_type is deprecated; use "
191  "most.roughness_type_land and/or most.roughness_type_sea");
192  }
193 
194  // Specify how to compute the surface flux over land (if there is any)
195  std::string rough_land_string_in;
196  std::string rough_land_string{"constant"};
197  auto read_rough_land =
198  pp.query("most.roughness_type_land", rough_land_string_in);
199  if (read_rough_land) {
200  rough_land_string = amrex::toLower(rough_land_string_in);
201  }
202  if (rough_land_string == "constant") {
204  } else {
205  amrex::Abort("Undefined MOST roughness type for land!");
206  }
207 
208  // Specify how to compute the surface flux over sea (if there is any)
209  std::string rough_sea_string_in;
210  std::string rough_sea_string{"charnock"};
211  auto read_rough_sea = pp.query("most.roughness_type_sea", rough_sea_string_in);
212  if (read_rough_sea) {
213  rough_sea_string = amrex::toLower(rough_sea_string_in);
214  }
215  if (rough_sea_string == "charnock") {
217  pp.query("most.charnock_constant", cnk_a);
218  pp.query("most.charnock_viscosity", cnk_visc);
219  if (cnk_a > 0) {
220  amrex::Print() << "If there is water, Charnock relation with C_a="
221  << cnk_a << (cnk_visc ? " and viscosity" : "")
222  << " will be used" << std::endl;
223  } else {
224  amrex::Print() << "If there is water, Charnock relation with variable "
225  "Charnock parameter (COARE3.0)"
226  << (cnk_visc ? " and viscosity" : "") << " will be used"
227  << std::endl;
228  }
229  } else if (rough_sea_string == "coare3.0") {
231  amrex::Print() << "If there is water, Charnock relation with variable "
232  "Charnock parameter (COARE3.0)"
233  << (cnk_visc ? " and viscosity" : "") << " will be used"
234  << std::endl;
235  cnk_a = -1;
236  } else if (rough_sea_string == "donelan") {
238  } else if (rough_sea_string == "modified_charnock") {
240  pp.query("most.modified_charnock_depth", depth);
241  } else if (rough_sea_string == "wave_coupled") {
243  } else if (rough_sea_string == "constant") {
245  } else {
246  amrex::Abort("Undefined MOST roughness type for sea!");
247  }
248 
249  // use skin temperature instead of sea-surface temperature
250  // (wrfinput data may have lower resolution SST data)
251  pp.query("most.ignore_sst", m_ignore_sst);
252 
253  // If we're using the RANS k model, then we need to update the dirichlet
254  // BC based on the instantaneous u* and θ*; the turbulence modeling
255  // choices can vary per level but for now, assume that if specified then
256  // all levels are using the same RANS model.
257  m_update_k_rans = (a_turb_choice.rans_type == RANSType::kEqn &&
258  a_turb_choice.dirichlet_k == true);
259  if (m_update_k_rans) {
260  inv_Cmu2 = 1.0 / (a_turb_choice.Cmu0 * a_turb_choice.Cmu0);
261  theta_ref = a_turb_choice.theta_ref;
262  }
263 
264  } // constructor
ParmParse pp("prob")
AMREX_ASSERT_WITH_MESSAGE(wbar_cutoff_min > wbar_cutoff_max, "ERROR: wbar_cutoff_min < wbar_cutoff_max")
ThetaCalcType theta_type
Definition: ERF_SurfaceLayer.H:654
bool m_include_wstar
Definition: ERF_SurfaceLayer.H:668
bool m_rotate
Definition: ERF_SurfaceLayer.H:663
PBLHeightCalcType pblh_type
Definition: ERF_SurfaceLayer.H:658
bool use_moisture
Definition: ERF_SurfaceLayer.H:691
amrex::Real m_Cq
Definition: ERF_SurfaceLayer.H:697
RoughCalcType rough_type_land
Definition: ERF_SurfaceLayer.H:656
amrex::Real z0_const
Definition: ERF_SurfaceLayer.H:669
amrex::Real cnk_a
Definition: ERF_SurfaceLayer.H:682
amrex::Real m_Ch
Definition: ERF_SurfaceLayer.H:696
amrex::Real m_start_low_time
Definition: ERF_SurfaceLayer.H:664
amrex::Real surf_temp
Definition: ERF_SurfaceLayer.H:671
amrex::Real rico_qsat_z0
Definition: ERF_SurfaceLayer.H:689
bool m_update_k_rans
Definition: ERF_SurfaceLayer.H:722
amrex::Real surf_moist_flux
Definition: ERF_SurfaceLayer.H:676
RoughCalcType rough_type_sea
Definition: ERF_SurfaceLayer.H:657
amrex::Real surf_moist
Definition: ERF_SurfaceLayer.H:675
bool m_ignore_sst
Definition: ERF_SurfaceLayer.H:699
amrex::Real custom_qstar
Definition: ERF_SurfaceLayer.H:679
amrex::Real custom_rhosurf
Definition: ERF_SurfaceLayer.H:680
@ MOENG
Moeng functional form.
@ BULK_COEFF
Bulk transfer coefficient functional form.
@ CUSTOM
Custom constant flux functional form.
@ ROTATE
Terrain rotation flux functional form.
@ DONELAN
Donelan functional form.
@ SURFACE_MOISTURE
Surface Qv specified.
@ MOISTURE_FLUX
Qv-flux specified.
amrex::Real depth
Definition: ERF_SurfaceLayer.H:684
amrex::Real default_land_surf_moist
Definition: ERF_SurfaceLayer.H:674
amrex::Real rico_theta_z0
Definition: ERF_SurfaceLayer.H:688
amrex::Real surf_temp_flux
Definition: ERF_SurfaceLayer.H:673
amrex::Vector< amrex::Geometry > m_geom
Definition: ERF_SurfaceLayer.H:662
amrex::Real theta_ref
Definition: ERF_SurfaceLayer.H:724
amrex::Real custom_tstar
Definition: ERF_SurfaceLayer.H:678
amrex::Real m_final_low_time
Definition: ERF_SurfaceLayer.H:665
bool cnk_visc
Definition: ERF_SurfaceLayer.H:683
amrex::Real surf_heating_rate
Definition: ERF_SurfaceLayer.H:672
FluxCalcType flux_type
Definition: ERF_SurfaceLayer.H:653
MoistCalcType moist_type
Definition: ERF_SurfaceLayer.H:655
amrex::Real inv_Cmu2
Definition: ERF_SurfaceLayer.H:723
amrex::Real custom_ustar
Definition: ERF_SurfaceLayer.H:677
amrex::Real m_Cd
Definition: ERF_SurfaceLayer.H:695
amrex::Real default_land_surf_temp
Definition: ERF_SurfaceLayer.H:670
@ SURFACE_TEMPERATURE
Surface temperature specified.
@ HEAT_FLUX
Heat-flux specified.
amrex::Real m_low_time_interval
Definition: ERF_SurfaceLayer.H:666
MOSTAverage m_ma
Definition: ERF_SurfaceLayer.H:701
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
RANSType rans_type
Definition: ERF_TurbStruct.H:413
bool dirichlet_k
Definition: ERF_TurbStruct.H:415
amrex::Real Cmu0
Definition: ERF_TurbStruct.H:391
amrex::Real theta_ref
Definition: ERF_TurbStruct.H:402
Here is the call graph for this function:

Member Function Documentation

◆ compute_fluxes() [1/2]

template<typename FluxIter >
void SurfaceLayer::compute_fluxes ( const int &  lev,
const int &  max_iters,
amrex::MultiFab &  cons_in,
const FluxIter &  most_flux,
bool  is_land 
)

◆ compute_fluxes() [2/2]

template<typename FluxIter >
void SurfaceLayer::compute_fluxes ( const int &  lev,
const int &  max_iters,
MultiFab &  cons_in,
const FluxIter &  most_flux,
bool  is_land 
)

Function to compute the fluxes (u^star and t^star) for Monin Obukhov similarity theory

Parameters
[in]levCurrent level
[in]max_itersmaximum iterations to use
[in]most_fluxstructure to iteratively compute ustar and tstar
233 {
234  // Pointers to the computed averages
235  const auto *const tm_ptr = m_ma.get_average(lev,2); // potential temperature
236  const auto *const qvm_ptr = m_ma.get_average(lev,3); // water vapor mixing ratio
237  const auto *const tvm_ptr = m_ma.get_average(lev,4); // virtual potential temperature
238  const auto *const umm_ptr = m_ma.get_average(lev,5); // horizontal velocity magnitude
239  const auto *const zref_ptr = m_ma.get_zref(lev); // reference height
240 
241  const int klo = m_geom[lev].Domain().smallEnd(2);
242  IntVect ng = u_star[lev]->nGrowVect(); ng[2] = 0;
243 
244  for (MFIter mfi(cons_in); mfi.isValid(); ++mfi)
245  {
246  Box gtbx = mfi.tilebox(IntVect(0),ng);
247 
248  if (gtbx.smallEnd(2) != klo) { continue; }
249 
250  gtbx.makeSlab(2,klo);
251 
252  auto u_star_arr = u_star[lev]->array(mfi);
253  auto t_star_arr = t_star[lev]->array(mfi);
254  auto q_star_arr = q_star[lev]->array(mfi);
255  auto t_surf_arr = t_surf[lev]->array(mfi);
256  auto q_surf_arr = q_surf[lev]->array(mfi);
257  auto olen_arr = olen[lev]->array(mfi);
258 
259  const auto tm_arr = tm_ptr->array(mfi);
260  const auto tvm_arr = tvm_ptr->array(mfi);
261  const auto qvm_arr = qvm_ptr->array(mfi);
262  const auto umm_arr = umm_ptr->array(mfi);
263  const auto zref_arr = zref_ptr->array(mfi);
264  const auto z0_arr = z_0[lev].array(mfi);
265 
266  // PBL height if we need to calculate wstar for the Beljaars correction
267  // TODO: can/should we apply this in LES mode?
268  const auto w_star_arr = (m_include_wstar) ? w_star[lev].get()->array(mfi) : Array4<Real> {};
269  const auto pblh_arr = (m_include_wstar) ? pblh[lev].get()->array(mfi) : Array4<Real> {};
270 
271  // Wave properties if they exist
272  const auto Hwave_arr = (m_Hwave_lev[lev]) ? m_Hwave_lev[lev]->array(mfi) : Array4<Real> {};
273  const auto Lwave_arr = (m_Lwave_lev[lev]) ? m_Lwave_lev[lev]->array(mfi) : Array4<Real> {};
274  const auto eta_arr = (m_eddyDiffs_lev[lev]) ? m_eddyDiffs_lev[lev]->array(mfi) : Array4<Real> {};
275 
276  // Land mask array if it exists
277  auto lmask_arr = (m_lmask_lev[lev][0]) ? m_lmask_lev[lev][0]->array(mfi) :
278  Array4<int> {};
279 
280  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(int i, int j, int ) noexcept
281  {
282  if (( is_land && lmask_arr(i,j,0) == 1) ||
283  (!is_land && lmask_arr(i,j,0) == 0))
284  {
285  // NOTE: All 2D MFs so k index is always 0 from ba2d definition
286  most_flux.iterate_flux(i, j, 0, max_iters,
287  zref_arr, // set in most average
288  z0_arr, // updated if(!is_land)
289  umm_arr, tm_arr, tvm_arr, qvm_arr,
290  u_star_arr, // updated
291  w_star_arr, // updated if(m_include_wstar)
292  t_star_arr, q_star_arr, // updated
293  t_surf_arr, q_surf_arr, olen_arr, // updated
294  pblh_arr, // updated if(m_include_wstar)
295  Hwave_arr, Lwave_arr, eta_arr);
296  }
297  });
298  }
299 }
const int klo
Definition: ERF_InitCustomPertVels_ParticleTests.H:4
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=(prob_lo[0]+(i+0.5) *dx[0])/mf_m(i, j, 0);const Real z=z_cc(i, j, k);Real L=std::sqrt(std::pow((x - x_c)/x_r, 2)+std::pow((z - z_c)/z_r, 2));if(L<=1.0) { Real dT=T_pert *(std::cos(PI *L)+1.0)/2.0;Real Tbar_hse=p_hse(i, j, k)/(R_d *r_hse(i, j, k));Real theta_perturbed=(Tbar_hse+dT) *std::pow(p_0/p_hse(i, j, k), rdOcp);Real theta_0=(Tbar_hse) *std::pow(p_0/p_hse(i, j, k), rdOcp);if(const_rho) { state_pert(i, j, k, RhoTheta_comp)=r_hse(i, j, k) *(theta_perturbed - theta_0);} else { state_pert(i, j, k, Rho_comp)=getRhoThetagivenP(p_hse(i, j, k))/theta_perturbed - r_hse(i, j, k);} } })
pp get("wavelength", wavelength)
amrex::MultiFab * get_zref(const int &lev) const
Definition: ERF_MOSTAverage.H:105
const amrex::MultiFab * get_average(const int &lev, const int &comp) const
Definition: ERF_MOSTAverage.H:102
amrex::Vector< amrex::Vector< amrex::iMultiFab * > > m_lmask_lev
Definition: ERF_SurfaceLayer.H:713
amrex::Vector< std::unique_ptr< amrex::MultiFab > > t_surf
Definition: ERF_SurfaceLayer.H:708
amrex::Vector< std::unique_ptr< amrex::MultiFab > > q_star
Definition: ERF_SurfaceLayer.H:705
amrex::Vector< amrex::MultiFab * > m_Lwave_lev
Definition: ERF_SurfaceLayer.H:719
amrex::Vector< amrex::MultiFab > z_0
Definition: ERF_SurfaceLayer.H:685
amrex::Vector< std::unique_ptr< amrex::MultiFab > > w_star
Definition: ERF_SurfaceLayer.H:703
amrex::Vector< std::unique_ptr< amrex::MultiFab > > u_star
Definition: ERF_SurfaceLayer.H:702
amrex::Vector< std::unique_ptr< amrex::MultiFab > > q_surf
Definition: ERF_SurfaceLayer.H:709
amrex::Vector< amrex::MultiFab * > m_Hwave_lev
Definition: ERF_SurfaceLayer.H:718
amrex::Vector< std::unique_ptr< amrex::MultiFab > > t_star
Definition: ERF_SurfaceLayer.H:704
amrex::Vector< amrex::MultiFab * > m_eddyDiffs_lev
Definition: ERF_SurfaceLayer.H:720
amrex::Vector< std::unique_ptr< amrex::MultiFab > > olen
Definition: ERF_SurfaceLayer.H:706
amrex::Vector< std::unique_ptr< amrex::MultiFab > > pblh
Definition: ERF_SurfaceLayer.H:707
@ ng
Definition: ERF_Morrison.H:48
Here is the call graph for this function:

◆ compute_pblh() [1/2]

template<typename PBLHeightEstimator >
void SurfaceLayer::compute_pblh ( const int &  lev,
amrex::Vector< amrex::Vector< amrex::MultiFab >> &  vars,
amrex::MultiFab *  z_phys_cc,
const PBLHeightEstimator &  est,
const MoistureComponentIndices moisture_indice 
)

◆ compute_pblh() [2/2]

template<typename PBLHeightEstimator >
void SurfaceLayer::compute_pblh ( const int &  lev,
Vector< Vector< MultiFab >> &  vars,
MultiFab *  z_phys_cc,
const PBLHeightEstimator &  est,
const MoistureComponentIndices moisture_indices 
)
782 {
783  est.compute_pblh(m_geom[lev],z_phys_cc, pblh[lev].get(),
784  vars[lev][Vars::cons],m_lmask_lev[lev][0],
785  moisture_indices);
786 }
@ cons
Definition: ERF_IndexDefines.H:156
Here is the call graph for this function:

◆ compute_SurfaceLayer_bcs() [1/2]

template<typename FluxCalc >
void SurfaceLayer::compute_SurfaceLayer_bcs ( const int &  lev,
amrex::Vector< const amrex::MultiFab * >  mfs,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Tau_lev,
amrex::MultiFab *  xheat_flux,
amrex::MultiFab *  yheat_flux,
amrex::MultiFab *  zheat_flux,
amrex::MultiFab *  xqv_flux,
amrex::MultiFab *  yqv_flux,
amrex::MultiFab *  zqv_flux,
const amrex::MultiFab *  z_phys,
const FluxCalc &  flux_comp 
)

◆ compute_SurfaceLayer_bcs() [2/2]

template<typename FluxCalc >
void SurfaceLayer::compute_SurfaceLayer_bcs ( const int &  lev,
Vector< const MultiFab * >  mfs,
Vector< std::unique_ptr< MultiFab >> &  Tau_lev,
MultiFab *  xheat_flux,
MultiFab *  yheat_flux,
MultiFab *  zheat_flux,
MultiFab *  xqv_flux,
MultiFab *  yqv_flux,
MultiFab *  zqv_flux,
const MultiFab *  z_phys,
const FluxCalc &  flux_comp 
)

Function to calculate MOST fluxes for populating ghost cells.

Parameters
[in]levCurrent level
[in,out]mfsMultiFabs to populate
[in]eddyDiffsDiffusion coefficients from turbulence model
[in]flux_compstructure to compute fluxes
384 {
385  bool rotate = m_rotate;
386  const int klo = m_geom[lev].Domain().smallEnd(2);
387  const auto& dxInv = m_geom[lev].InvCellSizeArray();
388  for (MFIter mfi(*mfs[0]); mfi.isValid(); ++mfi)
389  {
390  // Get field arrays
391  const auto cons_arr = mfs[Vars::cons]->array(mfi);
392  const auto velx_arr = mfs[Vars::xvel]->array(mfi);
393  const auto vely_arr = mfs[Vars::yvel]->array(mfi);
394  const auto velz_arr = mfs[Vars::zvel]->array(mfi);
395 
396  // Diffusive stress vars
397  auto t13_arr = Tau_lev[TauType::tau13]->array(mfi);
398  auto t31_arr = (Tau_lev[TauType::tau31]) ? Tau_lev[TauType::tau31]->array(mfi) : Array4<Real>{};
399 
400  auto t23_arr = Tau_lev[TauType::tau23]->array(mfi);
401  auto t32_arr = (Tau_lev[TauType::tau32]) ? Tau_lev[TauType::tau32]->array(mfi) : Array4<Real>{};
402 
403  auto hfx3_arr = zheat_flux->array(mfi);
404  auto qfx3_arr = (zqv_flux) ? zqv_flux->array(mfi) : Array4<Real>{};
405 
406  // Rotated stress vars
407  auto t11_arr = (m_rotate) ? Tau_lev[TauType::tau11]->array(mfi) : Array4<Real>{};
408  auto t22_arr = (m_rotate) ? Tau_lev[TauType::tau22]->array(mfi) : Array4<Real>{};
409  auto t33_arr = (m_rotate) ? Tau_lev[TauType::tau33]->array(mfi) : Array4<Real>{};
410  auto t12_arr = (m_rotate) ? Tau_lev[TauType::tau12]->array(mfi) : Array4<Real>{};
411  auto t21_arr = (m_rotate) ? Tau_lev[TauType::tau21]->array(mfi) : Array4<Real>{};
412 
413  auto hfx1_arr = (m_rotate) ? xheat_flux->array(mfi) : Array4<Real>{};
414  auto hfx2_arr = (m_rotate) ? yheat_flux->array(mfi) : Array4<Real>{};
415  auto qfx1_arr = (m_rotate && xqv_flux) ? xqv_flux->array(mfi) : Array4<Real>{};
416  auto qfx2_arr = (m_rotate && yqv_flux) ? yqv_flux->array(mfi) : Array4<Real>{};
417 
418  // Terrain
419  const auto zphys_arr = (z_phys) ? z_phys->const_array(mfi) : Array4<const Real>{};
420 
421  // Get average arrays
422  const auto *const u_mean = m_ma.get_average(lev,0);
423  const auto *const v_mean = m_ma.get_average(lev,1);
424  const auto *const t_mean = m_ma.get_average(lev,2);
425  const auto *const q_mean = m_ma.get_average(lev,3);
426  const auto *const u_mag_mean = m_ma.get_average(lev,5);
427 
428  const auto um_arr = u_mean->array(mfi);
429  const auto vm_arr = v_mean->array(mfi);
430  const auto tm_arr = t_mean->array(mfi);
431  const auto qm_arr = q_mean->array(mfi);
432  const auto umm_arr = u_mag_mean->array(mfi);
433 
434  // Get derived arrays
435  const auto u_star_arr = u_star[lev]->array(mfi);
436  const auto t_star_arr = t_star[lev]->array(mfi);
437  const auto q_star_arr = q_star[lev]->array(mfi);
438  const auto t_surf_arr = t_surf[lev]->array(mfi);
439  const auto q_surf_arr = q_surf[lev]->array(mfi);
440 
441  // Get LSM fluxes
442  auto lmask_arr = (m_lmask_lev[lev][0]) ? m_lmask_lev[lev][0]->array(mfi) :
443  Array4<int> {};
444  auto lsm_t_flux_arr = Array4<Real> {};
445  auto lsm_q_flux_arr = Array4<Real> {};
446  auto lsm_tau13_arr = Array4<Real> {};
447  auto lsm_tau23_arr = Array4<Real> {};
448  for (int n(0); n<m_lsm_flux_lev[lev].size(); ++n) {
449  if (toLower(m_lsm_flux_name[n]) == "t_flux") { lsm_t_flux_arr = m_lsm_flux_lev[lev][n]->array(mfi); }
450  if (toLower(m_lsm_flux_name[n]) == "q_flux") { lsm_q_flux_arr = m_lsm_flux_lev[lev][n]->array(mfi); }
451  if (toLower(m_lsm_flux_name[n]) == "tau13") { lsm_tau13_arr = m_lsm_flux_lev[lev][n]->array(mfi); }
452  if (toLower(m_lsm_flux_name[n]) == "tau23") { lsm_tau23_arr = m_lsm_flux_lev[lev][n]->array(mfi); }
453  }
454 
455 
456  // Rho*Theta flux
457  //============================================================================
458  Box bx = mfi.tilebox();
459  if (bx.smallEnd(2) != klo) { continue; }
460  bx.makeSlab(2,klo);
461  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
462  {
463  // Valid theta flux from LSM and over land
464  Real Tflux;
465  int is_land = (lmask_arr) ? lmask_arr(i,j,0) : 1;
466  if (lsm_t_flux_arr && is_land) {
467  Tflux = lsm_t_flux_arr(i,j,0);
468  } else {
469  Tflux = flux_comp.compute_t_flux(i, j, k,
470  cons_arr, velx_arr, vely_arr,
471  umm_arr, tm_arr, u_star_arr,
472  t_star_arr, t_surf_arr);
473 
474  }
475 
476  // Do scalar flux rotations?
477  if (rotate) {
478  rotate_scalar_flux(i, j, k, Tflux, dxInv, zphys_arr,
479  hfx1_arr, hfx2_arr, hfx3_arr);
480  } else {
481  hfx3_arr(i,j,klo) = Tflux;
482  }
483  });
484 
485  // Rho*Qv flux
486  //============================================================================
487  if (use_moisture) {
488  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
489  {
490  // Valid qv flux from LSM and over land
491  Real Qflux;
492  int is_land = (lmask_arr) ? lmask_arr(i,j,0) : 1;
493  if (lsm_q_flux_arr && is_land) {
494  Qflux = lsm_q_flux_arr(i,j,0);
495  } else {
496  Qflux = flux_comp.compute_q_flux(i, j, k,
497  cons_arr, velx_arr, vely_arr,
498  umm_arr, qm_arr, u_star_arr,
499  q_star_arr, q_surf_arr);
500  }
501 
502  // Do scalar flux rotations?
503  if (rotate) {
504  rotate_scalar_flux(i, j, k, Qflux, dxInv, zphys_arr,
505  qfx1_arr, qfx2_arr, qfx3_arr);
506  } else {
507  qfx3_arr(i,j,k) = Qflux;
508  }
509  });
510  } // custom
511 
512  if (!rotate) {
513  // Rho*u flux
514  //============================================================================
515  Box bxx = surroundingNodes(bx,0);
516  ParallelFor(bxx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
517  {
518  // Valid tau13 from LSM and over land
519  Real stressx;
520  int is_land_hi = (lmask_arr) ? lmask_arr(i ,j,0) : 1;
521  int is_land_lo = (lmask_arr) ? lmask_arr(i-1,j,0) : 1;
522  if (lsm_tau13_arr && (is_land_hi || is_land_lo)) {
523  stressx = 0.;
524  if (!is_land_hi || !is_land_lo) {
525  stressx += 0.5 * flux_comp.compute_u_flux(i, j, k,
526  cons_arr, velx_arr, vely_arr,
527  umm_arr, um_arr, u_star_arr);
528  }
529  if (is_land_hi) {
530  stressx += 0.5 * lsm_tau13_arr(i ,j,0);
531  }
532  if (is_land_lo) {
533  stressx += 0.5 * lsm_tau13_arr(i-1,j,0);
534  }
535  } else {
536  stressx = flux_comp.compute_u_flux(i, j, k,
537  cons_arr, velx_arr, vely_arr,
538  umm_arr, um_arr, u_star_arr);
539  }
540 
541  t13_arr(i,j,k) = stressx;
542  if (t31_arr) { t31_arr(i,j,k) = stressx; }
543  });
544 
545  // Rho*v flux
546  //============================================================================
547  Box bxy = surroundingNodes(bx,1);
548  ParallelFor(bxy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
549  {
550  // Valid tau13 from LSM and over land
551  Real stressy;
552  int is_land_hi = (lmask_arr) ? lmask_arr(i,j ,0) : 1;
553  int is_land_lo = (lmask_arr) ? lmask_arr(i,j-1,0) : 1;
554  if (lsm_tau23_arr && (is_land_hi || is_land_lo)) {
555  stressy = 0.;
556  if (!is_land_hi || !is_land_lo) {
557  stressy += 0.5 * flux_comp.compute_v_flux(i, j, k,
558  cons_arr, velx_arr, vely_arr,
559  umm_arr, vm_arr, u_star_arr);
560  }
561  if (is_land_hi) {
562  stressy += 0.5 * lsm_tau23_arr(i,j ,0);
563  }
564  if (is_land_lo) {
565  stressy += 0.5 * lsm_tau23_arr(i,j-1,0);
566  }
567  } else {
568  stressy = flux_comp.compute_v_flux(i, j, k,
569  cons_arr, velx_arr, vely_arr,
570  umm_arr, vm_arr, u_star_arr);
571  }
572 
573  t23_arr(i,j,k) = stressy;
574  if (t32_arr) { t32_arr(i,j,k) = stressy; }
575  });
576  } else {
577  // All fluxes with rotation
578  //============================================================================
579  Box bxxy = convert(bx, IntVect(1,1,0));
580  ParallelFor(bxxy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
581  {
582  Real stresst = flux_comp.compute_u_flux(i, j, k,
583  cons_arr, velx_arr, vely_arr,
584  umm_arr, um_arr, u_star_arr);
585  rotate_stress_tensor(i, j, k, stresst, dxInv, zphys_arr,
586  velx_arr, vely_arr, velz_arr,
587  t11_arr, t22_arr, t33_arr,
588  t12_arr, t21_arr,
589  t13_arr, t31_arr,
590  t23_arr, t32_arr);
591  });
592  }
593  } // mfiter
594 }
@ tau12
Definition: ERF_DataStruct.H:32
@ tau23
Definition: ERF_DataStruct.H:32
@ tau33
Definition: ERF_DataStruct.H:32
@ tau22
Definition: ERF_DataStruct.H:32
@ tau11
Definition: ERF_DataStruct.H:32
@ tau32
Definition: ERF_DataStruct.H:32
@ tau31
Definition: ERF_DataStruct.H:32
@ tau21
Definition: ERF_DataStruct.H:32
@ tau13
Definition: ERF_DataStruct.H:32
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:16
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void rotate_scalar_flux(const int &i, const int &j, const int &klo, const amrex::Real &flux, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &zphys_arr, const amrex::Array4< amrex::Real > &phi1_arr, const amrex::Array4< amrex::Real > &phi2_arr, const amrex::Array4< amrex::Real > &phi3_arr)
Definition: ERF_TerrainMetrics.H:609
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void rotate_stress_tensor(const int &i, const int &j, const int &klo, const amrex::Real &flux, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const amrex::Array4< const amrex::Real > &zphys_arr, const amrex::Array4< const amrex::Real > &u_arr, const amrex::Array4< const amrex::Real > &v_arr, const amrex::Array4< const amrex::Real > &w_arr, const amrex::Array4< amrex::Real > &tau11_arr, const amrex::Array4< amrex::Real > &tau22_arr, const amrex::Array4< amrex::Real > &tau33_arr, const amrex::Array4< amrex::Real > &tau12_arr, const amrex::Array4< amrex::Real > &tau21_arr, const amrex::Array4< amrex::Real > &tau13_arr, const amrex::Array4< amrex::Real > &tau31_arr, const amrex::Array4< amrex::Real > &tau23_arr, const amrex::Array4< amrex::Real > &tau32_arr)
Definition: ERF_TerrainMetrics.H:630
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_lsm_flux_lev
Definition: ERF_SurfaceLayer.H:715
amrex::Vector< std::string > m_lsm_flux_name
Definition: ERF_SurfaceLayer.H:717
@ xvel
Definition: ERF_IndexDefines.H:157
@ zvel
Definition: ERF_IndexDefines.H:159
@ yvel
Definition: ERF_IndexDefines.H:158
Here is the call graph for this function:

◆ fill_qsurf_with_qsat()

void SurfaceLayer::fill_qsurf_with_qsat ( const int &  lev,
const amrex::MultiFab &  cons_in,
const std::unique_ptr< amrex::MultiFab > &  z_phys_nd 
)
687 {
688  // NOTE: We have already tested a moisture model exists
689 
690  // Populate q_surf with qsat over water
691  auto dz = m_geom[lev].CellSize(2);
692  const int klo = m_geom[lev].Domain().smallEnd(2);
693  for (MFIter mfi(*q_surf[lev]); mfi.isValid(); ++mfi)
694  {
695  Box gtbx = mfi.growntilebox();
696 
697  if (gtbx.smallEnd(2) != klo) { continue; }
698 
699  auto t_surf_arr = t_surf[lev]->array(mfi);
700  auto q_surf_arr = q_surf[lev]->array(mfi);
701  auto lmask_arr = (m_lmask_lev[lev][0]) ? m_lmask_lev[lev][0]->array(mfi) :
702  Array4<int> {};
703  const auto cons_arr = cons_in.const_array(mfi);
704  const auto z_arr = (z_phys_nd) ? z_phys_nd->const_array(mfi) :
705  Array4<const Real> {};
706 
707  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
708  {
709  int is_land = (lmask_arr) ? lmask_arr(i,j,k) : 1;
710  if (!is_land) {
711  auto deltaZ = (z_arr) ? Compute_Zrel_AtCellCenter(i,j,k,z_arr) :
712  0.5*dz;
713  auto Rho = cons_arr(i,j,k,Rho_comp);
714  auto RTh = cons_arr(i,j,k,RhoTheta_comp);
715  auto Qv = cons_arr(i,j,k,RhoQ1_comp) / Rho;
716  auto P_cc = getPgivenRTh(RTh, Qv);
717  P_cc += Rho*CONST_GRAV*deltaZ;
718  P_cc *= 0.01;
719  erf_qsatw(t_surf_arr(i,j,k), P_cc, q_surf_arr(i,j,k));
720  }
721  });
722  }
723  q_surf[lev]->FillBoundary(m_geom[lev].periodicity());
724 }
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=0.)
Definition: ERF_EOS.H:81
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
const Real dz
Definition: ERF_InitCustomPert_Bubble.H:25
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsatw(amrex::Real t, amrex::Real p, amrex::Real &qsatw)
Definition: ERF_MicrophysicsUtils.H:171
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_Zrel_AtCellCenter(const int &i, const int &j, const int &k, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:387
Here is the call graph for this function:

◆ fill_tsurf_with_sst_and_tsk()

void SurfaceLayer::fill_tsurf_with_sst_and_tsk ( const int &  lev,
const amrex::Real time 
)
599 {
600  int n_times_in_sst = m_sst_lev[lev].size();
601 
603 
604  int n_time_lo, n_time_hi;
605  Real alpha;
606 
607  if (n_times_in_sst > 1) {
608  n_time_lo = static_cast<int>( elapsed_time_since_start_low / dT);
609  alpha = (elapsed_time_since_start_low - n_time_lo * dT) / dT;
610 
611  AMREX_ALWAYS_ASSERT( alpha >= 0. && alpha <= 1.0);
612 
613  n_time_hi = n_time_lo + 1;
614 
615  // Do not over run the last sst file
616  if (m_start_low_time + elapsed_time_since_start_low >= m_final_low_time) {
617  n_time_lo = m_sst_lev[lev].size()-1;
618  n_time_hi = n_time_lo;
619  alpha = 0.0;
620  }
621 
622  AMREX_ALWAYS_ASSERT( (n_time_lo >= 0) && (n_time_hi < m_sst_lev[lev].size()));
623  } else {
624  n_time_lo = 0;
625  n_time_hi = 0;
626  alpha = 1.0;
627  }
628  AMREX_ALWAYS_ASSERT( alpha >= 0. && alpha <= 1.0);
629 
630  Real oma = 1.0 - alpha;
631 
632  // Define a default land surface temperature if we don't read in tsk
634 
635  bool use_tsk = (m_tsk_lev[lev][0]);
636  bool ignore_sst = m_ignore_sst;
637 
638  const int klo = m_geom[lev].Domain().smallEnd(2);
639 
640  // Populate t_surf
641  for (MFIter mfi(*t_surf[lev]); mfi.isValid(); ++mfi)
642  {
643  Box gtbx = mfi.growntilebox();
644 
645  if (gtbx.smallEnd(2) != klo) { continue; }
646 
647  auto t_surf_arr = t_surf[lev]->array(mfi);
648 
649  const auto sst_lo_arr = m_sst_lev[lev][n_time_lo]->const_array(mfi);
650  const auto sst_hi_arr = m_sst_lev[lev][n_time_hi]->const_array(mfi);
651 
652  auto lmask_arr = (m_lmask_lev[lev][0]) ? m_lmask_lev[lev][0]->array(mfi) :
653  Array4<int> {};
654 
655  if (use_tsk) {
656  const auto tsk_arr = m_tsk_lev[lev][n_time_lo]->const_array(mfi);
657  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
658  {
659  int is_land = (lmask_arr) ? lmask_arr(i,j,k) : 1;
660  if (!is_land && !ignore_sst) {
661  t_surf_arr(i,j,k) = oma * sst_lo_arr(i,j,k)
662  + alpha * sst_hi_arr(i,j,k);
663  } else {
664  t_surf_arr(i,j,k) = tsk_arr(i,j,k);
665  }
666  });
667  } else {
668  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
669  {
670  int is_land = (lmask_arr) ? lmask_arr(i,j,k) : 1;
671  if (!is_land) {
672  t_surf_arr(i,j,k) = oma * sst_lo_arr(i,j,k)
673  + alpha * sst_hi_arr(i,j,k);
674  } else {
675  t_surf_arr(i,j,k) = lst;
676  }
677  });
678  }
679  }
680  t_surf[lev]->FillBoundary(m_geom[lev].periodicity());
681 }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
amrex::Real alpha
Definition: ERF_InitCustomPert_IsentropicVortex.H:8
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_sst_lev
Definition: ERF_SurfaceLayer.H:711
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_tsk_lev
Definition: ERF_SurfaceLayer.H:712
Here is the call graph for this function:

◆ get_lmask()

amrex::iMultiFab* SurfaceLayer::get_lmask ( const int &  lev)
inline
592 { return m_lmask_lev[lev][0]; }

◆ get_lsm_tsurf()

void SurfaceLayer::get_lsm_tsurf ( const int &  lev)
728 {
729  const int klo = m_geom[lev].Domain().smallEnd(2);
730  for (MFIter mfi(*t_surf[lev]); mfi.isValid(); ++mfi)
731  {
732  Box gtbx = mfi.growntilebox();
733 
734  if (gtbx.smallEnd(2) != klo) { continue; }
735 
736  // NOTE: LSM does not carry lateral ghost cells.
737  // This copies the valid box into the ghost cells.
738  // Fillboundary is called after this to pick up the
739  // interior ghost and periodic directions.
740  Box vbx = mfi.validbox();
741  int i_lo = vbx.smallEnd(0); int i_hi = vbx.bigEnd(0);
742  int j_lo = vbx.smallEnd(1); int j_hi = vbx.bigEnd(1);
743 
744  auto t_surf_arr = t_surf[lev]->array(mfi);
745  auto lmask_arr = (m_lmask_lev[lev][0]) ? m_lmask_lev[lev][0]->array(mfi) :
746  Array4<int> {};
747  const auto lsm_arr = m_lsm_data_lev[lev][m_lsm_tsurf_indx]->const_array(mfi);
748 
749  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
750  {
751  int is_land = (lmask_arr) ? lmask_arr(i,j,k) : 1;
752  if (is_land) {
753  int li = amrex::min(amrex::max(i, i_lo), i_hi);
754  int lj = amrex::min(amrex::max(j, j_lo), j_hi);
755  t_surf_arr(i,j,k) = lsm_arr(li,lj,k);
756  }
757  });
758  }
759 }
int m_lsm_tsurf_indx
Definition: ERF_SurfaceLayer.H:693
amrex::Vector< amrex::Vector< amrex::MultiFab * > > m_lsm_data_lev
Definition: ERF_SurfaceLayer.H:714
Here is the call graph for this function:

◆ get_mac_avg()

const amrex::MultiFab* SurfaceLayer::get_mac_avg ( const int &  lev,
int  comp 
)
inline
576  {
577  return m_ma.get_average(lev, comp);
578  }
Here is the call graph for this function:

◆ get_olen()

amrex::MultiFab* SurfaceLayer::get_olen ( const int &  lev)
inline
571 { return olen[lev].get(); }

◆ get_pblh()

amrex::MultiFab* SurfaceLayer::get_pblh ( const int &  lev)
inline
573 { return pblh[lev].get(); }

◆ get_q_star()

amrex::MultiFab* SurfaceLayer::get_q_star ( const int &  lev)
inline
569 { return q_star[lev].get(); }

◆ get_q_surf()

amrex::MultiFab* SurfaceLayer::get_q_surf ( const int &  lev)
inline
583 { return q_surf[lev].get(); }

◆ get_t_star()

amrex::MultiFab* SurfaceLayer::get_t_star ( const int &  lev)
inline
567 { return t_star[lev].get(); }

◆ get_t_surf()

amrex::MultiFab* SurfaceLayer::get_t_surf ( const int &  lev)
inline
580 { return t_surf[lev].get(); }

◆ get_u_star()

amrex::MultiFab* SurfaceLayer::get_u_star ( const int &  lev)
inline
563 { return u_star[lev].get(); }

◆ get_w_star()

amrex::MultiFab* SurfaceLayer::get_w_star ( const int &  lev)
inline
565 { return w_star[lev].get(); }

◆ get_z0()

amrex::MultiFab* SurfaceLayer::get_z0 ( const int &  lev)
inline
588 { return &z_0[lev]; }

◆ get_zref()

amrex::Real SurfaceLayer::get_zref ( const int &  lev)
inline
586 { return (m_ma.get_zref(lev))->min(0); }
Here is the call graph for this function:

◆ have_variable_sea_roughness()

bool SurfaceLayer::have_variable_sea_roughness ( )
inline
590 { return m_var_z0; }
bool m_var_z0
Definition: ERF_SurfaceLayer.H:686

◆ impose_SurfaceLayer_bcs()

void SurfaceLayer::impose_SurfaceLayer_bcs ( const int &  lev,
amrex::Vector< const amrex::MultiFab * >  mfs,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Tau_lev,
amrex::MultiFab *  xheat_flux,
amrex::MultiFab *  yheat_flux,
amrex::MultiFab *  zheat_flux,
amrex::MultiFab *  xqv_flux,
amrex::MultiFab *  yqv_flux,
amrex::MultiFab *  zqv_flux,
const amrex::MultiFab *  z_phys 
)

Wrapper to impose Monin Obukhov similarity theory fluxes by populating ghost cells.

Parameters
[in]levCurrent level
[in,out]mfsMultiFabs to populate
[in]eddyDiffsDiffusion coefficients from turbulence model
320 {
322  moeng_flux flux_comp;
323  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
324  xheat_flux, yheat_flux, zheat_flux,
325  xqv_flux, yqv_flux, zqv_flux,
326  z_phys, flux_comp);
327  } else if (flux_type == FluxCalcType::DONELAN) {
328  donelan_flux flux_comp;
329  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
330  xheat_flux, yheat_flux, zheat_flux,
331  xqv_flux, yqv_flux, zqv_flux,
332  z_phys, flux_comp);
333  } else if (flux_type == FluxCalcType::ROTATE) {
334  rotate_flux flux_comp;
335  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
336  xheat_flux, yheat_flux, zheat_flux,
337  xqv_flux, yqv_flux, zqv_flux,
338  z_phys, flux_comp);
339  } else if (flux_type == FluxCalcType::RICO) {
341  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
342  xheat_flux, yheat_flux, zheat_flux,
343  xqv_flux, yqv_flux, zqv_flux,
344  z_phys, flux_comp);
345  } else if (flux_type == FluxCalcType::BULK_COEFF) {
346  bulk_coeff_flux flux_comp(m_Cd, m_Ch, m_Cq);
347  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
348  xheat_flux, yheat_flux, zheat_flux,
349  xqv_flux, yqv_flux, zqv_flux,
350  z_phys, flux_comp);
351  } else if (flux_type == FluxCalcType::CUSTOM) {
352  custom_flux flux_comp(specified_rho_surf);
353  compute_SurfaceLayer_bcs(lev, mfs, Tau_lev,
354  xheat_flux, yheat_flux, zheat_flux,
355  xqv_flux, yqv_flux, zqv_flux,
356  z_phys, flux_comp);
357  } else {
358  amrex::Abort("Unknown surface layer flux calculation type");
359  }
360 }
bool specified_rho_surf
Definition: ERF_SurfaceLayer.H:681
void compute_SurfaceLayer_bcs(const int &lev, amrex::Vector< const amrex::MultiFab * > mfs, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Tau_lev, amrex::MultiFab *xheat_flux, amrex::MultiFab *yheat_flux, amrex::MultiFab *zheat_flux, amrex::MultiFab *xqv_flux, amrex::MultiFab *yqv_flux, amrex::MultiFab *zqv_flux, const amrex::MultiFab *z_phys, const FluxCalc &flux_comp)
Definition: ERF_MOSTStress.H:2181
Definition: ERF_MOSTStress.H:2064
Definition: ERF_MOSTStress.H:1931
Definition: ERF_MOSTStress.H:1768
Definition: ERF_MOSTStress.H:2308
Definition: ERF_MOSTStress.H:2436

◆ init_tke_from_ustar()

void SurfaceLayer::init_tke_from_ustar ( const int &  lev,
amrex::MultiFab &  cons,
const std::unique_ptr< amrex::MultiFab > &  z_phys_nd,
const amrex::Real  tkefac = 1.0,
const amrex::Real  zscale = 700.0 
)
794 {
795  Print() << "Initializing TKE from surface layer ustar on level " << lev << std::endl;
796 
797  // Handle vertical decomposition by selectively copying into
798  // a FArrayBox section on each rank. Then doing a reduce real sum
799  // and broadcasting to each rank. No mask since all CC data
800  const int klo = m_geom[lev].Domain().smallEnd(2);
801  Box bx_lo = u_star[lev]->boxArray().minimalBox();
802  FArrayBox u_star_lo(bx_lo, 1); u_star_lo.setVal<RunOn::Device>(0.);
803  FArrayBox z_surf_lo(bx_lo, 1); z_surf_lo.setVal<RunOn::Device>(0.);
804  Real* ustar_ptr = u_star_lo.dataPtr();
805  Real* zsurf_ptr = z_surf_lo.dataPtr();
806  for (MFIter mfi(cons); mfi.isValid(); ++mfi)
807  {
808  Box vbx = mfi.validbox();
809  if (vbx.smallEnd(2) != klo) { continue; }
810  vbx.makeSlab(2,0);
811 
812  auto const& u_star_arr = u_star[lev]->const_array(mfi);
813  auto u_star_all = u_star_lo.array();
814 
815  auto const& z_phys_arr = z_phys_nd->const_array(mfi);
816  auto z_surf_all = z_surf_lo.array();
817 
818  ParallelFor(vbx, [=] AMREX_GPU_DEVICE(int i, int j, int ) noexcept
819  {
820  u_star_all(i,j,0) = u_star_arr(i,j,0);
821  z_surf_all(i,j,0) = 0.25 * ( z_phys_arr(i ,j ,klo) + z_phys_arr(i+1,j ,klo)
822  + z_phys_arr(i ,j+1,klo) + z_phys_arr(i+1,j+1,klo) );
823  });
824  }
825  ParallelDescriptor::ReduceRealSum(ustar_ptr, bx_lo.numPts());
826  ParallelDescriptor::ReduceRealSum(zsurf_ptr, bx_lo.numPts());
827 
828  // Now work on all boxes (ustar has been filled above)
829  constexpr Real small = 0.01;
830  for (MFIter mfi(cons); mfi.isValid(); ++mfi)
831  {
832  Box vbx = mfi.validbox();
833 
834  auto const& u_star_arr = u_star_lo.const_array();
835  auto const& z_surf_arr = z_surf_lo.const_array();
836  auto const& z_phys_arr = z_phys_nd->const_array(mfi);
837 
838  auto const& cons_arr = cons.array(mfi);
839 
840  ParallelFor(vbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
841  {
842  Real rho = cons_arr(i, j, k, Rho_comp);
843  Real ust = u_star_arr(i, j, 0);
844  Real tke0 = tkefac * ust * ust; // surface value
845  Real zagl = Compute_Z_AtCellCenter(i, j, k, z_phys_arr) - z_surf_arr(i,j,0);
846 
847  // linearly tapering profile -- following WRF, approximate top of
848  // PBL as ustar * zscale
849  cons_arr(i, j, k, RhoKE_comp) = rho * tke0 * std::max(
850  (ust * zscale - zagl) / (std::max(ust, small) * zscale),
851  small);
852  });
853  }
854 }
#define RhoKE_comp
Definition: ERF_IndexDefines.H:38
rho
Definition: ERF_InitCustomPert_Bubble.H:106
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_Z_AtCellCenter(const int &i, const int &j, const int &k, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:359
Here is the call graph for this function:

◆ lmask_min_reduce()

int SurfaceLayer::lmask_min_reduce ( amrex::iMultiFab &  lmask,
const int &  nghost 
)
inline
596  {
597  int lmask_min = amrex::ReduceMin(lmask, nghost, [=] AMREX_GPU_HOST_DEVICE(
598  amrex::Box const& bx, amrex::Array4<int const> const& lm_arr) -> int
599  {
600  int locmin = std::numeric_limits<int>::max();
601  const auto lo = lbound(bx);
602  const auto hi = ubound(bx);
603  for (int j = lo.y; j <= hi.y; ++j) {
604  for (int i = lo.x; i <= hi.x; ++i) {
605  locmin = std::min(locmin, lm_arr(i, j, 0));
606  }
607  }
608  return locmin;
609  });
610 
611  return lmask_min;
612  }

Referenced by make_SurfaceLayer_at_level().

Here is the caller graph for this function:

◆ make_SurfaceLayer_at_level()

void SurfaceLayer::make_SurfaceLayer_at_level ( const int &  lev,
int  nlevs,
const amrex::Vector< amrex::MultiFab * > &  mfv,
std::unique_ptr< amrex::MultiFab > &  Theta_prim,
std::unique_ptr< amrex::MultiFab > &  Qv_prim,
std::unique_ptr< amrex::MultiFab > &  Qr_prim,
std::unique_ptr< amrex::MultiFab > &  z_phys_nd,
amrex::MultiFab *  Hwave,
amrex::MultiFab *  Lwave,
amrex::MultiFab *  eddyDiffs,
amrex::Vector< amrex::MultiFab * >  lsm_data,
amrex::Vector< std::string >  lsm_data_name,
amrex::Vector< amrex::MultiFab * >  lsm_flux,
amrex::Vector< std::string >  lsm_flux_name,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  sst_lev,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  tsk_lev,
amrex::Vector< std::unique_ptr< amrex::iMultiFab >> &  lmask_lev 
)
inline
283  {
284  // Update MOST Average
286  Theta_prim, Qv_prim, Qr_prim,
287  z_phys_nd);
288 
289  // Get CC vars
290  amrex::MultiFab& mf = *(mfv[0]);
291 
292  amrex::ParmParse pp("erf");
293 
294  // Do we have a time-varying surface roughness that needs to be saved?
295  if (lev == 0) {
296  const int nghost = 0; // ghost cells not included
297  int lmask_min = lmask_min_reduce(*lmask_lev[0].get(), nghost);
298  amrex::ParallelDescriptor::ReduceIntMin(lmask_min);
299 
300  m_var_z0 = (lmask_min < 1) & (rough_type_sea != RoughCalcType::CONSTANT);
301  if (m_var_z0) {
302  std::string rough_sea_string{"charnock"};
303  pp.query("most.roughness_type_sea", rough_sea_string);
304  amrex::Print() << "Variable sea roughness (type " << rough_sea_string
305  << ")" << std::endl;
306  }
307  }
308 
309  if (m_eddyDiffs_lev.size() < lev+1) {
310  m_Hwave_lev.resize(nlevs);
311  m_Lwave_lev.resize(nlevs);
312  m_eddyDiffs_lev.resize(nlevs);
313 
314  m_lsm_data_lev.resize(nlevs);
315  m_lsm_flux_lev.resize(nlevs);
316 
317  m_sst_lev.resize(nlevs);
318  m_tsk_lev.resize(nlevs);
319  m_lmask_lev.resize(nlevs);
320 
321  // Size the MOST params for all levels
322  z_0.resize(nlevs);
323  u_star.resize(nlevs);
324  w_star.resize(nlevs);
325  t_star.resize(nlevs);
326  q_star.resize(nlevs);
327  t_surf.resize(nlevs);
328  q_surf.resize(nlevs);
329  olen.resize(nlevs);
330  pblh.resize(nlevs);
331  }
332 
333  // Get pointers to SST,TSK and LANDMASK data
334  int nt_tot_sst = sst_lev.size();
335  m_sst_lev[lev].resize(nt_tot_sst);
336  for (int nt(0); nt < nt_tot_sst; ++nt) {
337  m_sst_lev[lev][nt] = sst_lev[nt].get();
338  }
339  int nt_tot_tsk = static_cast<int>(tsk_lev.size());
340  m_tsk_lev[lev].resize(nt_tot_tsk);
341  for (int nt(0); nt < nt_tot_tsk; ++nt) {
342  m_tsk_lev[lev][nt] = tsk_lev[nt].get();
343  }
344  int nt_tot_lmask = static_cast<int>(lmask_lev.size());
345  m_lmask_lev[lev].resize(nt_tot_lmask);
346  for (int nt(0); nt < nt_tot_lmask; ++nt) {
347  m_lmask_lev[lev][nt] = lmask_lev[nt].get();
348  }
349 
350  // Get pointers to wave data
351  m_Hwave_lev[lev] = Hwave;
352  m_Lwave_lev[lev] = Lwave;
353  m_eddyDiffs_lev[lev] = eddyDiffs;
354 
355  // Get pointers to LSM data and Fluxes
356  int ndata = static_cast<int>(lsm_data.size());
357  int nflux = static_cast<int>(lsm_flux.size());
358  m_lsm_data_name.resize(ndata);
359  m_lsm_data_lev[lev].resize(ndata);
360  m_lsm_flux_name.resize(nflux);
361  m_lsm_flux_lev[lev].resize(nflux);
362  for (int n(0); n < ndata; ++n) {
363  m_lsm_data_name[n] = lsm_data_name[n];
364  m_lsm_data_lev[lev][n] = lsm_data[n];
365  if (amrex::toLower(lsm_data_name[n]) == "theta") {
366  m_has_lsm_tsurf = true;
367  m_lsm_tsurf_indx = n;
368  }
369  }
370  for (int n(0); n < nflux; ++n) {
371  m_lsm_flux_name[n] = lsm_flux_name[n];
372  m_lsm_flux_lev[lev][n] = lsm_flux[n];
373  }
374 
375  // Check if there is a user-specified roughness file to be read
376  std::string fname;
377  bool read_z0 = false;
378  if ( (flux_type == FluxCalcType::MOENG) ||
380  int count = pp.countval("most.roughness_file_name");
381  if (count > 1) {
382  AMREX_ALWAYS_ASSERT(count >= lev+1);
383  pp.query("most.roughness_file_name", fname, lev);
384  read_z0 = true;
385  } else if (count == 1) {
386  if (lev == 0) {
387  pp.query("most.roughness_file_name", fname);
388  } else {
389  // we will interpolate from the coarsest level
390  fname = "";
391  }
392  read_z0 = true;
393  }
394  // else use z0_const
395  }
396 
397  // Attributes for MFs and FABs
398  //--------------------------------------------------------
399  // Create a 2D ba, dm, & ghost cells
400  amrex::BoxArray ba = mf.boxArray();
401  amrex::BoxList bl2d = ba.boxList();
402  for (auto& b : bl2d) { b.setRange(2,0); }
403  amrex::BoxArray ba2d(std::move(bl2d));
404  const amrex::DistributionMapping& dm = mf.DistributionMap();
405  const int ncomp = 1;
406  amrex::IntVect ng{1,1,0};
407 
408  // Z0 heights FAB
409  //--------------------------------------------------------
410  z_0[lev].define(ba2d, dm, ncomp, ng);
411  z_0[lev].setVal(z0_const);
412  if (read_z0) {
413  read_custom_roughness(lev, fname);
414  }
415 
416  // 2D MFs for U*, T*, T_surf
417  //--------------------------------------------------------
418  u_star[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
419  u_star[lev]->setVal(1.E34);
420 
421  w_star[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
422  w_star[lev]->setVal(1.E34);
423 
424  t_star[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
425  t_star[lev]->setVal(0.0); // default to neutral
426 
427  q_star[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
428  q_star[lev]->setVal(0.0); // default to dry
429 
430  olen[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
431  olen[lev]->setVal(1.E34);
432 
433  pblh[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
434  pblh[lev]->setVal(1.E34);
435 
436  t_surf[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
437  t_surf[lev]->setVal(default_land_surf_temp);
438 
439  q_surf[lev] = std::make_unique<amrex::MultiFab>(ba2d, dm, ncomp, ng);
440  q_surf[lev]->setVal(default_land_surf_moist);
441 
442  // TODO: Do we want an enum struct for indexing?
443 
444  bool use_sst = (!m_sst_lev[lev].empty() && m_sst_lev[lev][0]);
445  bool use_tsk = (!m_tsk_lev[lev].empty() && m_tsk_lev[lev][0]);
446  if (use_sst || use_tsk || m_has_lsm_tsurf) {
447  // Valid SST, TSK or LSM data; t_surf set before computing fluxes (avoids
448  // extended lambda capture) Note that land temp will be set from m_tsk_lev
449  // while sea temp will be set from m_sst_lev
451 
452  // Pathways in fill_tsurf_with_sst_and_tsk
453  amrex::Print() << "Using MOST with specified surface temperature ";
454  // NOTE: SST from the LOW file populates TSK in update_sst_tsk.
455  // So if we have TSK, it contains everything and has been
456  // sanity checked for valid SST values.
457  if (use_tsk) { m_ignore_sst = true; }
458  if (use_tsk) {
459  amrex::Print() << "(land: TSK, ";
460  } else {
461  amrex::Print() << "(land: T0, ";
462  }
463  if (use_tsk && !use_sst) {
464  amrex::Print() << "sea: TSK)" << std::endl;
465  } else {
466  amrex::Print() << "sea: SST)" << std::endl;
468  }
469  }
470  }
void make_MOSTAverage_at_level(const int &lev, const amrex::Vector< amrex::MultiFab * > &vars_old, std::unique_ptr< amrex::MultiFab > &Theta_prim, std::unique_ptr< amrex::MultiFab > &Qv_prim, std::unique_ptr< amrex::MultiFab > &Qr_prim, std::unique_ptr< amrex::MultiFab > &z_phys_nd)
Definition: ERF_MOSTAverage.cpp:85
int lmask_min_reduce(amrex::iMultiFab &lmask, const int &nghost)
Definition: ERF_SurfaceLayer.H:594
amrex::Vector< std::string > m_lsm_data_name
Definition: ERF_SurfaceLayer.H:716
bool m_has_lsm_tsurf
Definition: ERF_SurfaceLayer.H:692
void read_custom_roughness(const int &lev, const std::string &fname)
Definition: ERF_SurfaceLayer.cpp:858
Here is the call graph for this function:

◆ read_custom_roughness()

void SurfaceLayer::read_custom_roughness ( const int &  lev,
const std::string &  fname 
)
860 {
861  // Read the file if we have it
862  if (!fname.empty()) {
863  // Only the ioproc reads the file
864  Gpu::HostVector<Real> m_x,m_y,m_z0;
865  if (ParallelDescriptor::IOProcessor()) {
866  Print()<<"Reading MOST roughness file at level " << lev << " : " << fname << std::endl;
867  std::ifstream file(fname);
868  Real value1,value2,value3;
869  while(file>>value1>>value2>>value3){
870  m_x.push_back(value1);
871  m_y.push_back(value2);
872  m_z0.push_back(value3);
873  }
874  file.close();
875 
876  AMREX_ALWAYS_ASSERT(m_x.size() == m_y.size());
877  AMREX_ALWAYS_ASSERT(m_x.size() == m_z0.size());
878  }
879 
880  // Broadcast the whole domain to every rank
881  int ioproc = ParallelDescriptor::IOProcessorNumber();
882  int nnode = m_x.size();
883  ParallelDescriptor::Bcast(&nnode, 1, ioproc);
884 
885  if (!ParallelDescriptor::IOProcessor()) {
886  m_x.resize(nnode);
887  m_y.resize(nnode);
888  m_z0.resize(nnode);
889  }
890  ParallelDescriptor::Bcast(m_x.data() , nnode, ioproc);
891  ParallelDescriptor::Bcast(m_y.data() , nnode, ioproc);
892  ParallelDescriptor::Bcast(m_z0.data(), nnode, ioproc);
893 
894  // Copy data to the GPU
895  Gpu::DeviceVector<Real> d_x(nnode),d_y(nnode),d_z0(nnode);
896  Gpu::copy(Gpu::hostToDevice, m_x.begin(), m_x.end(), d_x.begin());
897  Gpu::copy(Gpu::hostToDevice, m_y.begin(), m_y.end(), d_y.begin());
898  Gpu::copy(Gpu::hostToDevice, m_z0.begin(), m_z0.end(), d_z0.begin());
899  Real* xp = d_x.data();
900  Real* yp = d_y.data();
901  Real* z0p = d_z0.data();
902 
903  // Each rank populates it's z_0[lev] MultiFab
904  const int klo = m_geom[lev].Domain().smallEnd(2);
905  for (MFIter mfi(z_0[lev]); mfi.isValid(); ++mfi)
906  {
907  Box gtbx = mfi.growntilebox();
908 
909  if (gtbx.smallEnd(2) != klo) { continue; }
910 
911  // Populate z_phys data
912  Real tol = 1.0e-4;
913  auto dx = m_geom[lev].CellSizeArray();
914  auto ProbLoArr = m_geom[lev].ProbLoArray();
915  int ilo = m_geom[lev].Domain().smallEnd(0);
916  int jlo = m_geom[lev].Domain().smallEnd(1);
917  int ihi = m_geom[lev].Domain().bigEnd(0);
918  int jhi = m_geom[lev].Domain().bigEnd(1);
919 
920  Array4<Real> const& z0_arr = z_0[lev].array(mfi);
921  ParallelFor(gtbx, [=] AMREX_GPU_DEVICE (int i, int j, int /*k*/)
922  {
923  // Clip indices for ghost-cells
924  int ii = amrex::min(amrex::max(i,ilo),ihi);
925  int jj = amrex::min(amrex::max(j,jlo),jhi);
926 
927  // Location of nodes
928  Real x = ProbLoArr[0] + ii * dx[0];
929  Real y = ProbLoArr[1] + jj * dx[1];
930  int inode = ii + jj * (ihi-ilo+2); // stride is Nx+1
931  if (std::sqrt(std::pow(x-xp[inode],2)+std::pow(y-yp[inode],2)) < tol) {
932  z0_arr(i,j,klo) = z0p[inode];
933  } else {
934  // Unexpected list order, do brute force search
935  Real z0loc = 0.0;
936  bool found = false;
937  for (int n=0; n<nnode; ++n) {
938  Real delta=std::sqrt(std::pow(x-xp[n],2)+std::pow(y-yp[n],2));
939  if (delta < tol) {
940  found = true;
941  z0loc = z0p[n];
942  break;
943  }
944  }
945  AMREX_ASSERT_WITH_MESSAGE(found, "Location read from terrain file does not match the grid!");
946  amrex::ignore_unused(found);
947  z0_arr(i,j,klo) = z0loc;
948  }
949  });
950  } // mfi
951  } else {
952  AMREX_ALWAYS_ASSERT(lev > 0);
953 
954  Print()<<"Interpolating MOST roughness at level " << lev << std::endl;
955 
956  // Create a BC mapper that uses FOEXTRAP at domain bndry
957  Vector<int> bc_lo(3,ERFBCType::foextrap);
958  Vector<int> bc_hi(3,ERFBCType::foextrap);
959  Vector<BCRec> bcr; bcr.push_back(BCRec(bc_lo.data(),bc_hi.data()));
960 
961  // Create ref ratio
962  IntVect ratio;
963  for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
964  ratio[idim] = m_geom[lev].Domain().length(idim) / m_geom[0].Domain().length(idim);
965  }
966 
967  // Create interp object and interpolate from the coarsest grid
968  MFInterpolater* interp = &mf_cell_cons_interp;
969  interp->interp(z_0[0] , 0,
970  z_0[lev], 0,
971  1, z_0[lev].nGrowVect(),
972  m_geom[0], m_geom[lev],
973  m_geom[lev].Domain(),ratio,
974  bcr, 0);
975  }
976 }
@ m_y
Definition: ERF_DataStruct.H:25
@ m_x
Definition: ERF_DataStruct.H:24
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
@ foextrap
Definition: ERF_IndexDefines.H:224

Referenced by make_SurfaceLayer_at_level().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_q_surf()

void SurfaceLayer::set_q_surf ( const int &  lev,
const amrex::Real  qsurf 
)
inline
584 { q_surf[lev]->setVal(qsurf); }

◆ set_t_surf()

void SurfaceLayer::set_t_surf ( const int &  lev,
const amrex::Real  tsurf 
)
inline
581 { t_surf[lev]->setVal(tsurf); }

◆ update_fluxes()

void SurfaceLayer::update_fluxes ( const int &  lev,
const amrex::Real elapsed_time_since_start_low,
amrex::MultiFab &  cons_in,
const std::unique_ptr< amrex::MultiFab > &  z_phys_nd,
const std::unique_ptr< amrex::MultiFab > &  walldist,
int  max_iters = 100 
)

Wrapper to update ustar and tstar for Monin Obukhov similarity theory.

Parameters
[in]levCurrent level
[in]max_itersmaximum iterations to use
18 {
19  // Update with SST/TSK data if we have a valid pointer
20  if (!m_sst_lev[lev].empty() && m_sst_lev[lev][0]) {
21  fill_tsurf_with_sst_and_tsk(lev, elapsed_time_since_start_low);
22  }
23 
24  // Apply heating rate if needed
26  update_surf_temp(elapsed_time_since_start_low);
27  }
28 
29  // Update qsurf with qsat over sea
30  if (use_moisture) {
31  fill_qsurf_with_qsat(lev, cons_in, z_phys_nd);
32  }
33 
34  // Update land surface temp if we have a valid pointer
35  if (m_has_lsm_tsurf) { get_lsm_tsurf(lev); }
36 
37  // Fill interior ghost cells
38  t_surf[lev]->FillBoundary(m_geom[lev].periodicity());
39 
40  // Compute plane averages for all vars (regardless of flux type)
42 
43 
44  // ***************************************************************
45  // Iterate the fluxes if moeng type
46  // First iterate over land -- the only model for surface roughness
47  // over land is RoughCalcType::CONSTANT
48  // ***************************************************************
51  bool is_land = true;
52  // Do we have a constant flux for moisture over land?
53  bool cons_qflux = ( (moist_type == MoistCalcType::MOISTURE_FLUX) ||
57  surface_flux most_flux(surf_temp_flux, surf_moist_flux, cons_qflux);
58  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
59  } else {
60  amrex::Abort("Unknown value for rough_type_land");
61  }
64  surface_temp most_flux(surf_temp_flux, surf_moist_flux, cons_qflux);
65  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
66  } else {
67  amrex::Abort("Unknown value for rough_type_land");
68  }
69  } else if ((theta_type == ThetaCalcType::ADIABATIC) &&
73  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
74  } else {
75  amrex::Abort("Unknown value for rough_type_land");
76  }
77  } else {
78  amrex::Abort("Unknown value for theta_type");
79  }
80  } // MOENG -- LAND
81 
82  // ***************************************************************
83  // Iterate the fluxes if moeng type
84  // Next iterate over sea -- the models for surface roughness
85  // over sea are CHARNOCK, DONELAN, MODIFIED_CHARNOCK or WAVE_COUPLED
86  // ***************************************************************
89  bool is_land = false;
90  // NOTE: Do not allow default to adiabatic over sea (we have Qvs at surface)
91  // Do we have a constant flux for moisture over sea?
92  bool cons_qflux = (moist_type == MoistCalcType::MOISTURE_FLUX);
96  cnk_a, cnk_visc, cons_qflux);
97  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
100  depth, cons_qflux);
101  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
102  } else if (rough_type_sea == RoughCalcType::DONELAN) {
104  cons_qflux);
105  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
108  cons_qflux);
109  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
110  } else {
111  amrex::Abort("Unknown value for rough_type_sea");
112  }
113 
117  cnk_a, cnk_visc, cons_qflux);
118  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
121  depth, cons_qflux);
122  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
123  } else if (rough_type_sea == RoughCalcType::DONELAN) {
125  cons_qflux);
126  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
129  cons_qflux);
130  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
131  } else {
132  amrex::Abort("Unknown value for rough_type_sea");
133  }
134 
135  } else if ((theta_type == ThetaCalcType::ADIABATIC) &&
139  cnk_a, cnk_visc);
140  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
143  depth);
144  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
145  } else if (rough_type_sea == RoughCalcType::DONELAN) {
147  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
150  compute_fluxes(lev, max_iters, cons_in, most_flux, is_land);
151  } else {
152  amrex::Abort("Unknown value for rough_type_sea");
153  }
154  } else {
155  amrex::Abort("Unknown value for theta_type");
156  }
157 
158  } // MOENG -- SEA
159 
161  if (custom_rhosurf > 0) {
162  specified_rho_surf = true;
163  u_star[lev]->setVal(std::sqrt(custom_rhosurf) * custom_ustar);
164  t_star[lev]->setVal(custom_rhosurf * custom_tstar);
165  q_star[lev]->setVal(custom_rhosurf * custom_qstar);
166  } else {
167  u_star[lev]->setVal(custom_ustar);
168  t_star[lev]->setVal(custom_tstar);
169  q_star[lev]->setVal(custom_qstar);
170  }
171  }
172 
173  if (m_update_k_rans) {
174  const bool use_ref_theta = (theta_ref > 0);
175  const Real l_inv_theta0 = (use_ref_theta) ? 1.0 / theta_ref : 1.0;
176  const Real l_inv_Cmu2 = inv_Cmu2;
177  const int klo = m_geom[lev].Domain().smallEnd(2);
178  IntVect ng = u_star[lev]->nGrowVect(); ng[2] = 0;
179 
180  for (MFIter mfi(cons_in); mfi.isValid(); ++mfi)
181  {
182  Box gpbx = mfi.tilebox(IntVect(0),ng);
183 
184  if (gpbx.smallEnd(2) != klo) { continue; }
185 
186  gpbx.makeSlab(2,klo);
187 
188  auto cons_arr = cons_in.array(mfi);
189  const auto& u_star_arr = u_star[lev]->const_array(mfi);
190  const auto& t_star_arr = t_star[lev]->const_array(mfi);
191  const auto& dist_arr = walldist->const_array(mfi);
192 
193  ParallelFor(gpbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
194  {
195  Real rho = cons_arr(i,j,k,Rho_comp);
196  if (t_star_arr(i,j,0) < -1e-8) {
197  // Only destabilizing buoyancy flux affects the boundary k
198  // tstar < 0 ==> B > 0
199  Real B = -CONST_GRAV * l_inv_theta0 * u_star_arr(i,j,0) * t_star_arr(i,j,0);
200  if (!use_ref_theta) {
201  B *= cons_arr(i,j,k,Rho_comp) /
202  cons_arr(i,j,k,RhoTheta_comp);
203  }
204 
205  // Axell & Liungman 2001, Eqn. 16
206  cons_arr(i,j,k,RhoKE_comp) = rho * l_inv_Cmu2 *
207  std::pow(
208  u_star_arr(i,j,0) * u_star_arr(i,j,0) * u_star_arr(i,j,0)
209  + KAPPA * B * dist_arr(i,j,k),
210  2.0/3.0);
211  } else {
212  cons_arr(i,j,k,RhoKE_comp) = rho * l_inv_Cmu2 * u_star_arr(i,j,0) * u_star_arr(i,j,0);
213  }
214  });
215  }
216  }
217 }
constexpr amrex::Real KAPPA
Definition: ERF_Constants.H:20
const bool use_ref_theta
Definition: ERF_SetupDiff.H:16
const Real l_inv_theta0
Definition: ERF_SetupDiff.H:17
void compute_averages(const int &lev)
Definition: ERF_MOSTAverage.cpp:778
void update_surf_temp(const amrex::Real &time)
Definition: ERF_SurfaceLayer.H:542
void get_lsm_tsurf(const int &lev)
Definition: ERF_SurfaceLayer.cpp:727
void fill_qsurf_with_qsat(const int &lev, const amrex::MultiFab &cons_in, const std::unique_ptr< amrex::MultiFab > &z_phys_nd)
Definition: ERF_SurfaceLayer.cpp:684
void compute_fluxes(const int &lev, const int &max_iters, amrex::MultiFab &cons_in, const FluxIter &most_flux, bool is_land)
void fill_tsurf_with_sst_and_tsk(const int &lev, const amrex::Real &time)
Definition: ERF_SurfaceLayer.cpp:597
Definition: ERF_MOSTStress.H:189
Definition: ERF_MOSTStress.H:359
Definition: ERF_MOSTStress.H:278
Definition: ERF_MOSTStress.H:429
Definition: ERF_MOSTStress.H:140
Definition: ERF_MOSTStress.H:610
Definition: ERF_MOSTStress.H:840
Definition: ERF_MOSTStress.H:729
Definition: ERF_MOSTStress.H:948
Definition: ERF_MOSTStress.H:505
Definition: ERF_MOSTStress.H:1199
Definition: ERF_MOSTStress.H:1523
Definition: ERF_MOSTStress.H:1365
Definition: ERF_MOSTStress.H:1641
Definition: ERF_MOSTStress.H:1065
Here is the call graph for this function:

◆ update_mac_ptrs()

void SurfaceLayer::update_mac_ptrs ( const int &  lev,
amrex::Vector< amrex::Vector< amrex::MultiFab >> &  vars_old,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Theta_prim,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Qv_prim,
amrex::Vector< std::unique_ptr< amrex::MultiFab >> &  Qr_prim 
)
inline
559  {
560  m_ma.update_field_ptrs(lev, vars_old, Theta_prim, Qv_prim, Qr_prim);
561  }
void update_field_ptrs(const int &lev, amrex::Vector< amrex::Vector< amrex::MultiFab >> &vars_old, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Theta_prim, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Qv_prim, amrex::Vector< std::unique_ptr< amrex::MultiFab >> &Qr_prim)
Definition: ERF_MOSTAverage.cpp:265
Here is the call graph for this function:

◆ update_pblh()

void SurfaceLayer::update_pblh ( const int &  lev,
amrex::Vector< amrex::Vector< amrex::MultiFab >> &  vars,
amrex::MultiFab *  z_phys_cc,
const MoistureComponentIndices moisture_indices 
)
766 {
768  MYNNPBLH estimator;
769  compute_pblh(lev, vars, z_phys_cc, estimator, moisture_indices);
771  amrex::Error("YSU/MRF PBLH calc not implemented yet");
772  }
773 }
void compute_pblh(const int &lev, amrex::Vector< amrex::Vector< amrex::MultiFab >> &vars, amrex::MultiFab *z_phys_cc, const PBLHeightEstimator &est, const MoistureComponentIndices &moisture_indice)
Definition: ERF_PBLHeight.H:8

◆ update_sst_ptr()

void SurfaceLayer::update_sst_ptr ( const int  lev,
const int  itime,
amrex::MultiFab *  sst_ptr 
)
inline
614  {
615  m_sst_lev[lev][itime] = sst_ptr;
616  }

◆ update_surf_temp()

void SurfaceLayer::update_surf_temp ( const amrex::Real time)
inline
543  {
544  if (surf_heating_rate != 0) {
545  int nlevs = static_cast<int>(m_geom.size());
546  for (int lev = 0; lev < nlevs; lev++) {
547  t_surf[lev]->setVal(surf_temp + surf_heating_rate * time);
548  amrex::Print() << "Surface temp at t=" << time << ": "
549  << surf_temp + surf_heating_rate * time << std::endl;
550  }
551  }
552  }

◆ update_tsk_ptr()

void SurfaceLayer::update_tsk_ptr ( const int  lev,
const int  itime,
amrex::MultiFab *  tsk_ptr 
)
inline
618  {
619  m_tsk_lev[lev][itime] = tsk_ptr;
620  }

Member Data Documentation

◆ cnk_a

amrex::Real SurfaceLayer::cnk_a {0.0185}
private

Referenced by SurfaceLayer().

◆ cnk_visc

bool SurfaceLayer::cnk_visc {false}
private

Referenced by SurfaceLayer().

◆ custom_qstar

amrex::Real SurfaceLayer::custom_qstar {0}
private

Referenced by SurfaceLayer().

◆ custom_rhosurf

amrex::Real SurfaceLayer::custom_rhosurf {0}
private

Referenced by SurfaceLayer().

◆ custom_tstar

amrex::Real SurfaceLayer::custom_tstar {0}
private

Referenced by SurfaceLayer().

◆ custom_ustar

amrex::Real SurfaceLayer::custom_ustar {0}
private

Referenced by SurfaceLayer().

◆ default_land_surf_moist

amrex::Real SurfaceLayer::default_land_surf_moist {0.}
private

◆ default_land_surf_temp

amrex::Real SurfaceLayer::default_land_surf_temp {300.}
private

◆ depth

amrex::Real SurfaceLayer::depth {30.0}
private

Referenced by SurfaceLayer().

◆ flux_type

FluxCalcType SurfaceLayer::flux_type {FluxCalcType::MOENG}

◆ inv_Cmu2

amrex::Real SurfaceLayer::inv_Cmu2 = 0.0
private

Referenced by SurfaceLayer().

◆ m_Cd

amrex::Real SurfaceLayer::m_Cd = 0.0
private

Referenced by SurfaceLayer().

◆ m_Ch

amrex::Real SurfaceLayer::m_Ch = 0.0
private

Referenced by SurfaceLayer().

◆ m_Cq

amrex::Real SurfaceLayer::m_Cq = 0.0
private

Referenced by SurfaceLayer().

◆ m_eddyDiffs_lev

amrex::Vector<amrex::MultiFab*> SurfaceLayer::m_eddyDiffs_lev
private

◆ m_final_low_time

amrex::Real SurfaceLayer::m_final_low_time
private

◆ m_geom

amrex::Vector<amrex::Geometry> SurfaceLayer::m_geom
private

Referenced by update_surf_temp().

◆ m_has_lsm_tsurf

bool SurfaceLayer::m_has_lsm_tsurf = false
private

◆ m_Hwave_lev

amrex::Vector<amrex::MultiFab*> SurfaceLayer::m_Hwave_lev
private

◆ m_ignore_sst

bool SurfaceLayer::m_ignore_sst = false
private

◆ m_include_wstar

bool SurfaceLayer::m_include_wstar = false
private

Referenced by SurfaceLayer().

◆ m_lmask_lev

amrex::Vector<amrex::Vector<amrex::iMultiFab*> > SurfaceLayer::m_lmask_lev
private

◆ m_low_time_interval

amrex::Real SurfaceLayer::m_low_time_interval
private

◆ m_lsm_data_lev

amrex::Vector<amrex::Vector<amrex::MultiFab*> > SurfaceLayer::m_lsm_data_lev
private

◆ m_lsm_data_name

amrex::Vector<std::string> SurfaceLayer::m_lsm_data_name
private

◆ m_lsm_flux_lev

amrex::Vector<amrex::Vector<amrex::MultiFab*> > SurfaceLayer::m_lsm_flux_lev
private

◆ m_lsm_flux_name

amrex::Vector<std::string> SurfaceLayer::m_lsm_flux_name
private

◆ m_lsm_tsurf_indx

int SurfaceLayer::m_lsm_tsurf_indx = -1
private

◆ m_Lwave_lev

amrex::Vector<amrex::MultiFab*> SurfaceLayer::m_Lwave_lev
private

◆ m_ma

MOSTAverage SurfaceLayer::m_ma
private

◆ m_rotate

bool SurfaceLayer::m_rotate = false
private

◆ m_sst_lev

amrex::Vector<amrex::Vector<amrex::MultiFab*> > SurfaceLayer::m_sst_lev
private

◆ m_start_low_time

amrex::Real SurfaceLayer::m_start_low_time
private

◆ m_tsk_lev

amrex::Vector<amrex::Vector<amrex::MultiFab*> > SurfaceLayer::m_tsk_lev
private

◆ m_update_k_rans

bool SurfaceLayer::m_update_k_rans = false
private

Referenced by SurfaceLayer().

◆ m_var_z0

bool SurfaceLayer::m_var_z0 {false}
private

◆ moist_type

MoistCalcType SurfaceLayer::moist_type {MoistCalcType::ADIABATIC}

Referenced by SurfaceLayer().

◆ olen

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::olen
private

◆ pblh

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::pblh
private

◆ pblh_type

PBLHeightCalcType SurfaceLayer::pblh_type {PBLHeightCalcType::None}

Referenced by SurfaceLayer().

◆ q_star

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::q_star
private

◆ q_surf

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::q_surf
private

◆ rico_qsat_z0

amrex::Real SurfaceLayer::rico_qsat_z0 {0.001}
private

Referenced by SurfaceLayer().

◆ rico_theta_z0

amrex::Real SurfaceLayer::rico_theta_z0 {298.0}
private

Referenced by SurfaceLayer().

◆ rough_type_land

RoughCalcType SurfaceLayer::rough_type_land {RoughCalcType::CONSTANT}

Referenced by SurfaceLayer().

◆ rough_type_sea

RoughCalcType SurfaceLayer::rough_type_sea {RoughCalcType::CHARNOCK}

◆ specified_rho_surf

bool SurfaceLayer::specified_rho_surf {false}
private

◆ surf_heating_rate

amrex::Real SurfaceLayer::surf_heating_rate {0}
private

Referenced by SurfaceLayer(), and update_surf_temp().

◆ surf_moist

amrex::Real SurfaceLayer::surf_moist
private

Referenced by SurfaceLayer().

◆ surf_moist_flux

amrex::Real SurfaceLayer::surf_moist_flux {0}
private

Referenced by SurfaceLayer().

◆ surf_temp

amrex::Real SurfaceLayer::surf_temp
private

Referenced by SurfaceLayer(), and update_surf_temp().

◆ surf_temp_flux

amrex::Real SurfaceLayer::surf_temp_flux {0}
private

Referenced by SurfaceLayer().

◆ t_star

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::t_star
private

◆ t_surf

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::t_surf
private

◆ theta_ref

amrex::Real SurfaceLayer::theta_ref = 0.0
private

Referenced by SurfaceLayer().

◆ theta_type

◆ u_star

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::u_star
private

◆ use_moisture

bool SurfaceLayer::use_moisture
private

Referenced by SurfaceLayer().

◆ w_star

amrex::Vector<std::unique_ptr<amrex::MultiFab> > SurfaceLayer::w_star
private

◆ z0_const

amrex::Real SurfaceLayer::z0_const {0.1}
private

◆ z_0

amrex::Vector<amrex::MultiFab> SurfaceLayer::z_0
private

The documentation for this class was generated from the following files: