ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ComputeDiffusivityMYJ.cpp File Reference
#include "ERF_SurfaceLayer.H"
#include "ERF_DirectionSelector.H"
#include "ERF_Diffusion.H"
#include "ERF_Constants.H"
#include "ERF_TurbStruct.H"
#include "ERF_PBLModels.H"
#include <cmath>
Include dependency graph for ERF_ComputeDiffusivityMYJ.cpp:

Functions

void ComputeDiffusivityMYJ (double dt, const MultiFab &xvel, const MultiFab &yvel, MultiFab &cons_in, MultiFab &eddyViscosity, const Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const BCRec *bc_ptr, bool, const std::unique_ptr< MultiFab > &z_phys_nd, const std::unique_ptr< MultiFab > &z_sfc_nd, const std::unique_ptr< MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices)
 

Function Documentation

◆ ComputeDiffusivityMYJ()

void ComputeDiffusivityMYJ ( double  dt,
const MultiFab &  xvel,
const MultiFab &  yvel,
MultiFab &  cons_in,
MultiFab &  eddyViscosity,
const Geometry &  geom,
const TurbChoice &  turbChoice,
std::unique_ptr< SurfaceLayer > &  SurfLayer,
bool  use_terrain_fitted_coords,
bool  use_moisture,
int  level,
const BCRec *  bc_ptr,
bool  ,
const std::unique_ptr< MultiFab > &  z_phys_nd,
const std::unique_ptr< MultiFab > &  z_sfc_nd,
const std::unique_ptr< MultiFab > &  z_phys_cc,
const MoistureComponentIndices &  moisture_indices 
)

Compute turbulent diffusivities using the Mellor-Yamada-Janjic (MYJ) closure model.

