|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include <AMReX_MultiFab.H>#include <AMReX_ArrayLim.H>#include "AMReX_BCRec.H"#include "ERF.H"#include "ERF_SrcHeaders.H"#include "ERF_DataStruct.H"#include "ERF_Utils.H"#include "ERF_EB.H"#include <ERF_EBSlopes.H>
Functions | |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real | dqdz_cc (int i, int j, int k, int klo, int khi, const Array4< const Real > &q_arr, const Array4< const Real > &z_cc_arr) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real | dqdz_cc_onesided (int i, int j, int k, int sgn, const Array4< const Real > &q_arr, const Array4< const Real > &z_cc_arr) |
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real | nonhydro_residual_cc (int i, int j, int k, int klo, int khi, const Real grav, const Array4< const Real > &p_arr, const Array4< const Real > &rp_arr, const Array4< const Real > &z_cc_arr) |
| void | make_gradp_pert (int level, const SolverChoice &solverChoice, const Geometry &geom, Vector< MultiFab > &S_data, const MultiFab &base_state, const MultiFab &qt, const MultiFab &z_phys_cc, Vector< std::unique_ptr< MultiFab >> &mapfac, const eb_ &ebfact, Vector< MultiFab > &gradp) |
| void | compute_gradp (int lev, const MultiFab &p, const Geometry &geom, const MultiFab &z_phys_cc, Vector< std::unique_ptr< MultiFab >> &mapfac, const eb_ &ebfact, Vector< MultiFab > &gradp, const SolverChoice &solverChoice) |
| Compute the full pressure gradient. More... | |
| void | compute_gradp_xy (const MultiFab &p, const Geometry &geom, const MultiFab &z_phys_cc, Vector< std::unique_ptr< MultiFab >> &mapfac, const eb_ &ebfact, Vector< MultiFab > &gradp, const SolverChoice &solverChoice) |
| Compute the horizontal components of the pressure gradient. More... | |
| void | compute_gradp_z (const MultiFab &p, const Geometry &geom, const MultiFab &z_phys_cc, const eb_ &ebfact, Vector< MultiFab > &gradp, const SolverChoice &solverChoice, bool use_zcc) |
| Compute the vertical component of the pressure gradient. More... | |
| void | compute_gradp_hse (const MultiFab &p, const MultiFab &rhopert, const Geometry &geom, const MultiFab &z_phys_cc, Vector< std::unique_ptr< MultiFab >> &mapfac, Vector< MultiFab > &gradp, const SolverChoice &solverChoice) |
| Compute the horizontal components of the pressure gradient, carrying the hydrostatic part of the perturbational pressure to the height of the face along dp'/dz = -g rho' and only the non-hydrostatic remainder along a difference of p'. More... | |
| void compute_gradp | ( | int | lev, |
| const MultiFab & | p, | ||
| const Geometry & | geom, | ||
| const MultiFab & | z_phys_cc, | ||
| Vector< std::unique_ptr< MultiFab >> & | mapfac, | ||
| const eb_ & | ebfact, | ||
| Vector< MultiFab > & | gradp, | ||
| const SolverChoice & | solverChoice | ||
| ) |
Compute the full pressure gradient.
| [in] | lev | Level of refinement. |
| [in] | p | Pressure field. |
| [in] | geom | Geometry container. |
| [in] | z_phys_cc | Physical height on cell centers. |
| [in] | mapfac | Map factors. |
| [in] | ebfact | EB factory. |
| [out] | gradp | Pressure gradient components. |
| [in] | solverChoice | Solver options. |
Referenced by ERF::compute_max_pressure_gradient_diagnostic(), and ERF::FillPlot3DVars().


| void compute_gradp_hse | ( | const MultiFab & | p, |
| const MultiFab & | rhopert, | ||
| const Geometry & | geom, | ||
| const MultiFab & | z_phys_cc, | ||
| Vector< std::unique_ptr< MultiFab >> & | mapfac, | ||
| Vector< MultiFab > & | gradp, | ||
| const SolverChoice & | solverChoice | ||
| ) |
Compute the horizontal components of the pressure gradient, carrying the hydrostatic part of the perturbational pressure to the height of the face along dp'/dz = -g rho' and only the non-hydrostatic remainder along a difference of p'.
At an x-face (i,j,k) the two cell centers that straddle the face sit at different physical heights, so each must be carried a signed distance
dz_int = 1/2 ( z_cc(i,j,k) - z_cc(i-1,j,k) )
to reach the height of the face. ChainRule does this with a centered difference of p'. Over steep terrain in nearly hydrostatic flow that difference is dominated by its hydrostatic part, dp'/dz ~ -g rho', which is large compared with the horizontal gradient being sought, so its truncation error dominates the answer. Here we split
dp'/dz = -g rho' + r, r = dp'/dz + g rho',
integrate the first term exactly over the segment and difference only r, so that
gpx = [p'(i,j,k) - p'(i-1,j,k)]/dx + met_h_xi * 1/2 * [(g rhot - r)(i,j,k) + (g rhot - r)(i-1,j,k)]
where met_h_xi = 2*dz_int/dx, rhot is rho' reconstructed linearly and evaluated at the midpoint of each of the two extrapolation segments, and r is formed in each column by nonhydro_residual_cc. Two properties follow:
Note that the stencil needs no branch on the sign of dz_int, since the formula is symmetric under dz_int -> -dz_int, and that it reaches only to k-1 and k+1.
| [in] | p | Perturbational pressure field. |
| [in] | rhopert | Perturbational (moist) density field. |
| [in] | geom | Geometry container. |
| [in] | z_phys_cc | Physical height on cell centers. |
| [in] | mapfac | Map factors. |
| [out] | gradp | Pressure gradient components. |
| [in] | solverChoice | Solver options. |
Referenced by make_gradp_pert().


