|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|


Go to the source code of this file.
Classes | |
| struct | PBLDerivativeDzInv |
| struct | PBLDerivativeDzInv_N |
| Functor for inverse vertical spacings with constant grid spacing. More... | |
| struct | PBLDerivativeDzInv_S |
| Functor for inverse vertical spacings for stretched grids using a spacing array. More... | |
| struct | PBLDerivativeDzInv_T |
| Functor for inverse vertical spacings for terrain-following grids using cell-center heights. More... | |
Functions | |
| void | ComputeDiffusivityMYJ (double dt, const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices) |
| void | ComputeDiffusivityMYNN25 (const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices) |
| void | ComputeDiffusivityMYNNEDMF (const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices) |
| void | ComputeDiffusivityYSU (const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices) |
| void | ComputeDiffusivityMRF (const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices, const amrex::MultiFab *terrain_blank=nullptr) |
| void | ComputeDiffusivityYSUNew (const amrex::MultiFab &xvel, const amrex::MultiFab &yvel, const amrex::MultiFab &cons_in, amrex::MultiFab &eddyViscosity, const amrex::Geometry &geom, const TurbChoice &turbChoice, std::unique_ptr< SurfaceLayer > &SurfLayer, bool use_terrain_fitted_coords, bool use_moisture, int level, const amrex::BCRec *bc_ptr, bool, const std::unique_ptr< amrex::MultiFab > &z_phys_nd, const std::unique_ptr< amrex::MultiFab > &z_phys_cc, const MoistureComponentIndices &moisture_indices, const amrex::MultiFab *qheating_rates=nullptr, const amrex::MultiFab *terrain_blank=nullptr) |
| 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) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real | ComputeQKESourceTerms (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 amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &K_turb, const amrex::Box &domain, const PBLDerivativeDzInv dz_inv, amrex::Real pbl_mynn_B1_l, const amrex::Real theta_mean, const MoistureComponentIndices &moisture_indices, bool c_ext_dir_on_zlo, bool c_ext_dir_on_zhi, bool u_ext_dir_on_zlo, bool u_ext_dir_on_zhi, bool v_ext_dir_on_zlo, bool v_ext_dir_on_zhi) |
| void | ApplyPBLHSmoothing (amrex::FArrayBox &pblh_fab, const amrex::Box &xybx_valid, const amrex::Real weight, const int passes, const amrex::Box &domain, const amrex::Periodicity &periodicity) |
| Apply spatial smoothing to PBLH field using 5-point stencil. More... | |
|
inline |
Apply spatial smoothing to PBLH field using 5-point stencil.
Applies a simple 5-point spatial averaging to reduce grid-to-grid noise in the diagnosed PBLH field. This is standard post-processing practice for discrete Rib-crossing detection as described in Seibert et al. (2000): "Review and intercomparison of operational methods for the determination of the mixing height", Atmospheric Environment, 34, 1001-1027.
Stencil: PBLH_smooth(i,j) = w * PBLH(i,j) + (1-w)/4 * [PBLH(i+-1,j) + PBLH(i,j+-1)]
The stencil reads one column outside the region it writes, so the result on a cell depends on columns that a single tile – or a single box – does not own. The caller therefore names the region it wants smoothed (xybx_valid, normally the planar tile box) inside a work array carrying passes columns of halo around it, filled from the same inputs. Pass p writes the region grown by passes-1-p and reads the one grown by passes-p, so each pass consumes one column of halo and the last lands exactly on xybx_valid. Every read stays inside the array, and the result does not depend on how the domain is divided into boxes or tiles.
At a non-periodic domain edge there is no column to read, so the stencil reuses the cell's own value (reflective/Neumann). Across a periodic edge the halo holds the wrapped columns and is read directly, which is why the periodicity has to be passed in: clamping there would fold an edge into a domain that has none.
| [in,out] | pblh_fab | FArrayBox holding the 2D PBLH field (component 0), sized to contain xybx_valid grown by passes in x and y |
| [in] | xybx_valid | Region to smooth (x,y indices only) |
| [in] | weight | Center cell weight in stencil (must be in [0,1]) |
| [in] | passes | Number of smoothing iterations |
| [in] | domain | Domain box, for the reflective edge condition |
| [in] | periodicity | Domain periodicity, so periodic edges read the halo |
Referenced by ComputeDiffusivityMRF(), and ComputeDiffusivityYSUNew().