Parameters
[in]dtTime step.
[in]xvelX-velocity MultiFab.
[in]yvelY-velocity MultiFab.
[in,out]cons_inConservative variables.
[out]eddyViscosityTurbulent diffusivity MultiFab.
[in]geomGrid geometry.
[in]turbChoiceTurbulence choice parameters.
[in]SurfLayerPointer to surface layer data.
[in]use_terrain_fitted_coordsWhether to use terrain-fitted coordinates.
[in]use_moistureWhether moisture variables are used.
[in]levelLevel index.
[in]bc_ptrBoundary condition pointers.
[in]vert_onlyFlag for vertical-only computation.
[in]z_phys_ndNode-centered physical height field.
[in]z_sfc_ndNodal heights of the bottom of the domain
[in]z_phys_ccCell-centered physical height field.
[in]moisture_indicesIndices for moisture components.
51 {
52  const StratType pbl_strat = turbChoice.pbl_strat_type;
53  // Dirichlet flags to switch derivative stencil
54  bool c_ext_dir_on_zlo = ( (bc_ptr[BCVars::cons_bc].lo(2) == ERFBCType::ext_dir) );
55  bool c_ext_dir_on_zhi = ( (bc_ptr[BCVars::cons_bc].hi(2) == ERFBCType::ext_dir) );
56  bool u_ext_dir_on_zlo = ( (bc_ptr[BCVars::xvel_bc].lo(2) == ERFBCType::ext_dir) );
57  bool u_ext_dir_on_zhi = ( (bc_ptr[BCVars::xvel_bc].hi(2) == ERFBCType::ext_dir) );
58  bool v_ext_dir_on_zlo = ( (bc_ptr[BCVars::yvel_bc].lo(2) == ERFBCType::ext_dir) );
59  bool v_ext_dir_on_zhi = ( (bc_ptr[BCVars::yvel_bc].hi(2) == ERFBCType::ext_dir) );
60 
61  // Expose constants
62  Real d_kappa = KAPPA;
63 
64  // Closure coefficients (from Janjic (2002), NCEP Office Note 437)
65  Real EPS1 = Real(1.0e-12);
66  Real EPS2 = zero;
67  Real EPSRS = Real(1.0e-7);
68  Real EPSRU = Real(1.0e-7);
69  Real EPSTRB = Real(1.0e-24);
70  Real EPSL = Real(0.32);
71  Real EPSQ2 = Real(0.2);
72  Real EPSQ1 = std::sqrt(EPSQ2);
73  Real ESQHF = Real(2.5);
74  Real FH = Real(1.01);
75 
76  Real G = CONST_GRAV;
77  Real ALPHA = Real(0.3);
78  Real BETA = one/Real(273.);
79  Real EL0MAX = Real(1000.);
80  Real EL0MIN = one;
81  Real ELFC = Real(0.23);
82 
83  Real A1 = Real( 0.659888514560862645);
84  Real A2x = Real( 0.6574209922667784586);
85  Real B1 = Real(11.87799326209552761);
86  Real B2 = Real( 7.226971804046074028);
87  Real C1 = Real( 0.000830955950095854396);
88 
89  Real BTG = BETA*G;
90  Real RB1 = one/B1;
91 
92  Real ADNH = Real(9.)*A1*A2x*A2x*(Real(12.)*A1+three*B2)*BTG*BTG;
93  Real ADNM = Real(18.)*A1*A1*A2x*(B2-three*A2x)*BTG;
94  Real ANMH = -Real(9.)*A1*A2x*A2x*BTG*BTG;
95  Real ANMM = -three*A1*A2x*(three*A2x+three*B2*C1+Real(18.)*A1*C1-B2)*BTG;
96  Real BDNH = three*A2x*(Real(7.)*A1+B2)*BTG;
97  Real BDNM = Real(6.)*A1*A1;
98  Real BEQH = A2x*B1*BTG+three*A2x*(Real(7.)*A1+B2)*BTG;
99  Real BEQM = -A1*B1*(one-three*C1)+Real(6.)*A1*A1;
100  Real BNMH = -A2x*BTG;
101  Real BNMM = A1*(one-three*C1);
102  Real BSHH = Real(9.)*A1*A2x*A2x*BTG;
103  Real BSHM = Real(18.)*A1*A1*A2x*C1;
104  Real BSMH = -three*A1*A2x*(three*A2x+three*B2*C1+Real(12.)*A1*C1-B2)*BTG;
105  Real CESH = A2x;
106  Real CESM = A1*(one-three*C1);
107 
108  Real AEQH = Real(9.)*A1*A2x*A2x*B1*BTG*BTG
109  + Real(9.)*A1*A2x*A2x*(Real(12.)*A1+three*B2)*BTG*BTG;
110  Real AEQM = three*A1*A2x*B1*(three*A2x+three*B2*C1+Real(18.)*A1*C1-B2)*BTG
111  + Real(18.)*A1*A1*A2x*(B2-three*A2x)*BTG;
112 
113  Real REQU = -AEQH/AEQM;
114  Real EPSGH = Real(1.E-9);
115  Real EPSGM = REQU*EPSGH;
116 
117  Real UBRYL = (Real(18.)*REQU*A1*A1*A2x*B2*C1*BTG + Real(9.)*A1*A2x*A2x*B2*BTG*BTG)
118  / (REQU*ADNM+ADNH);
119  Real UBRY = (one+EPSRS)*UBRYL;
120  Real UBRY3 = three*UBRY;
121 
122  Real AUBH = Real(27.)*A1*A2x*A2x*B2*BTG*BTG-ADNH*UBRY3;
123  Real AUBM = Real(54.)*A1*A1*A2x*B2*C1*BTG-ADNM*UBRY3;
124  Real BUBH = (Real(9.)*A1*A2x+three*A2x*B2)*BTG-BDNH*UBRY3;
125  Real BUBM = Real(18.)*A1*A1*C1-BDNM*UBRY3;
126  Real CUBR = one-UBRY3;
127  Real RCUBR = one/CUBR;
128 
129 #ifdef _OPENMP
130 #pragma omp parallel if (Gpu::notInLaunchRegion())
131 #endif
132  for (MFIter mfi(eddyViscosity,false); mfi.isValid(); ++mfi) {
133 
134  const Box& bx = mfi.validbox();
135  const Array4<Real >& cell_data = cons_in.array(mfi);
136  const Array4<Real >& K_turb = eddyViscosity.array(mfi);
137  const Array4<Real const>& uvel = xvel.array(mfi);
138  const Array4<Real const>& vvel = yvel.array(mfi);
139 
140  // Ensure the box spans the vertical domain
141  const Box& dbx = geom.Domain();
142  AMREX_ALWAYS_ASSERT(bx.smallEnd(2) == dbx.smallEnd(2) && bx.bigEnd(2) == dbx.bigEnd(2));
143 
144  // Create a plane box
145  int klo = bx.smallEnd(2);
146  int khi = bx.bigEnd(2);
147  Box planexy = makeSlab(bx,2,klo);
148 
149  // Expose for GPU capture
150  const GeometryData gdata = geom.data();
151 
152  // Allocate space for integrals
153  const Box xybx = PerpendicularBox<ZDir>(bx, IntVect{0,0,0});
154  FArrayBox qturb(bx,1,The_Async_Arena());
155  FArrayBox qintegral(xybx,2,The_Async_Arena());
156  IArrayBox pbl_k(xybx,1,The_Async_Arena());
157  qintegral.setVal<RunOn::Device>(0);
158  pbl_k.setVal<RunOn::Device>(khi);
159  const Array4<Real> qint = qintegral.array();
160  const Array4<Real> qvel = qturb.array();
161  const Array4<int> k_arr = pbl_k.array();
162 
163  // Terrain and gradient calcs
164  const Array4<Real const> &z_nd_arr = z_phys_nd->array(mfi);
165  const Array4<Real const> &z_sfc_arr = z_sfc_nd->const_array(mfi);
166  const PBLDerivativeDzInv_T pbl_derivative_dz_inv{z_phys_cc->const_array(mfi)};
167  const auto& dxInv = geom.InvCellSizeArray();
168  int izmin = geom.Domain().smallEnd(2);
169  int izmax = geom.Domain().bigEnd(2);
170 
171  // Surface-layer scales, used to rebuild the gradients in the first cell
172  // above the surface (ERF #4037). MYJ can run without a SurfaceLayer, so
173  // these stay empty when there is none and the resolved stencil is kept.
174  const bool surface_layer_on_zlo = (SurfLayer != nullptr);
175  const auto u_star_arr = (surface_layer_on_zlo) ?
176  SurfLayer->get_u_star(level)->const_array(mfi) : Array4<const Real>{};
177  const similarity_funs l_sfuns = (surface_layer_on_zlo) ? SurfLayer->similarity_functions() : similarity_funs{};
178  const auto t_star_arr = (surface_layer_on_zlo) ?
179  SurfLayer->get_t_star(level)->const_array(mfi) : Array4<const Real>{};
180  const auto q_star_arr = (surface_layer_on_zlo && use_moisture) ?
181  SurfLayer->get_q_star(level)->const_array(mfi) : Array4<const Real>{};
182  const auto l_obuk_arr = (surface_layer_on_zlo) ?
183  SurfLayer->get_olen(level)->const_array(mfi) : Array4<const Real>{};
184 
185  // Vertical integrals to compute l0
186  if (use_terrain_fitted_coords) {
187  ParallelFor(planexy, [=] AMREX_GPU_DEVICE (int i, int j, int /*k*/) noexcept
188  {
189  // Locate PBL k index and set qvel
190  for (int k(klo); k<=khi; ++k) {
191  Real q2 = two * cell_data(i,j,k,RhoKE_comp) / cell_data(i,j,k,Rho_comp);
192  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(q2 > zero, "KE must have a positive value");
193  qvel(i,j,k) = std::sqrt(q2);
194  if (q2<=EPSQ2*FH) {
195  k_arr(i,j,0) = std::min(k,k_arr(i,j,0));
196  }
197  }
198 
199  // Perform integral over PBL height
200  for (int k(klo); k<=k_arr(i,j,0); ++k) {
201  const Real dz = Compute_h_zeta_AtCellCenter(i,j,k,dxInv,z_nd_arr);
202  const Real Zval = Compute_Zrel_AtCellCenter(i,j,k,z_sfc_arr,z_nd_arr);
203  Gpu::Atomic::Add(&qint(i,j,0,0), Zval*qvel(i,j,k)*dz);
204  Gpu::Atomic::Add(&qint(i,j,0,1), qvel(i,j,k)*dz);
205  }
206  });
207  } else {
208  ParallelFor(planexy, [=] AMREX_GPU_DEVICE (int i, int j, int /*k*/) noexcept
209  {
210  // Locate PBL k index and set qvel
211  for (int k(klo); k<=khi; ++k) {
212  Real q2 = two * cell_data(i,j,k,RhoKE_comp) / cell_data(i,j,k,Rho_comp);
213  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(q2 > zero, "KE must have a positive value");
214  qvel(i,j,k) = std::sqrt(q2);
215  if (q2<=EPSQ2*FH) {
216  k_arr(i,j,0) = std::min(k,k_arr(i,j,0));
217  }
218  }
219 
220  // Perform integral over PBL height
221  for (int k(klo); k<=k_arr(i,j,0); ++k) {
222  // Not multiplying by dz: it's constant and would fall out when we divide qint0/qint1 anyway
223  const Real Zval = (k + myhalf)*gdata.CellSize(2);
224  Gpu::Atomic::Add(&qint(i,j,0,0), Zval*qvel(i,j,k));
225  Gpu::Atomic::Add(&qint(i,j,0,1), qvel(i,j,k));
226  }
227  });
228  }
229 
230  // Main work to fill diffusivities
231  ParallelFor(planexy, [=] AMREX_GPU_DEVICE (int i, int j, int /*k*/) noexcept
232  {
233  // Get the PBL k index
234  int kpbl = k_arr(i,j,0);
235 
236  // Compute the integral length scale
237  Real l0 = std::max(std::min(ALPHA*qint(i,j,0,0)/qint(i,j,0,1),EL0MAX),EL0MIN);
238 
239  // Compute diffusivities in each column
240  for (int k(klo); k<=khi; ++k) {
241  // Gradients for shear and buoy production
242  const Real met_h_zeta = use_terrain_fitted_coords ? Compute_h_zeta_AtCellCenter(i,j,k,dxInv,z_nd_arr) : one;
243  Real dthetavdz, dudz, dvdz;
245  uvel, vvel, cell_data, izmin, izmax, pbl_derivative_dz_inv(i,j,k),
246  c_ext_dir_on_zlo, c_ext_dir_on_zhi,
247  u_ext_dir_on_zlo, u_ext_dir_on_zhi,
248  v_ext_dir_on_zlo, v_ext_dir_on_zhi,
249  dthetavdz, dudz, dvdz,
250  moisture_indices, pbl_strat);
251 
252  // Replace the resolved gradients in the first cell with the MOST
253  // profile gradients; see ApplySurfaceLayerGradientsPBL (ERF #4037)
254  if (surface_layer_on_zlo && k == izmin) {
255  const Real zval = use_terrain_fitted_coords ?
256  Compute_Zrel_AtCellCenter(i,j,k,z_sfc_arr,z_nd_arr) :
257  (k + myhalf)*gdata.CellSize(2);
258  const Real rho = cell_data(i,j,k,Rho_comp);
259  const Real theta = cell_data(i,j,k,RhoTheta_comp) / rho;
260  const Real qv = (moisture_indices.qv >= 0) ?
261  cell_data(i,j,k,moisture_indices.qv) / rho : zero;
262  const Real l_min = Real(1.0e-10); // same floor on |L| as MRF and YSU
263  const Real l_obuk = std::copysign(std::max(std::fabs(l_obuk_arr(i,j,0)),l_min),l_obuk_arr(i,j,0));
265  sl.u_star = u_star_arr(i,j,0);
266  sl.tstar_v = ComputeVirtualTStarPBL(t_star_arr(i,j,0),
267  (q_star_arr) ? q_star_arr(i,j,0) : zero,
268  theta, qv, use_moisture);
269  sl.zval = zval;
270  sl.zeta = zval / l_obuk;
271  sl.sfuns = l_sfuns;
272  ApplySurfaceLayerGradientsPBL(sl, dthetavdz, dudz, dvdz);
273  }
274 
275  // Calculate dimensional production terms
276  Real GML = std::max(dudz*dudz + dvdz*dvdz, EPSGM);
277  // NOTE: model uses BTG = beta*g in coeffs above
278  // NOTE: sign convention follows code but theory differs
279  Real GHL = dthetavdz;
280  if (std::fabs(GHL)<=EPSGH) { GHL=EPSGH; }
281 
282  // Find the maximum mixing length
283  Real ELM;
284  if (GHL >= EPSGH) {
285  if (GML/GHL <= REQU) {
286  ELM = EPSL;
287  } else {
288  Real AUBR = (AUBM*GML+AUBH*GHL)*GHL;
289  Real BUBR = BUBM*GML+BUBH*GHL;
290  Real QOL2ST = (-myhalf*BUBR+std::sqrt(BUBR*BUBR*fourth-AUBR*CUBR))*RCUBR;
291  Real ELOQ2X = one/QOL2ST;
292  ELM = std::max(std::sqrt(ELOQ2X*qvel(i,j,k)*qvel(i,j,k)),EPSL);
293  }
294  } else {
295  Real ADEN = (ADNM*GML+ADNH*GHL)*GHL;
296  Real BDEN = BDNM*GML+BDNH*GHL;
297  Real QOL2UN = -myhalf*BDEN+std::sqrt(BDEN*BDEN*fourth-ADEN);
298  Real ELOQ2X = one/(QOL2UN+EPSRU);
299  ELM = std::max(std::sqrt(ELOQ2X*qvel(i,j,k)*qvel(i,j,k)),EPSL);
300  }
301 
302  // Compute master length scale
303  Real L;
304  if (k>kpbl) {
305  L = std::min((met_h_zeta/dxInv[2])*ELFC, ELM);
306  } else {
307  const Real zval = use_terrain_fitted_coords ? Compute_Zrel_AtCellCenter(i,j,k,z_sfc_arr,z_nd_arr)
308  : (k + myhalf)*gdata.CellSize(2);
309  L = std::min(l0*d_kappa*zval / (d_kappa*zval + l0), ELM);
310  }
311 
312  // Update qvel from production and dissipation
313  Real AEQU = (AEQM*GML+AEQH*GHL)*GHL;
314  Real BEQU = BEQM*GML+BEQH*GHL;
315 
316  Real EQOL2 = -myhalf*BEQU+std::sqrt(BEQU*BEQU*fourth-AEQU);
317 
318  if ( ((GML+GHL*GHL)<=EPSTRB) ||
319  ((GHL>=EPSGH) && ((GML/GHL)<=REQU)) ||
320  (EQOL2<=EPS2) ) {
321  L = EPSL;
322  qvel(i,j,k) = EPSQ1;
323  } else {
324  Real ANUM=(ANMM*GML+ANMH*GHL)*GHL;
325  Real BNUM= BNMM*GML+BNMH*GHL;
326 
327  Real ADEN=(ADNM*GML+ADNH*GHL)*GHL;
328  Real BDEN= BDNM*GML+BDNH*GHL;
329  Real CDEN= one;
330 
331  Real ARHS=-(ANUM*BDEN-BNUM*ADEN)*two;
332  Real BRHS=- ANUM*Real(4.);
333  Real CRHS=- BNUM*two;
334 
335  Real DLOQ1=L/qvel(i,j,k);
336 
337  Real ELOQ21=one/EQOL2;
338  Real ELOQ11=std::sqrt(ELOQ21);
339  Real ELOQ31=ELOQ21*ELOQ11;
340  Real ELOQ41=ELOQ21*ELOQ21;
341  Real ELOQ51=ELOQ21*ELOQ31;
342 
343  Real RDEN1=one/(ADEN*ELOQ41+BDEN*ELOQ21+CDEN);
344 
345  Real RHSP1=(ARHS*ELOQ51+BRHS*ELOQ31+CRHS*ELOQ11)*RDEN1*RDEN1;
346 
347  Real DTTURBL = static_cast<Real>(dt);
348  Real ELOQ12 = amrex::max(ELOQ11+(DLOQ1-ELOQ11)*std::exp(RHSP1*DTTURBL),EPS1);
349 
350  Real ELOQ22=ELOQ12*ELOQ12;
351  Real ELOQ32=ELOQ22*ELOQ12;
352  Real ELOQ42=ELOQ22*ELOQ22;
353  Real ELOQ52=ELOQ22*ELOQ32;
354 
355  Real RDEN2=one/(ADEN*ELOQ42+BDEN*ELOQ22+CDEN);
356  Real RHS2 =-(ANUM*ELOQ42+BNUM*ELOQ22)*RDEN2+RB1;
357  Real RHSP2= (ARHS*ELOQ52+BRHS*ELOQ32+CRHS*ELOQ12)*RDEN2*RDEN2;
358  Real RHST2=RHS2/RHSP2;
359 
360  Real ELOQ13 = amrex::max(ELOQ12-RHST2+(RHST2+DLOQ1-ELOQ12)*std::exp(RHSP2*DTTURBL),EPS1);
361 
362  Real ELOQN=ELOQ13;
363  if (ELOQN>EPS1) {
364  qvel(i,j,k) = std::max(L/ELOQN,EPSQ1);
365  if (qvel(i,j,k)==EPSQ1) {L = EPSL; }
366  } else {
367  L = EPSL;
368  qvel(i,j,k) = EPSQ1;
369  }
370  }
371 
372  // NOTE: MYJ in WRF places the TKE at the w-faces and not the CC.
373  // Therefore, WRF sets the bottom face in accordance with
374  // the surface layer friction velocity (below). We do not
375  // do that since TKE lives at CC here.
376  //if (k==klo) {
377  // Real q2 = std::pow(B1,(two/three))*ustar_arr(i,j,k)*ustar_arr(i,j,k);
378  // Real q = std::max(std::sqrt(q2),EPSQ1);
379  // qvel(i,j,k) = myhalf * (q + qvel(i,j,k));
380  //}
381 
382  cell_data(i,j,k,RhoKE_comp) = myhalf*cell_data(i,j,k,Rho_comp)*qvel(i,j,k)*qvel(i,j,k);
383 
384  // L^n/Q^n
385  Real ELOQ2 = L*L/(qvel(i,j,k)*qvel(i,j,k));
386  Real ELOQ4 = ELOQ2*ELOQ2;
387 
388  // COEFFICIENTS OF THE TERMS IN THE DENOMINATOR
389  Real ADEN=(ADNM*GML+ADNH*GHL)*GHL;
390  Real BDEN= BDNM*GML+BDNH*GHL;
391  Real CDEN= one;
392 
393  // COEFFICIENTS FOR THE SM DETERMINANT
394  Real BESM=BSMH*GHL;
395 
396  // COEFFICIENTS FOR THE SH DETERMINANT
397  Real BESH=BSHM*GML+BSHH*GHL;
398 
399  // 1/DENOMINATOR
400  Real RDEN=one/(ADEN*ELOQ4+BDEN*ELOQ2+CDEN);
401 
402  // SM, SH, SQ
403  Real SM=(BESM*ELOQ2+CESM)*RDEN;
404  Real SH=(BESH*ELOQ2+CESH)*RDEN;
405  Real SQ=ESQHF*SH;
406 
407  // Finally, compute the eddy viscosity/diffusivities
408  const Real rho = cell_data(i,j,k,Rho_comp);
409  K_turb(i,j,k,EddyDiff::Mom_v ) = rho * L * qvel(i,j,k) * SM;
410  K_turb(i,j,k,EddyDiff::Theta_v) = rho * L * qvel(i,j,k) * SH;
411  K_turb(i,j,k,EddyDiff::KE_v ) = rho * L * qvel(i,j,k) * SQ;
412  K_turb(i,j,k,EddyDiff::Q_v ) = rho * L * qvel(i,j,k) * SH;
413  K_turb(i,j,k,EddyDiff::Turb_lengthscale) = L;
414 
415  // NOTE: Ghost cells are handled at end of ERF_ComputeTurbulentViscosity.cpp
416 
417  } // for k
418  }); // ParFor
419  } // mfi
420 }
constexpr amrex::Real KAPPA
Definition: ERF_Constants.H:71
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
#define Rho_comp
Definition: ERF_IndexDefines.H:61
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:62
#define RhoKE_comp
Definition: ERF_IndexDefines.H:63
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:16
const bool use_moisture
Definition: ERF_InitCustomPert_ABL.H:127
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
const int khi
Definition: ERF_InitCustomPert_Bubble.H:25
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
const int klo
Definition: ERF_InitCustomPert_KE.H:9
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
constexpr amrex::Real three
Definition: ERF_NumericalConstants.H:39
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void ComputeVerticalDerivativesPBL(int i, int j, int k, const amrex::Array4< const amrex::Real > &uvel, const amrex::Array4< const amrex::Real > &vvel, const amrex::Array4< const amrex::Real > &cell_data, const int izmin, const int izmax, const PBLDerivativeDzInv &dz_inv, const bool c_ext_dir_on_zlo, const bool c_ext_dir_on_zhi, const bool u_ext_dir_on_zlo, const bool u_ext_dir_on_zhi, const bool v_ext_dir_on_zlo, const bool v_ext_dir_on_zhi, amrex::Real &dthetadz, amrex::Real &dudz, amrex::Real &dvdz, const MoistureComponentIndices &moisture_indices, const StratType strat=StratType::thetav)
Definition: ERF_PBLModels.H:291
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void ApplySurfaceLayerGradientsPBL(const PBLSurfaceLayerGradient &sl, amrex::Real &dthetadz, amrex::Real &dudz, amrex::Real &dvdz)
Definition: ERF_PBLModels.H:411
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeVirtualTStarPBL(amrex::Real t_star, amrex::Real q_star, amrex::Real theta, amrex::Real qv, bool use_moisture)
Definition: ERF_PBLModels.H:374
AMREX_GPU_HOST_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_sfc_nd, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:764
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtCellCenter(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:202
@ yvel_bc
Definition: ERF_IndexDefines.H:139
@ cons_bc
Definition: ERF_IndexDefines.H:122
@ xvel_bc
Definition: ERF_IndexDefines.H:138
@ ext_dir
Definition: ERF_IndexDefines.H:317
@ Theta_v
Definition: ERF_IndexDefines.H:267
@ Turb_lengthscale
Definition: ERF_IndexDefines.H:271
@ Q_v
Definition: ERF_IndexDefines.H:270
@ Mom_v
Definition: ERF_IndexDefines.H:266
@ KE_v
Definition: ERF_IndexDefines.H:268
@ rho
Definition: ERF_Kessler.H:25
@ theta
Definition: ERF_Kessler.H:26
@ qv
Definition: ERF_Kessler.H:31
@ xvel
Definition: ERF_IndexDefines.H:232
@ yvel
Definition: ERF_IndexDefines.H:233
@ dz
Definition: ERF_AdvanceWDM6.cpp:273
int qv
water vapor
Definition: ERF_DataStruct.H:290
Functor for inverse vertical spacings for terrain-following grids using cell-center heights.
Definition: ERF_PBLModels.H:652
Definition: ERF_PBLModels.H:353
amrex::Real tstar_v
virtual temperature scale
Definition: ERF_PBLModels.H:355
amrex::Real zeta
stability coordinate z/L
Definition: ERF_PBLModels.H:357
similarity_funs sfuns
the surface layer's similarity functions (most.stable_functions)
Definition: ERF_PBLModels.H:358
amrex::Real u_star
friction velocity
Definition: ERF_PBLModels.H:354
amrex::Real zval
height of the cell center above the surface
Definition: ERF_PBLModels.H:356
StratType pbl_strat_type
Definition: ERF_TurbStruct.H:951
Definition: ERF_MOSTUtils.H:84

Referenced by ComputeTurbulentViscosity().

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