| void compute_gradp_xy | ( | const MultiFab & | p, |
| const Geometry & | geom, | ||
| const MultiFab & | z_phys_cc, | ||
| Vector< std::unique_ptr< MultiFab >> & | mapfac, | ||
| const eb_ & | ebfact, | ||
| Vector< MultiFab > & | gradp, | ||
| const SolverChoice & | solverChoice | ||
| ) |
Compute the horizontal components of the pressure gradient.
| [in] | p | Pressure field. |
| [in] | geom | Geometry container. |
| [in] | z_phys_cc | Physical height on cell centers. |
| [in] | mapfac | Map factors. |
| [in] | ebfact | EB factory. |
| [out] | gradp | Pressure gradient components. |
| [in] | solverChoice | Solver options. |
Referenced by compute_gradp(), and make_gradp_pert().


| void compute_gradp_z | ( | const MultiFab & | p, |
| const Geometry & | geom, | ||
| const MultiFab & | z_phys_cc, | ||
| const eb_ & | ebfact, | ||
| Vector< MultiFab > & | gradp, | ||
| const SolverChoice & | solverChoice, | ||
| bool | use_zcc | ||
| ) |
Compute the vertical component of the pressure gradient.
| [in] | p | Pressure field. |
| [in] | geom | Geometry container. |
| [in] | z_phys_cc | Physical height on cell centers. |
| [in] | ebfact | EB factory. |
| [out] | gradp | Pressure gradient components. |
| [in] | solverChoice | Solver options. |
| [in] | use_zcc | Use the distance between the cell centers (z_phys_cc) rather than dz: SolverChoice::zcc_vertical_metric of the level |
Referenced by compute_gradp(), and make_gradp_pert().


| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real dqdz_cc | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | klo, | ||
| int | khi, | ||
| const Array4< const Real > & | q_arr, | ||
| const Array4< const Real > & | z_cc_arr | ||
| ) |
Vertical derivative of a cell-centered quantity, taken with respect to physical height. Centered in the interior of the domain, one-sided at the bottom and top.
| [in] | i | x-index |
| [in] | j | y-index |
| [in] | k | z-index |
| [in] | klo | lowest k index of the domain |
| [in] | khi | highest k index of the domain |
| [in] | q_arr | cell-centered quantity to differentiate |
| [in] | z_cc_arr | physical height at cell centers |
Referenced by compute_gradp_hse().

| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real dqdz_cc_onesided | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | sgn, | ||
| const Array4< const Real > & | q_arr, | ||
| const Array4< const Real > & | z_cc_arr | ||
| ) |
Second-order one-sided vertical derivative of a cell-centered quantity at the bottom (sgn = 1) or top (sgn = -1) cell center, taken with respect to physical height from the quadratic through cells k, k+sgn and k+2*sgn.
| [in] | i | x-index |
| [in] | j | y-index |
| [in] | k | z-index of the bottom or top cell |
| [in] | sgn | 1 at the bottom of the domain, -1 at the top |
| [in] | q_arr | cell-centered quantity to differentiate |
| [in] | z_cc_arr | physical height at cell centers |
Referenced by compute_gradp_xy().

| void make_gradp_pert | ( | int | level, |
| const SolverChoice & | solverChoice, | ||
| const Geometry & | geom, | ||
| Vector< MultiFab > & | S_data, | ||
| const MultiFab & | base_state, | ||
| const MultiFab & | qt, | ||
| const MultiFab & | z_phys_cc, | ||
| Vector< std::unique_ptr< MultiFab >> & | mapfac, | ||
| const eb_ & | ebfact, | ||
| Vector< MultiFab > & | gradp | ||
| ) |
Function for computing the pressure gradient
| [in] | level | level of resolution |
| [in] | geom | geometry container at this level |
| [in] | S_data | current solution |
| [in] | base_state | base state (r0, p0, pi0, th0, qv0) |
| [in] | qt | total water mixing ratio (zero if there is no moisture) |
| [in] | z_phys_cc | z on cell centers |
| [in] | d_bcrec_ptr | Boundary Condition Record |
| [in] | ebfact | EB factory container at this level |
| [out] | gradp | pressure gradient |
Referenced by ERF::compute_max_buoyancy_gradp_diagnostic().


| AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real nonhydro_residual_cc | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | klo, | ||
| int | khi, | ||
| const Real | grav, | ||
| const Array4< const Real > & | p_arr, | ||
| const Array4< const Real > & | rp_arr, | ||
| const Array4< const Real > & | z_cc_arr | ||
| ) |
Non-hydrostatic residual of the vertical pressure gradient, dp'/dz + g rho', brought to the cell center. On each w-face this residual is exactly gpz + buoyancy as the dycore forms them (with buoyancy_rhopert), so it vanishes wherever the w-equation sees no net vertical force. In the interior the two face values are combined with the same Delta z weighting that the centered difference of ChainRule implies; at the bottom and top the single interior face is used.
| [in] | i | x-index |
| [in] | j | y-index |
| [in] | k | z-index |
| [in] | klo | lowest k index of the domain |
| [in] | khi | highest k index of the domain |
| [in] | grav | magnitude of gravity |
| [in] | p_arr | perturbational pressure |
| [in] | rp_arr | perturbational density |
| [in] | z_cc_arr | physical height at cell centers |
Referenced by compute_gradp_hse().