| void ComputeDiffusivityMRF | ( | const amrex::MultiFab & | xvel, |
| const amrex::MultiFab & | yvel, | ||
| const amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices, | ||
| const amrex::MultiFab * | terrain_blank = nullptr |
||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the Medium Range Forecast (MRF) boundary layer scheme based on Hong and Pan (1996). Reference: Hong, S. Y., and H.-L. Pan, 1996: Nonlocal Boundary Layer Vertical Diffusion in a Medium-Range Forecast Model. Monthly Weather Review, 124, 2322-2339. https://doi.org/10.1175/1520-0493(1996)124<2322:NBLVDI>2.0.CO;2
| [in] | xvel | Velocity in x-dir |
| [in] | yvel | Velocity in y-dir |
| [in] | cons_in | Cell center conserved quantities |
| [out] | eddyViscosity | Holds turbulent viscosity |
| [in] | geom | Problem geometry |
| [in] | turbChoice | Container with turbulence parameters |
| [in] | SurfLayer | Pointer to Monin-Obukhov class if instantiated |
| [in] | use_moisture | If we have microphysics enabled |
| [in] | level | Current level |
| [in] | bc_ptr | Pointer to array with boundary condition info |
| [in] | vert_only | Only compute vertical eddy diffusivities |
| [in] | z_phys_nd | Physical location of grid nodes, if terrain (or grid stretching) is enabled |
| [in] | z_phys_cc | Physical location of cell centers |
| void ComputeDiffusivityMYJ | ( | double | dt, |
| const amrex::MultiFab & | xvel, | ||
| const amrex::MultiFab & | yvel, | ||
| amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices | ||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the Mellor-Yamada-Janjić (MYJ) boundary layer scheme. Reference: Janjić, Z. I., 1994: The Step-Mountain Eta Coordinate Model: Further Developments of the Convection, Viscous Sublayer, and Turbulence Closure Schemes. Monthly Weather Review, 122, 927–945. https://doi.org/10.1175/1520-0493(1994)122<0927:TSMECM>2.0.CO;2
| [in] | xvel | Velocity in x-dir |
| [in] | yvel | Velocity in y-dir |
| [in] | cons_in | Cell center conserved quantities |
| [out] | eddyViscosity | Holds turbulent viscosity |
| [in] | geom | Problem geometry |
| [in] | turbChoice | Container with turbulence parameters |
| [in] | SurfLayer | Pointer to Monin-Obukhov class if instantiated |
| [in] | use_moisture | If we have microphysics enabled |
| [in] | level | Current level |
| [in] | bc_ptr | Pointer to array with boundary condition info |
| [in] | vert_only | Only compute vertical eddy diffusivities |
| [in] | z_phys_nd | Physical location of grid nodes, if terrain (or grid stretching) is enabled |
| [in] | z_phys_cc | Physical location of cell centers |
| void ComputeDiffusivityMYNN25 | ( | const amrex::MultiFab & | xvel, |
| const amrex::MultiFab & | yvel, | ||
| const amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices | ||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the Mellor-Yamada-Nakanishi-Niino Level amrex::Real(2.5) PBL scheme
| [in] | xvel | Velocity in x-dir |
| [in] | yvel | Velocity in y-dir |
| [in] | cons_in | Cell center conserved quantities |
| [out] | eddyViscosity | Holds turbulent viscosity |
| [in] | geom | Problem geometry |
| [in] | turbChoice | Container with turbulence parameters |
| [in] | SurfLayer | Pointer to Monin-Obukhov class if instantiated |
| [in] | use_moisture | If we have microphysics enabled |
| [in] | level | Current level |
| [in] | bc_ptr | Pointer to array with boundary condition info |
| [in] | vert_only | Only compute vertical eddy diffusivities |
| [in] | z_phys_nd | Physical location of grid nodes, if terrain (or grid stretching) is enabled |
| [in] | z_phys_cc | Physical location of cell centers |
| void ComputeDiffusivityMYNNEDMF | ( | const amrex::MultiFab & | xvel, |
| const amrex::MultiFab & | yvel, | ||
| const amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices | ||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the Mellor-Yamada-Nakanishi-Niino Level amrex::Real(2.5) PBL scheme
| [in] | xvel | Velocity in x-dir |
| [in] | yvel | Velocity in y-dir |
| [in] | cons_in | Cell center conserved quantities |
| [out] | eddyViscosity | Holds turbulent viscosity |
| [in] | geom | Problem geometry |
| [in] | turbChoice | Container with turbulence parameters |
| [in] | SurfLayer | Pointer to Monin-Obukhov class if instantiated |
| [in] | use_moisture | If we have microphysics enabled |
| [in] | level | Current level |
| [in] | bc_ptr | Pointer to array with boundary condition info |
| [in] | vert_only | Only compute vertical eddy diffusivities |
| [in] | z_phys_nd | Physical location of grid nodes, if terrain (or grid stretching) is enabled |
| [in] | z_phys_cc | Physical location of cell centers |
| void ComputeDiffusivityYSU | ( | const amrex::MultiFab & | xvel, |
| const amrex::MultiFab & | yvel, | ||
| const amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices | ||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the Yonsei University PBL scheme
| [in] | xvel | Velocity in x-dir |
| [in] | yvel | Velocity in y-dir |
| [in] | cons_in | Cell center conserved quantities |
| [out] | eddyViscosity | Holds turbulent viscosity |
| [in] | geom | Problem geometry |
| [in] | turbChoice | Container with turbulence parameters |
| [in] | SurfLayer | Pointer to Monin-Obukhov class if instantiated |
| [in] | use_moisture | If we have microphysics enabled |
| [in] | level | Current level |
| [in] | bc_ptr | Pointer to array with boundary condition info |
| [in] | vert_only | Only compute vertical eddy diffusivities |
| [in] | z_phys_nd | Physical location of grid nodes, if terrain (or grid stretching) is enabled |
| [in] | z_phys_cc | Physical location of cell centers |
| void ComputeDiffusivityYSUNew | ( | const amrex::MultiFab & | xvel, |
| const amrex::MultiFab & | yvel, | ||
| const amrex::MultiFab & | cons_in, | ||
| amrex::MultiFab & | eddyViscosity, | ||
| const amrex::Geometry & | geom, | ||
| const TurbChoice & | turbChoice, | ||
| std::unique_ptr< SurfaceLayer > & | SurfLayer, | ||
| bool | use_terrain_fitted_coords, | ||
| bool | use_moisture, | ||
| int | level, | ||
| const amrex::BCRec * | bc_ptr, | ||
| bool | , | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_nd, | ||
| const std::unique_ptr< amrex::MultiFab > & | z_phys_cc, | ||
| const MoistureComponentIndices & | moisture_indices, | ||
| const amrex::MultiFab * | qheating_rates = nullptr, |
||
| const amrex::MultiFab * | terrain_blank = nullptr |
||
| ) |
Compute eddy diffusivities of momentum (eddy viscosity) and heat using the WRF Yonsei University (YSU) PBL scheme.
Based on: Hong, Noh & Dudhia (2006), MWR, https://doi.org/10.1175/MWR3250.1 Hong (2010), QJRMS, https://doi.org/10.1002/qj.665
Features: three-pass bulk-Richardson PBLH diagnosis, nonlocal countergradient fluxes, explicit entrainment at PBL top, and grid-adaptive Richardson-number mixing in free atmosphere.
| [in] | xvel | x-direction velocity |
| [in] | yvel | y-direction velocity |
| [in] | cons_in | cell-center conserved quantities |
| [out] | eddyViscosity | turbulent eddy viscosity |
| [in] | geom | problem geometry |
| [in] | turbChoice | turbulence parameter container |
| [in] | SurfLayer | Monin-Obukhov surface layer object |
| [in] | use_terrain_fitted_coords | flag for terrain coordinates |
| [in] | use_moisture | flag for moisture active |
| [in] | level | AMR level |
| [in] | bc_ptr | boundary condition array |
| [in] | vert_only | compute vertical diffusivity only |
| [in] | z_phys_nd | physical node heights (terrain) |
| [in] | z_phys_cc | physical cell-center heights |
| [in] | moisture_indices | component index mapping for moisture variables |
| [in] | qheating_rates | radiation heating rates (SW, LW components); optional |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real ComputeQKESourceTerms | ( | 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 amrex::Array4< const amrex::Real > & | cell_prim, | ||
| const amrex::Array4< const amrex::Real > & | K_turb, | ||
| const amrex::Box & | domain, | ||
| const PBLDerivativeDzInv | dz_inv, | ||
| amrex::Real | pbl_mynn_B1_l, | ||
| const amrex::Real | theta_mean, | ||
| const MoistureComponentIndices & | moisture_indices, | ||
| bool | c_ext_dir_on_zlo, | ||
| bool | c_ext_dir_on_zhi, | ||
| bool | u_ext_dir_on_zlo, | ||
| bool | u_ext_dir_on_zhi, | ||
| bool | v_ext_dir_on_zlo, | ||
| bool | v_ext_dir_on_zhi | ||
| ) |
Function for computing the QKE source terms (NN09, Eqn. 5).
| [in] | u | velocity in x-dir |
| [in] | v | velocity in y-dir |
| [in] | cell_data | conserved cell center vars |
| [in] | cell_prim | primitive cell center vars |
| [in] | K_turb | turbulent viscosity |
| [in] | domain | box of the whole domain |
| [in] | dz_inv | inverse spacings for interior and Dirichlet-boundary differences |
| [in] | pbl_mynn_B1_l | a parameter |
| [in] | theta_mean | average theta |
Referenced by if().


| 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 | ||
| ) |
Compute vertical derivatives of potential temperature and velocity for PBL models.
| i | x-index | |
| j | y-index | |
| k | z-index | |
| [in] | uvel | x-velocity |
| [in] | vvel | y-velocity |
| [in] | cell_data | conserved cell-center variables |
| [in] | izmin | lower z-index limit |
| [in] | izmax | upper z-index limit |
| [in] | dz_inv | inverse physical distance spacings |
| [in] | c_ext_dir_on_zlo | Dirichlet condition on z-low face for cell data |
| [in] | c_ext_dir_on_zhi | Dirichlet condition on z-high face for cell data |
| [in] | u_ext_dir_on_zlo | Dirichlet condition on z-low face for u-velocity |
| [in] | u_ext_dir_on_zhi | Dirichlet condition on z-high face for u-velocity |
| [in] | v_ext_dir_on_zlo | Dirichlet condition on z-low face for v-velocity |
| [in] | v_ext_dir_on_zhi | Dirichlet condition on z-high face for v-velocity |
| [out] | dthetadz | computed vertical derivative of potential temperature |
| [out] | dudz | computed vertical derivative of x-velocity |
| [out] | dvdz | computed vertical derivative of y-velocity |
| [in] | moisture_indices | moisture variable component indices |
Referenced by ComputeDiffusivityMRF(), ComputeDiffusivityMYJ(), ComputeDiffusivityMYNN25(), ComputeDiffusivityMYNNEDMF(), ComputeDiffusivityYSU(), ComputeDiffusivityYSUNew(), and ComputeQKESourceTerms().

