Project

EarthSciDiscretizations

The ESM discretization standard library: grids, finite-difference/finite-volume rewrite rules, regridding and reprojection expressions, with cross-language conformance goldens.

Contents

wrf_arw_c

The Arakawa C-grid of the WRF-ARW dynamical core (WRF 4.8 dyn_em) on its hybrid mass (eta) coordinate.

The Arakawa C-grid of the WRF-ARW dynamical core (WRF 4.8 dyn_em) on its hybrid mass (eta) coordinate. Mass points (mu, theta, moisture, p’, alpha) are the cells (x, y, lev) = WRF (i, j, k) with i = 1..ide-1, j = 1..jde-1, k = 1..kde-1; u lives on the x faces x_stag (NX+1 points, face i the WEST face of cell i), v on the y faces y_stag (NY+1, face j the SOUTH face of cell j), and w, the geopotential and the vertical mass flux ww on the eta interfaces lev_nodes (NLEV+1, node k the BOTTOM face of layer k, node 1 the ground and node NLEV+1 the model top). A cell owns its low faces, which is both WRF’s array convention and EarthSciIntegrator’s face convention (spec/run-config.md section 6.1). Along a PERIODIC x (or y) axis WRF still dimensions u with NX+1 points and its halo fill makes u[NX+1] = u[1]; the periodic rules here never read a duplicate point NX+1 (of the advected field or of the advecting flux): they wrap every read to 1..NX, so they are conservative whatever the consumer holds there. lev and lev_nodes are declared exactly as grids/column_nonuniform_1d declares them (layer 1 at the bottom, lev increasing upward), and x and y exactly as grids/cartesian_uniform_2d declares them, so a model that also imports column physics or 2-D rules dedupes the shared axes. SPACING: x and y are uniform (scalar rdx, rdy) and the eta levels are stretched (per-layer rdnw, per-interface fnm and fnp), so the grid is tagged spacing:nonuniform. CONSUMER-SUPPLIED GEOMETRY (AGENTS.md section 3: the integers are metaparameters, the reals are the consumer’s): the rules read the free names rdx and rdy (WRF’s 1/dx and 1/dy, scalars), rdnw [lev] (1/dnw, dnw = eta_w(k+1) - eta_w(k), NEGATIVE since eta falls with height, so (G[k+1] - G[k]) rdnw is the derivative with respect to eta), and fnm, fnp [lev_nodes] (WRF’s interpolation weights from the two adjacent layers to interface k: fnm weights layer k, fnp layer k-1). Further free names read by individual rules: rdn [lev_nodes] (WRF’s 1/dn, the reciprocal spacing of the mass levels, for the vertical advection of w), dnw [lev] (the layer thickness in eta, for the column integrals), and cf1, cf2, cf3 (WRF’s extrapolation weights from the lowest three layers to the ground, read by this file’s wrf_ground_extrap, which wrf_interp_lev, wrf_mid_lev and wrf_diff_lev_nodes apply), and cfn, cfn1 (WRF’s extrapolation weights from the top two layers to the lid, read by this file’s wrf_lid_extrap, which wrf_mid_lev applies). Map factors (msftx, msfty and the u- and v-point factors) and the hybrid-coordinate coefficients (c1h, c2h, c1f, c2f) multiply operators in the consuming component’s equations and are not read by these rules. ONE CLOSURE PER AXIS: each axis’s open and periodic rules (advection, wrf_diff*, and the wrf_avg* averages) match the same expressions at the same priority, so a model imports one closure per axis; with both imported the first declared would apply silently. STAGGERED PRODUCTS: a rule is scoped to the exact declared shapes of its operands (esm-spec 9.6.1 where), so an advecting mass flux that WRF averages to another point is the consumer’s observed on that point’s shape, e.g. (ru[i] + ru[i+1])/2 on [x, y, lev] for the advection of u along x, and a mass-point coefficient of a face term is averaged with wrf_avg_x / wrf_avg_y. WRF writes its advection in flux form on coupled variables: d(mu q)/dt = -m_x d(U q)/dx - m_y d(V q)/dy - d(W q)/deta with U = mu u/m_y (WRF ru), V = mu v/m_x (rv) and W = ww (rom); the advection rules lower the three derivatives of products; the momentum rules lower the same derivatives for u, v and w, with the advecting flux averaged to the faces of the momentum point’s control volume.

Metaparameters

NameTypeDefaultDescription
NLEVinteger64Number of eta layers (WRF kde - 1); the interfaces lev_nodes have NLEV+1 members. The third-order vertical rule needs NLEV >= 4.
NXinteger64Number of mass cells along x (WRF ide - 1); the x faces x_stag have NX+1 members. The fifth-order periodic x rule needs NX >= 6.
NYinteger64Number of mass cells along y (WRF jde - 1); the y faces y_stag have NY+1 members. The fifth-order periodic y rule needs NY >= 6.

All sizes are load-time metaparameters (esm-spec §9.7.6): rebind them at the import edge (or through the loader API) and the same files serve every resolution.

Consumer-supplied free names

cf1 cf2 cf3 cfn cfn1 dnw fnm fnp rdn rdnw rdx rdy

These names are supplied by the consuming model’s scope at evaluation (the keyed-factor / free-name geometry contract); they are neither metaparameters (load-time integers) nor template parameters (bound per apply site).

Index sets

NameKindSize
levinterval\(\mathit{NLEV}\)
lev_nodesinterval\(\mathit{NLEV} + 1\)
xinterval\(\mathit{NX}\)
x_staginterval\(\mathit{NX} + 1\)
yinterval\(\mathit{NY}\)
y_staginterval\(\mathit{NY} + 1\)

Geometry templates

TemplateParametersDefinitionDescription
wrf_ground_extrapf_1, f_2, f_3\(\mathit{cf1} f_{\mathrm{1}} + \mathit{cf2} f_{\mathrm{2}} + \mathit{cf3} f_{\mathrm{3}}\)WRF’s extrapolation of a layer field to the ground (interface 1) from the lowest three layers, f_1 the lowest: cf1 f_1 + cf2 f_2 + cf3 f_3, with the consumer’s free names cf1, cf2, cf3 (WRF’s weights from the lowest three half levels, module_initialize_*.F). wrf_interp_lev, wrf_mid_lev_u, wrf_mid_lev_v and wrf_diff_lev_nodes apply it at k = 1.
wrf_interface_interpf_k, f_km1, w_k, w_km1\(w_{\mathrm{k}} f_{\mathrm{k}} + w_{\mathrm{km1}} f_{\mathrm{km1}}\)WRF’s linear interpolation of a layer field to interface k from the two layers that share it, f_k (the layer above) and f_km1 (the layer below), with the consumer’s weights w_k = fnm[k] and w_km1 = fnp[k] (module_big_step_utilities_em.F and module_advect_em.F: fnm(k)*f(k) + fnp(k)*f(k-1)). The weights carry the stretching of the eta levels.
wrf_lid_extrapf_n, f_nm1\(\mathit{cfn} f_{\mathrm{n}} + \mathit{cfn1} f_{\mathrm{nm1}}\)WRF’s extrapolation of a layer field to the model top (interface NLEV+1) from the top two layers, f_n the top one: cfn f_n + cfn1 f_nm1, with the consumer’s free names cfn, cfn1 (WRF’s weights from the top two half levels). wrf_mid_lev_u and wrf_mid_lev_v apply it at k = NLEV+1.

Stencils

Interior-only, match-less templates importing grid.esm; the rules below wrap them with boundary-condition face regions into complete rewrite rules.

wrf_adv02_lev

op:advection order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv02_lev.esm

Parameters: W, q, i, j, k

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux2\_lev}(f_{\mathrm{k}} = q_{i, j, k + 1}, f_{\mathrm{km1}} = q_{i, j, k}, \mathit{vel} = W_{i, j, k + 1}, w_{\mathrm{k}} = \mathit{fnm}_{k + 1}, w_{\mathrm{km1}} = \mathit{fnp}_{k + 1}), F_{\mathrm{lo}} = 0, \mathit{rd} = \mathit{rdnw}_{k})$$

WRF’s vertical flux-form advection at the bottom layer (i, j, k = 1) of a layer field q (module_advect_em.F, vert_order = 3): wrf_flux_div(rdnw[k], 0, wrf_flux2_lev(W[k+1], q[k+1], q[k], fnm[k+1], fnp[k+1])), no flux through the ground (WRF vflux(kts) = 0) and the second-order interpolated flux through the interface above. W is the vertical mass flux on the interfaces lev_nodes. Used by wrf_adv3_lev, wrf_adv3_lev_u and wrf_adv3_lev_v; wrf_adv23_lev, wrf_adv32_lev and wrf_adv20_lev are the next layer up and the two top layers.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv20_lev

op:advection order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv20_lev.esm

Parameters: W, q, i, j, k

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = 0, F_{\mathrm{lo}} = \operatorname{wrf\_flux2\_lev}(f_{\mathrm{k}} = q_{i, j, k}, f_{\mathrm{km1}} = q_{i, j, k - 1}, \mathit{vel} = W_{i, j, k}, w_{\mathrm{k}} = \mathit{fnm}_{k}, w_{\mathrm{km1}} = \mathit{fnp}_{k}), \mathit{rd} = \mathit{rdnw}_{k})$$

WRF’s vertical flux-form advection at the top layer (i, j, k = NLEV) of a layer field q (module_advect_em.F, vert_order = 3): wrf_flux_div(rdnw[k], wrf_flux2_lev(W[k], q[k], q[k-1], fnm[k], fnp[k]), 0), the second-order interpolated flux through the interface below and no flux through the model top (WRF vflux(kte) = 0). The mirror of wrf_adv02_lev.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv23_lev

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv23_lev.esm

Parameters: W, q, i, j, k

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k + 1}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j, k - 1}, q_{\mathrm{p1}} = q_{i, j, k + 2}, s = -1, \mathit{vel} = W_{i, j, k + 1}), F_{\mathrm{lo}} = \operatorname{wrf\_flux2\_lev}(f_{\mathrm{k}} = q_{i, j, k}, f_{\mathrm{km1}} = q_{i, j, k - 1}, \mathit{vel} = W_{i, j, k}, w_{\mathrm{k}} = \mathit{fnm}_{k}, w_{\mathrm{km1}} = \mathit{fnp}_{k}), \mathit{rd} = \mathit{rdnw}_{k})$$

WRF’s vertical flux-form advection at the second layer (i, j, k = 2) of a layer field q (module_advect_em.F, vert_order = 3): wrf_flux_div(rdnw[k], wrf_flux2_lev(W[k], q[k], q[k-1], fnm[k], fnp[k]), wrf_flux3(W[k+1], q[k-1], q[k], q[k+1], q[k+2], s = -1)), the second-order interpolated flux through the interface below and the third-order flux through the interface above. See wrf_adv02_lev.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv23_x

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv23_x.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i + 1, j, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i - 1, j, k}, q_{\mathrm{p1}} = q_{i + 2, j, k}, s = 1, \mathit{vel} = V_{i + o_{\mathrm{vhi}}, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i - 1, j, k}, \mathit{vel} = V_{i + o_{\mathrm{vlo}}, j, k}), \mathit{rd} = \mathit{rdx})$$

WRF’s flux-form advection along x at the point (i, j, k) of a field q, the second point from a low open boundary (module_advect_em.F, open_xs with h_*_adv_order = 5, the degraded orders next to the edge): wrf_flux_div(rdx, wrf_flux2(V[i + o_vlo], q[i-1], q[i]), wrf_flux3(V[i + o_vhi], q[i-1], q[i], q[i+1], q[i+2], s = 1)), second order through the low face, third order through the high face. o_vlo and o_vhi place the advecting mass flux relative to the point (0 and 1 when q is on mass points and V on the x faces; -1 and 0 when q is u and V on mass points). wrf_adv35_x, wrf_adv53_x and wrf_adv32_x are the next point in and the two mirror points at the high boundary, and wrf_adv55_x is the interior.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv23_y

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv23_y.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j + 1, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j - 1, k}, q_{\mathrm{p1}} = q_{i, j + 2, k}, s = 1, \mathit{vel} = V_{i, j + o_{\mathrm{vhi}}, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j - 1, k}, \mathit{vel} = V_{i, j + o_{\mathrm{vlo}}, k}), \mathit{rd} = \mathit{rdy})$$

WRF’s flux-form advection along y at the point (i, j, k) of a field q, the second point from a low open y boundary (module_advect_em.F, open_ys with h_*_adv_order = 5): wrf_flux_div(rdy, wrf_flux2(V[j + o_vlo], q[j-1], q[j]), wrf_flux3(V[j + o_vhi], q[j-1], …, q[j+2], s = 1)), second order through the low face, third order through the high face. The y twin of wrf_adv23_x; see it for the offsets.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv32_lev

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv32_lev.esm

Parameters: W, q, i, j, k

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux2\_lev}(f_{\mathrm{k}} = q_{i, j, k + 1}, f_{\mathrm{km1}} = q_{i, j, k}, \mathit{vel} = W_{i, j, k + 1}, w_{\mathrm{k}} = \mathit{fnm}_{k + 1}, w_{\mathrm{km1}} = \mathit{fnp}_{k + 1}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j, k - 1}, q_{\mathrm{m2}} = q_{i, j, k - 2}, q_{\mathrm{p1}} = q_{i, j, k + 1}, s = -1, \mathit{vel} = W_{i, j, k}), \mathit{rd} = \mathit{rdnw}_{k})$$

WRF’s vertical flux-form advection at the second layer from the top (i, j, k = NLEV-1) of a layer field q (module_advect_em.F, vert_order = 3): wrf_flux_div(rdnw[k], wrf_flux3(W[k], q[k-2], q[k-1], q[k], q[k+1], s = -1), wrf_flux2_lev(W[k+1], q[k+1], q[k], fnm[k+1], fnp[k+1])), the third-order flux through the interface below and the second-order interpolated flux through the interface above. The mirror of wrf_adv23_lev.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv32_x

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv32_x.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i + 1, j, k}, q_{\mathrm{m1}} = q_{i, j, k}, \mathit{vel} = V_{i + o_{\mathrm{vhi}}, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i - 1, j, k}, q_{\mathrm{m2}} = q_{i - 2, j, k}, q_{\mathrm{p1}} = q_{i + 1, j, k}, s = 1, \mathit{vel} = V_{i + o_{\mathrm{vlo}}, j, k}), \mathit{rd} = \mathit{rdx})$$

WRF’s flux-form advection along x at the point (i, j, k) of a field q, the second point from a high open boundary (module_advect_em.F, open_xe with h_*_adv_order = 5, the degraded orders next to the edge): wrf_flux_div(rdx, wrf_flux3(V[i + o_vlo], q[i-2], q[i-1], q[i], q[i+1], s = 1), wrf_flux2(V[i + o_vhi], q[i], q[i+1])), third order through the low face, second order through the high face. The mirror of wrf_adv23_x; see it for the offsets.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv32_y

op:advection order:2 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv32_y.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j + 1, k}, q_{\mathrm{m1}} = q_{i, j, k}, \mathit{vel} = V_{i, j + o_{\mathrm{vhi}}, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j - 1, k}, q_{\mathrm{m2}} = q_{i, j - 2, k}, q_{\mathrm{p1}} = q_{i, j + 1, k}, s = 1, \mathit{vel} = V_{i, j + o_{\mathrm{vlo}}, k}), \mathit{rd} = \mathit{rdy})$$

WRF’s flux-form advection along y at the point (i, j, k) of a field q, the second point from a high open y boundary (module_advect_em.F, open_ye): wrf_flux_div(rdy, wrf_flux3(V[j + o_vlo], q[j-2], …, q[j+1], s = 1), wrf_flux2(V[j + o_vhi], q[j], q[j+1])). The y twin of wrf_adv32_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv33_lev

op:advection order:3 stencil width 5 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv33_lev.esm

Parameters: W, q, i, j, k, rd, o_wlo, o_whi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k + 1}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j, k - 1}, q_{\mathrm{p1}} = q_{i, j, k + 2}, s = -1, \mathit{vel} = W_{i, j, k + o_{\mathrm{whi}}}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j, k - 1}, q_{\mathrm{m2}} = q_{i, j, k - 2}, q_{\mathrm{p1}} = q_{i, j, k + 1}, s = -1, \mathit{vel} = W_{i, j, k + o_{\mathrm{wlo}}}), \mathit{rd} = \mathit{rd})$$

WRF’s third-order vertical flux-form advection at the point (i, j, k) of a field q (module_advect_em.F, vert_order = 3, the interior of the column): wrf_flux_div(rd, wrf_flux3(W[k + o_wlo], q[k-2], q[k-1], q[k], q[k+1], s = -1), wrf_flux3(W[k + o_whi], q[k-1], q[k], q[k+1], q[k+2], s = -1)), with s = -1 because eta falls with height, so WRF’s upwind side is reversed. o_wlo and o_whi place the vertical mass flux through the point’s low and high interfaces (0 and 1 when q is on layers and W on the interfaces lev_nodes; -1 and 0 when q is w on the interfaces and W is the flux averaged to layers), and rd is the point’s reciprocal eta spacing (rdnw[k] on layers, rdn[k] on interfaces). Used by wrf_adv3_lev, wrf_adv3_lev_u, wrf_adv3_lev_v and wrf_adv3_lev_w.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv35_x

op:advection order:3 stencil width 6 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv35_x.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{i + 1, j, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i - 1, j, k}, q_{\mathrm{m3}} = q_{i - 2, j, k}, q_{\mathrm{p1}} = q_{i + 2, j, k}, q_{\mathrm{p2}} = q_{i + 3, j, k}, \mathit{vel} = V_{i + o_{\mathrm{vhi}}, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i - 1, j, k}, q_{\mathrm{m2}} = q_{i - 2, j, k}, q_{\mathrm{p1}} = q_{i + 1, j, k}, s = 1, \mathit{vel} = V_{i + o_{\mathrm{vlo}}, j, k}), \mathit{rd} = \mathit{rdx})$$

WRF’s flux-form advection along x at the point (i, j, k) of a field q, the third point from a low open boundary (module_advect_em.F, open_xs with h_*_adv_order = 5, the degraded orders next to the edge): wrf_flux_div(rdx, wrf_flux3(V[i + o_vlo], q[i-2], q[i-1], q[i], q[i+1], s = 1), wrf_flux5(V[i + o_vhi], q[i-2], …, q[i+3])), third order through the low face, fifth order through the high face. See wrf_adv23_x for the offsets.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv35_y

op:advection order:3 stencil width 6 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv35_y.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{i, j + 1, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j - 1, k}, q_{\mathrm{m3}} = q_{i, j - 2, k}, q_{\mathrm{p1}} = q_{i, j + 2, k}, q_{\mathrm{p2}} = q_{i, j + 3, k}, \mathit{vel} = V_{i, j + o_{\mathrm{vhi}}, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j - 1, k}, q_{\mathrm{m2}} = q_{i, j - 2, k}, q_{\mathrm{p1}} = q_{i, j + 1, k}, s = 1, \mathit{vel} = V_{i, j + o_{\mathrm{vlo}}, k}), \mathit{rd} = \mathit{rdy})$$

WRF’s flux-form advection along y at the point (i, j, k) of a field q, the third point from a low open y boundary (module_advect_em.F, open_ys): wrf_flux_div(rdy, wrf_flux3(V[j + o_vlo], q[j-2], …, q[j+1], s = 1), wrf_flux5(V[j + o_vhi], q[j-2], …, q[j+3])). The y twin of wrf_adv35_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv53_x

op:advection order:3 stencil width 6 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv53_x.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i + 1, j, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i - 1, j, k}, q_{\mathrm{p1}} = q_{i + 2, j, k}, s = 1, \mathit{vel} = V_{i + o_{\mathrm{vhi}}, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i - 1, j, k}, q_{\mathrm{m2}} = q_{i - 2, j, k}, q_{\mathrm{m3}} = q_{i - 3, j, k}, q_{\mathrm{p1}} = q_{i + 1, j, k}, q_{\mathrm{p2}} = q_{i + 2, j, k}, \mathit{vel} = V_{i + o_{\mathrm{vlo}}, j, k}), \mathit{rd} = \mathit{rdx})$$

WRF’s flux-form advection along x at the point (i, j, k) of a field q, the third point from a high open boundary (module_advect_em.F, open_xe with h_*_adv_order = 5, the degraded orders next to the edge): wrf_flux_div(rdx, wrf_flux5(V[i + o_vlo], q[i-3], …, q[i+2]), wrf_flux3(V[i + o_vhi], q[i-1], q[i], q[i+1], q[i+2], s = 1)), fifth order through the low face, third order through the high face. The mirror of wrf_adv35_x; see wrf_adv23_x for the offsets.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv53_y

op:advection order:3 stencil width 6 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv53_y.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j + 1, k}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j - 1, k}, q_{\mathrm{p1}} = q_{i, j + 2, k}, s = 1, \mathit{vel} = V_{i, j + o_{\mathrm{vhi}}, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j - 1, k}, q_{\mathrm{m2}} = q_{i, j - 2, k}, q_{\mathrm{m3}} = q_{i, j - 3, k}, q_{\mathrm{p1}} = q_{i, j + 1, k}, q_{\mathrm{p2}} = q_{i, j + 2, k}, \mathit{vel} = V_{i, j + o_{\mathrm{vlo}}, k}), \mathit{rd} = \mathit{rdy})$$

WRF’s flux-form advection along y at the point (i, j, k) of a field q, the third point from a high open y boundary (module_advect_em.F, open_ye): wrf_flux_div(rdy, wrf_flux5(V[j + o_vlo], q[j-3], …, q[j+2]), wrf_flux3(V[j + o_vhi], q[j-1], …, q[j+2], s = 1)). The y twin of wrf_adv53_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv55_x

op:advection order:5 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv55_x.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi, o_m3, o_m2, o_m1, o_p1, o_p2, o_p3

$$\operatorname{wrf\_adv5\_cell}(U_{\mathrm{hi}} = V_{i + o_{\mathrm{vhi}}, j, k}, U_{\mathrm{lo}} = V_{i + o_{\mathrm{vlo}}, j, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i + o_{\mathrm{m1}}, j, k}, q_{\mathrm{m2}} = q_{i + o_{\mathrm{m2}}, j, k}, q_{\mathrm{m3}} = q_{i + o_{\mathrm{m3}}, j, k}, q_{\mathrm{p1}} = q_{i + o_{\mathrm{p1}}, j, k}, q_{\mathrm{p2}} = q_{i + o_{\mathrm{p2}}, j, k}, q_{\mathrm{p3}} = q_{i + o_{\mathrm{p3}}, j, k}, \mathit{rd} = \mathit{rdx})$$

WRF’s fifth-order flux-form advection along x at the point (i, j, k) of a field q (module_advect_em.F, h_*_adv_order = 5), with both of the point’s flux faces fifth order: wrf_adv5_cell(rdx, V[i + o_vlo], V[i + o_vhi], q[i + o_m3], q[i + o_m2], q[i + o_m1], q[i], q[i + o_p1], q[i + o_p2], q[i + o_p3]). The offsets say where along x each operand sits relative to the point: o_vlo and o_vhi the advecting mass flux through the point’s low and high flux faces (0 and 1 when q is on mass points and V on the x faces; -1 and 0 when q is u on the x faces and V on mass points), and o_m3..o_p3 the neighbours, -3..3 in the interior. A periodic rule binds the ends’ neighbours wrapped (o_m3 = NX - 3 at i = 1 reads q[NX - 2]), so the interior and every wrapped end point of every field apply this one stencil. A rule applies it inside an faq over the region’s points.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv55_y

op:advection order:5 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv55_y.esm

Parameters: V, q, i, j, k, o_vlo, o_vhi, o_m3, o_m2, o_m1, o_p1, o_p2, o_p3

$$\operatorname{wrf\_adv5\_cell}(U_{\mathrm{hi}} = V_{i, j + o_{\mathrm{vhi}}, k}, U_{\mathrm{lo}} = V_{i, j + o_{\mathrm{vlo}}, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j + o_{\mathrm{m1}}, k}, q_{\mathrm{m2}} = q_{i, j + o_{\mathrm{m2}}, k}, q_{\mathrm{m3}} = q_{i, j + o_{\mathrm{m3}}, k}, q_{\mathrm{p1}} = q_{i, j + o_{\mathrm{p1}}, k}, q_{\mathrm{p2}} = q_{i, j + o_{\mathrm{p2}}, k}, q_{\mathrm{p3}} = q_{i, j + o_{\mathrm{p3}}, k}, \mathit{rd} = \mathit{rdy})$$

WRF’s fifth-order flux-form advection along y at the point (i, j, k) of a field q (module_advect_em.F, h_*_adv_order = 5), with both of the point’s flux faces fifth order: wrf_adv5_cell(rdy, V[j + o_vlo], V[j + o_vhi], q[j + o_m3], q[j + o_m2], q[j + o_m1], q[j], q[j + o_p1], q[j + o_p2], q[j + o_p3]). The offsets say where along y each operand sits relative to the point: o_vlo and o_vhi the advecting mass flux through the point’s low and high flux faces (0 and 1 when q is on mass points and V on the y faces; -1 and 0 when q is v on the y faces and V on mass points), and o_m3..o_p3 the neighbours, -3..3 in the interior. A periodic rule binds the ends’ neighbours wrapped (o_m3 = NY - 3 at j = 1 reads q[NY - 2]). The y twin of wrf_adv55_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_adv5_cell

op:advection order:5 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_adv5_cell.esm

Parameters: rd, U_lo, U_hi, q_m3, q_m2, q_m1, q_0, q_p1, q_p2, q_p3

$$\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{\mathrm{p1}}, q_{\mathrm{m1}} = q_{\mathrm{0}}, q_{\mathrm{m2}} = q_{\mathrm{m1}}, q_{\mathrm{m3}} = q_{\mathrm{m2}}, q_{\mathrm{p1}} = q_{\mathrm{p2}}, q_{\mathrm{p2}} = q_{\mathrm{p3}}, \mathit{vel} = U_{\mathrm{hi}}), F_{\mathrm{lo}} = \operatorname{wrf\_flux5}(q_{\mathrm{0}} = q_{\mathrm{0}}, q_{\mathrm{m1}} = q_{\mathrm{m1}}, q_{\mathrm{m2}} = q_{\mathrm{m2}}, q_{\mathrm{m3}} = q_{\mathrm{m3}}, q_{\mathrm{p1}} = q_{\mathrm{p1}}, q_{\mathrm{p2}} = q_{\mathrm{p2}}, \mathit{vel} = U_{\mathrm{lo}}), \mathit{rd} = \mathit{rd})$$

WRF’s fifth-order flux-form advection at one cell along one horizontal axis (module_advect_em.F advect_scalar, h_sca_adv_order = 5): wrf_flux_div(rd, F_lo, F_hi) with F_lo = wrf_flux5(U_lo, q_m3, …, q_p2) the flux through the cell’s low face and F_hi = wrf_flux5(U_hi, q_m2, …, q_p3) through its high face. q_0 is the cell, q_m3..q_m1 and q_p1..q_p3 its neighbours toward the low and the high end, U_lo and U_hi the face mass fluxes, rd the reciprocal spacing (rdx or rdy). wrf_adv55_x and wrf_adv55_y bind it at a grid point, with the neighbours at plain offsets in the interior and wrapped at the ends of a periodic axis, so every point of either axis spells the same scheme.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_avg_lev

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_lev.esm

Parameters: f

$$\left[\sum\limits0.5 \left(f_{i, j, k} + f_{i, j, k + 1}\right)\right]_{i \in x, j \in y, k \in \mathit{lev}}$$

The WRF-ARW mean of an interface field over each layer: wrf_avg_lev(f) for f [x, y, lev_nodes] is (f[k] + f[k+1])/2 on layer k, shape [x, y, lev]. It is the layer-mean geopotential of horizontal_pressure_gradient, whose geopotential term (ph(i,k+1)-ph(i-1,k+1) + ph(i,k)-ph(i-1,k))0.5rdx is partial(wrf_avg_lev(ph), x): the same number up to the order of two floating-point additions.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_2d_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_2d_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j} + f_{i, j}\right)\right]_{2 \le i \le \mathit{NX}, j \in y} & [2, \mathit{NX}] \times [1, \mathit{NY}] \\ \left[\sum\limits f_{1, j}\right]_{1 \le i \le 1, j \in y} & [1, 1] \times [1, \mathit{NY}] \\ \left[\sum\limits f_{\mathit{NX}, j}\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a horizontal (column) field onto the x faces: wrf_avg_x(f) for f [x, y] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y]. One of the overloads of wrf_avg_x, scoped by the exact shape of its operand. Uses: the Coriolis parameters at the faces of the momentum they turn (module_big_step_utilities_em.F coriolis: 0.5*(f(i,j)+f(i-1,j)), 0.5*(e(i,j)+e(i-1,j)) and 0.5*(cosa(i,j)+cosa(i-1,j)) at a u face, the same along y at a v face). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (calc_mu_uv’s convention), as wrf_avg_x_open does for a 3-D field. WRF’s Coriolis term, the use here, skips the edge faces of an open boundary.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_2d_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_2d_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j} + f_{i, j}\right)\right]_{2 \le i \le \mathit{NX}, j \in y} & [2, \mathit{NX}] \times [1, \mathit{NY}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j} + f_{1, j}\right)\right]_{1 \le i \le 1, j \in y} & [1, 1] \times [1, \mathit{NY}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j} + f_{1, j}\right)\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a horizontal (column) field onto the x faces: wrf_avg_x(f) for f [x, y] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y]. One of the overloads of wrf_avg_x, scoped by the exact shape of its operand. Uses: the Coriolis parameters at the faces of the momentum they turn (module_big_step_utilities_em.F coriolis: 0.5*(f(i,j)+f(i-1,j)), 0.5*(e(i,j)+e(i-1,j)) and 0.5*(cosa(i,j)+cosa(i-1,j)) at a u face, the same along y at a v face). PERIODIC: the edge faces 1 and NX+1 (the same face) average cells NX and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{1, j, k}\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{\mathit{NX}, j, k}\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y, lev] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y, lev]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y, lev] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y, lev]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NX+1 (the same face) average cells NX and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_u

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_u.esm

Parameters: f

$$\left[\sum\limits0.5 \left(f_{i, j, k} + f_{i + 1, j, k}\right)\right]_{1 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}}$$

The WRF-ARW C-grid average along x of a field on the x faces onto the cells: wrf_avg_x(f) for f [x_stag, y, lev] is (f[i] + f[i+1])/2 on cell i, shape [x, y, lev]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). Every cell has both of its faces, so no boundary condition is involved.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_v_2d_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_v_2d_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i - 1, j})\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \\ \left[\sum\limits f_{1, j}\right]_{1 \le i \le 1, j \in y_{\mathrm{stag}}} & [1, 1] \times [1, \mathit{NY} + 1] \\ \left[\sum\limits f_{\mathit{NX}, j}\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along x of a horizontal field on the v points onto the corners of the horizontal grid: wrf_avg_x(f) for f [x, y_stag] is (f[i-1] + f[i])/2 on corner i, shape [x_stag, y_stag]. One of the overloads of wrf_avg_x, scoped by the exact shape of its operand. Use: the map-factor ratio at a corner in WRF’s constant-K diffusion of v (module_big_step_utilities_em.F horizontal_diffusion ‘v’: (msfvx(i,j)+msfvx(i-1,j))/(msfvy(i,j)+msfvy(i-1,j)), the ratio of two such averages). OPEN or specified boundaries: an edge face takes the value of the one point it touches, as wrf_avg_x_2d_open does; WRF’s diffusion, the use here, does not diffuse the points next to an open edge, so it never reads them. The interior faces apply the two-point mean wrf_mean2_cell.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_avg_x_v_2d_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_v_2d_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i - 1, j})\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \\ \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i + \left(\mathit{NX} - 1\right), j})\right]_{1 \le i \le 1, j \in y_{\mathrm{stag}}} & [1, 1] \times [1, \mathit{NY} + 1] \\ \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i - \mathit{NX}, j}, f_{\mathrm{lo}} = f_{i - 1, j})\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along x of a horizontal field on the v points onto the corners of the horizontal grid: wrf_avg_x(f) for f [x, y_stag] is (f[i-1] + f[i])/2 on corner i, shape [x_stag, y_stag]. One of the overloads of wrf_avg_x, scoped by the exact shape of its operand. Use: the map-factor ratio at a corner in WRF’s constant-K diffusion of v (module_big_step_utilities_em.F horizontal_diffusion ‘v’: (msfvx(i,j)+msfvx(i-1,j))/(msfvy(i,j)+msfvy(i-1,j)), the ratio of two such averages). PERIODIC (periodic_x): the edge faces 1 and NX+1 are the same face, (f[NX] + f[1])/2. Every face applies the two-point mean wrf_mean2_cell; the seam faces bind the wrapped neighbour by offset from the loop index, f[i + NX - 1] at face 1 and f[i - NX] at face NX+1.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_avg_x_v_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_v_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{1, j, k}\right]_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{\mathit{NX}, j, k}\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y_stag, lev] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y_stag, lev]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_v_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_v_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y_stag, lev] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y_stag, lev]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NX+1 (the same face) average cells NX and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_w_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_w_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits f_{1, j, k}\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits f_{\mathit{NX}, j, k}\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y, lev_nodes] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y, lev_nodes]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_x_w_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_x_w_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i - 1, j, k} + f_{i, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits0.5 \left(f_{\mathit{NX}, j, k} + f_{1, j, k}\right)\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along x of a field on the cells along x onto the x faces: wrf_avg_x(f) for f [x, y, lev_nodes] is (f[i-1] + f[i])/2 on face i, shape [x_stag, y, lev_nodes]. One of the overloads of wrf_avg_x, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NX+1 (the same face) average cells NX and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_2d_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_2d_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1} + f_{i, j}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \\ \left[\sum\limits f_{i, 1}\right]_{i \in x, 1 \le j \le 1} & [1, \mathit{NX}] \times [1, 1] \\ \left[\sum\limits f_{i, \mathit{NY}}\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a horizontal (column) field onto the y faces: wrf_avg_y(f) for f [x, y] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag]. One of the overloads of wrf_avg_y, scoped by the exact shape of its operand. Uses: the Coriolis parameters at the faces of the momentum they turn (module_big_step_utilities_em.F coriolis: 0.5*(f(i,j)+f(i-1,j)), 0.5*(e(i,j)+e(i-1,j)) and 0.5*(cosa(i,j)+cosa(i-1,j)) at a u face, the same along y at a v face). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (calc_mu_uv’s convention), as wrf_avg_y_open does for a 3-D field. WRF’s Coriolis term, the use here, skips the edge faces of an open boundary.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_2d_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_2d_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1} + f_{i, j}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}} + f_{i, 1}\right)\right]_{i \in x, 1 \le j \le 1} & [1, \mathit{NX}] \times [1, 1] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}} + f_{i, 1}\right)\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a horizontal (column) field onto the y faces: wrf_avg_y(f) for f [x, y] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag]. One of the overloads of wrf_avg_y, scoped by the exact shape of its operand. Uses: the Coriolis parameters at the faces of the momentum they turn (module_big_step_utilities_em.F coriolis: 0.5*(f(i,j)+f(i-1,j)), 0.5*(e(i,j)+e(i-1,j)) and 0.5*(cosa(i,j)+cosa(i-1,j)) at a u face, the same along y at a v face). PERIODIC: the edge faces 1 and NY+1 (the same face) average cells NY and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{i, 1, k}\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{i, \mathit{NY}, k}\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x, y, lev] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag, lev]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x, y, lev] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag, lev]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NY+1 (the same face) average cells NY and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_u_2d_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_u_2d_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i, j - 1})\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \\ \left[\sum\limits f_{i, 1}\right]_{i \in x_{\mathrm{stag}}, 1 \le j \le 1} & [1, \mathit{NX} + 1] \times [1, 1] \\ \left[\sum\limits f_{i, \mathit{NY}}\right]_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a horizontal field on the u points onto the corners of the horizontal grid: wrf_avg_y(f) for f [x_stag, y] is (f[j-1] + f[j])/2 on corner j, shape [x_stag, y_stag]. One of the overloads of wrf_avg_y, scoped by the exact shape of its operand. Use: the map-factor ratio at a corner in WRF’s constant-K diffusion of u (module_big_step_utilities_em.F horizontal_diffusion ‘u’: (msfuy(i,j)+msfuy(i,j-1))/(msfux(i,j)+msfux(i,j-1)), the ratio of two such averages). OPEN or specified boundaries: an edge face takes the value of the one point it touches, as wrf_avg_y_2d_open does; WRF’s diffusion, the use here, does not diffuse the points next to an open edge, so it never reads them. The interior faces apply the two-point mean wrf_mean2_cell.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_avg_y_u_2d_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_u_2d_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i, j - 1})\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \\ \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j}, f_{\mathrm{lo}} = f_{i, j + \left(\mathit{NY} - 1\right)})\right]_{i \in x_{\mathrm{stag}}, 1 \le j \le 1} & [1, \mathit{NX} + 1] \times [1, 1] \\ \left[\sum\limits\operatorname{wrf\_mean2\_cell}(f_{\mathrm{hi}} = f_{i, j - \mathit{NY}}, f_{\mathrm{lo}} = f_{i, j - 1})\right]_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a horizontal field on the u points onto the corners of the horizontal grid: wrf_avg_y(f) for f [x_stag, y] is (f[j-1] + f[j])/2 on corner j, shape [x_stag, y_stag]. One of the overloads of wrf_avg_y, scoped by the exact shape of its operand. Use: the map-factor ratio at a corner in WRF’s constant-K diffusion of u (module_big_step_utilities_em.F horizontal_diffusion ‘u’: (msfuy(i,j)+msfuy(i,j-1))/(msfux(i,j)+msfux(i,j-1)), the ratio of two such averages). PERIODIC (periodic_y): the edge faces 1 and NY+1 are the same face, (f[NY] + f[1])/2. Every face applies the two-point mean wrf_mean2_cell; the seam faces bind the wrapped neighbour by offset from the loop index, f[j + NY - 1] at face 1 and f[j - NY] at face NY+1.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_avg_y_u_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_u_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{i, 1, k}\right]_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits f_{i, \mathit{NY}, k}\right]_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x_stag, y, lev] is (f[j-1] + f[j])/2 on face j, shape [x_stag, y_stag, lev]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_u_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_u_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x_stag, y, lev] is (f[j-1] + f[j])/2 on face j, shape [x_stag, y_stag, lev]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NY+1 (the same face) average cells NY and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_v

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_v.esm

Parameters: f

$$\left[\sum\limits0.5 \left(f_{i, j, k} + f_{i, j + 1, k}\right)\right]_{i \in x, 1 \le j \le \mathit{NY}, k \in \mathit{lev}}$$

The WRF-ARW C-grid average along y of a field on the y faces onto the cells: wrf_avg_y(f) for f [x, y_stag, lev] is (f[j] + f[j+1])/2 on cell j, shape [x, y, lev]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). Every cell has both of its faces, so no boundary condition is involved.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_w_open

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_w_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits f_{i, 1, k}\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits f_{i, \mathit{NY}, k}\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x, y, lev_nodes] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag, lev_nodes]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). OPEN or specified boundaries: an edge face takes the value of the one cell it touches (WRF’s calc_mu_uv convention for mu on an edge face). Where WRF reads a halo value instead, the edge face is one WRF does not prognose with this average on an open edge.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_avg_y_w_periodic

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_avg_y_w_periodic.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j - 1, k} + f_{i, j, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits0.5 \left(f_{i, \mathit{NY}, k} + f_{i, 1, k}\right)\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid average along y of a field on the cells along y onto the y faces: wrf_avg_y(f) for f [x, y, lev_nodes] is (f[j-1] + f[j])/2 on face j, shape [x, y_stag, lev_nodes]. One of the overloads of wrf_avg_y, each scoped to the exact shape of its operand (esm-spec 9.6.1 where). Uses: a mass-point coefficient of a face term, as in WRF’s 0.5*(alt(i)+alt(i-1))(p(i)-p(i-1))rdx in horizontal_pressure_gradient, which is wrf_avg_x(alt) * partial(p, x); and the advecting mass flux of a momentum component, averaged to the faces of that component’s control volume (module_advect_em.F: 0.5(ru(i)+ru(i-1)) for u along x, 0.5(rv(i)+rv(i-1)) for u along y, 0.5*(rom(i)+rom(i-1)) for u along eta, and so on). PERIODIC: the edge faces 1 and NY+1 (the same face) average cells NY and 1, as WRF’s halo makes them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_flux2

op:advection order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_flux2.esm

Parameters: vel, q_m1, q_0

$$\mathit{vel} \frac{q_{\mathrm{m1}} + q_{\mathrm{0}}}{2}$$

WRF’s second-order centred face flux, used next to an open boundary, and next to the ground and the lid for w (a layer field’s flux there is wrf_flux2_lev): vel (q_m1 + q_0)/2 through the face between q_m1 (the low side) and q_0 (the high side), with the mass flux vel through that face (module_advect_em.F: 0.5ru(i)(q(i)+q(i-1)) for a scalar, 0.25*(ru(i)+ru(i-1))(u(i)+u(i-1)) for u, whose advecting flux the consumer has already averaged to the mass point, and 0.25(rom(k)+rom(k-1))*(w(k)+w(k-1)) for w).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_flux2_lev

op:advection order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_flux2_lev.esm

Parameters: vel, f_k, f_km1, w_k, w_km1

$$\mathit{vel} \operatorname{wrf\_interface\_interp}(f_{\mathrm{k}} = f_{\mathrm{k}}, f_{\mathrm{km1}} = f_{\mathrm{km1}}, w_{\mathrm{k}} = w_{\mathrm{k}}, w_{\mathrm{km1}} = w_{\mathrm{km1}})$$

WRF’s second-order interface flux of a layer field next to a vertical boundary (module_advect_em.F advect_scalar, vflux(k) = rom(k)*(fnm(k)*field(k) + fnp(k)*field(k-1)) at k = kts+1 and k = ktf): the mass flux vel through interface k times the layer field interpolated to that interface by the grid’s wrf_interface_interp, f_k the layer above, f_km1 the layer below, with the consumer’s weights w_k = fnm[k] and w_km1 = fnp[k]. Not to be confused with wrf_flux2, the centred flux with equal weights that the horizontal open boundaries and the vertical advection of w use.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_flux3

op:advection order:3 stencil width 4 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_flux3.esm

Parameters: vel, q_m2, q_m1, q_0, q_p1, s

$$\mathit{vel} \frac{7 \left(q_{\mathrm{0}} + q_{\mathrm{m1}}\right) - \left(q_{\mathrm{p1}} + q_{\mathrm{m2}}\right)}{12} + \frac{s \left|\mathit{vel}\right| \left(q_{\mathrm{p1}} - q_{\mathrm{m2}} - 3 \left(q_{\mathrm{0}} - q_{\mathrm{m1}}\right)\right)}{12}$$

WRF’s third-order upwind-biased face flux (module_advect_em.F, flux4 and flux3, fq = velflux3(q_{i-2}, q_{i-1}, q_i, q_{i+1}, svel)) through the face between q_m1 and q_0: vel (7 (q_0 + q_m1) - (q_p1 + q_m2))/12 + s |vel| ((q_p1 - q_m2) - 3 (q_0 - q_m1))/12, the fourth-order centred flux plus its upwind dissipation. s = +1 along a horizontal axis, where a positive mass flux blows from the low cell q_m1 to the high cell q_0; s = -1 along eta: WRF’s vertical sweep calls flux3(q_{k-2}, q_{k-1}, q_k, q_{k+1}, -rom), because ww > 0 is DOWNWARD motion (eta increases toward the ground), so the upwind cell of interface k is the layer above it, q_0. vel s sign(1., s vel) = s |vel|.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_flux5

op:advection order:5 stencil width 6 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_flux5.esm

Parameters: vel, q_m3, q_m2, q_m1, q_0, q_p1, q_p2

$$\mathit{vel} \frac{37 \left(q_{\mathrm{0}} + q_{\mathrm{m1}}\right) + -8 \left(q_{\mathrm{p1}} + q_{\mathrm{m2}}\right) + \left(q_{\mathrm{p2}} + q_{\mathrm{m3}}\right)}{60} - \frac{\left|\mathit{vel}\right| \left(\left(q_{\mathrm{p2}} - q_{\mathrm{m3}}\right) + -5 \left(q_{\mathrm{p1}} - q_{\mathrm{m2}}\right) + 10 \left(q_{\mathrm{0}} - q_{\mathrm{m1}}\right)\right)}{60}$$

WRF’s fifth-order upwind-biased face flux (module_advect_em.F, the statement functions flux6 and flux5 and their use fq = vel*flux5(q_{i-3}, …, q_{i+2}, vel)) through the face between q_m1 (the cell on the low side) and q_0 (the high side), with the mass flux vel through that face: vel (37 (q_0 + q_m1) - 8 (q_p1 + q_m2) + (q_p2 + q_m3))/60 - |vel| ((q_p2 - q_m3) - 5 (q_p1 - q_m2) + 10 (q_0 - q_m1))/60. The first term is the sixth-order centred flux and the second its upwind dissipation: WRF writes the dissipation as sign(1., vel) * (…) inside flux5 and multiplies by vel outside, and vel sign(1, vel) = |vel| (at vel = 0 both are zero), so the upwind bias needs no branch.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_flux_div

op:advection stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_flux_div.esm

Parameters: rd, F_lo, F_hi

$$\mathit{rd} \left(F_{\mathrm{hi}} - F_{\mathrm{lo}}\right)$$

The flux-form divergence WRF applies at every cell of every advection sweep (module_advect_em.F: tendency -= rd*(fq(i+1) - fq(i)), and the same for j and for the vertical with rdzw): rd (F_hi - F_lo), the difference of the face fluxes through a cell’s high face F_hi and low face F_lo times the reciprocal spacing rd (rdx, rdy, or rdnw[k] along eta). A boundary face with no flux (WRF’s vflux(kts) = vflux(kte) = 0) is a literal 0.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_interior_x_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_x_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{2 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev}} & [2, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) x boundary leaves out of a process WRF does not apply at the edge, on the mass points [x, y, lev]: wrf_interior_x(f) is f with the first and last point along x set to 0 (points 1 and NX of x), the rest unchanged. One of the four overloads of wrf_interior_x_open, scoped by the exact shape of the operand; the others are wrf_interior_x_u_open, wrf_interior_x_v_open, wrf_interior_x_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_x_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_x_periodic

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_x_periodic.esm

Parameters: f

$$f$$

The points a PERIODIC x boundary leaves out of a process that WRF skips at the edge points of an open or specified boundary: none. wrf_interior_x(f) is f itself, for f of any shape. The periodic twin of the four shape overloads wrf_interior_x_open, wrf_interior_x_u_open, wrf_interior_x_v_open and wrf_interior_x_w_open; see there.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_x_u_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_x_u_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) x boundary leaves out of a process WRF does not apply at the edge, on the u points [x_stag, y, lev]: wrf_interior_x(f) is f with the first and last point along x set to 0 (faces 1 and NX+1 of x_stag), the rest unchanged. One of the four overloads of wrf_interior_x_open, scoped by the exact shape of the operand; the others are wrf_interior_x_open, wrf_interior_x_v_open, wrf_interior_x_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_x_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_x_v_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_x_v_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{2 \le i \le \mathit{NX} - 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, \mathit{NX} - 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) x boundary leaves out of a process WRF does not apply at the edge, on the v points [x, y_stag, lev]: wrf_interior_x(f) is f with the first and last point along x set to 0 (points 1 and NX of x), the rest unchanged. One of the four overloads of wrf_interior_x_open, scoped by the exact shape of the operand; the others are wrf_interior_x_open, wrf_interior_x_u_open, wrf_interior_x_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_x_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_x_w_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_x_w_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{2 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev\_nodes}} & [2, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The points an OPEN (or specified, or nested) x boundary leaves out of a process WRF does not apply at the edge, on the w points [x, y, lev_nodes]: wrf_interior_x(f) is f with the first and last point along x set to 0 (points 1 and NX of x), the rest unchanged. One of the four overloads of wrf_interior_x_open, scoped by the exact shape of the operand; the others are wrf_interior_x_open, wrf_interior_x_u_open, wrf_interior_x_v_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_x_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_y_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_y_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{i \in x, 2 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) y boundary leaves out of a process WRF does not apply at the edge, on the mass points [x, y, lev]: wrf_interior_y(f) is f with the first and last point along y set to 0 (points 1 and NY of y), the rest unchanged. One of the four overloads of wrf_interior_y_open, scoped by the exact shape of the operand; the others are wrf_interior_y_u_open, wrf_interior_y_v_open, wrf_interior_y_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_y_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_y_periodic

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_y_periodic.esm

Parameters: f

$$f$$

The points a PERIODIC y boundary leaves out of a process that WRF skips at the edge points of an open or specified boundary: none. wrf_interior_y(f) is f itself, for f of any shape. The periodic twin of the four shape overloads wrf_interior_y_open, wrf_interior_y_u_open, wrf_interior_y_v_open and wrf_interior_y_w_open; see there.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_y_u_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_y_u_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) y boundary leaves out of a process WRF does not apply at the edge, on the u points [x_stag, y, lev]: wrf_interior_y(f) is f with the first and last point along y set to 0 (points 1 and NY of y), the rest unchanged. One of the four overloads of wrf_interior_y_open, scoped by the exact shape of the operand; the others are wrf_interior_y_open, wrf_interior_y_v_open, wrf_interior_y_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_y_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_y_v_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_y_v_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The points an OPEN (or specified, or nested) y boundary leaves out of a process WRF does not apply at the edge, on the v points [x, y_stag, lev]: wrf_interior_y(f) is f with the first and last point along y set to 0 (faces 1 and NY+1 of y_stag), the rest unchanged. One of the four overloads of wrf_interior_y_open, scoped by the exact shape of the operand; the others are wrf_interior_y_open, wrf_interior_y_u_open, wrf_interior_y_w_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_y_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interior_y_w_open

op:mask stencil width 1 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interior_y_w_open.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits f_{i, j, k}\right]_{i \in x, 2 \le j \le \mathit{NY} - 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, \mathit{NY} - 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The points an OPEN (or specified, or nested) y boundary leaves out of a process WRF does not apply at the edge, on the w points [x, y, lev_nodes]: wrf_interior_y(f) is f with the first and last point along y set to 0 (points 1 and NY of y), the rest unchanged. One of the four overloads of wrf_interior_y_open, scoped by the exact shape of the operand; the others are wrf_interior_y_open, wrf_interior_y_u_open, wrf_interior_y_v_open. An open-boundary consumer imports all four. This is the loop range WRF’s constant-K diffusion takes on such a boundary (module_big_step_utilities_em.F horizontal_diffusion and horizontal_diffusion_3dmp: i_start = ids+1 and i_end = ide-2 for a mass point, ide-1 for a u face, when open_xs/open_xe or specified; the same along y; vertical_diffusion_u restricts x and vertical_diffusion_v y in the same way): the edge cells are not diffused at all, not merely given a zero flux through the boundary face. The periodic twin wrf_interior_y_periodic is the identity for every shape; import either the four open overloads or the periodic twin, not both.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_interp_flux_lev_u

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interp_flux_lev_u.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_interface\_interp}(f_{\mathrm{k}} = f_{i, j, k}, f_{\mathrm{km1}} = f_{i, j, k - 1}, w_{\mathrm{k}} = \mathit{fnm}_{k}, w_{\mathrm{km1}} = \mathit{fnp}_{k})\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, 1 \le k \le 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\left(\left(2 - \mathit{fnm}_{\mathit{NLEV}}\right) f_{i, j, \mathit{NLEV}} - \mathit{fnp}_{\mathit{NLEV}} f_{i, j, \mathit{NLEV} - 1}\right)\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a horizontal mass flux from the layers to the w levels, the advecting flux of module_advect_em.F advect_w: wrf_interp_flux_lev(f) for f [x_stag, y, lev] gives fnm[k] f[k] + fnp[k] f[k-1] on the interior interfaces k = 2..NLEV (WRF vel = fzm(k)*ru(i,k,j)+fzp(k)*ru(i,k-1,j)), WRF’s linear extrapolation (2 - fnm[NLEV]) f[NLEV] - fnp[NLEV] f[NLEV-1] to the model top k = NLEV+1, and 0 at the ground (k = 1, where WRF does not advect w), shape [x_stag, y, lev_nodes]. One of the overloads of wrf_interp_flux_lev, scoped by the exact shape of its operand.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_interp_flux_lev_v

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interp_flux_lev_v.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_interface\_interp}(f_{\mathrm{k}} = f_{i, j, k}, f_{\mathrm{km1}} = f_{i, j, k - 1}, w_{\mathrm{k}} = \mathit{fnm}_{k}, w_{\mathrm{km1}} = \mathit{fnp}_{k})\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [2, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, 1] \\ \left[\sum\left(\left(2 - \mathit{fnm}_{\mathit{NLEV}}\right) f_{i, j, \mathit{NLEV}} - \mathit{fnp}_{\mathit{NLEV}} f_{i, j, \mathit{NLEV} - 1}\right)\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a horizontal mass flux from the layers to the w levels, the advecting flux of module_advect_em.F advect_w: wrf_interp_flux_lev(f) for f [x, y_stag, lev] gives fnm[k] f[k] + fnp[k] f[k-1] on the interior interfaces k = 2..NLEV (WRF vel = fzm(k)*ru(i,k,j)+fzp(k)*ru(i,k-1,j)), WRF’s linear extrapolation (2 - fnm[NLEV]) f[NLEV] - fnp[NLEV] f[NLEV-1] to the model top k = NLEV+1, and 0 at the ground (k = 1, where WRF does not advect w), shape [x, y_stag, lev_nodes]. One of the overloads of wrf_interp_flux_lev, scoped by the exact shape of its operand.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_interp_lev

op:interpolation order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_interp_lev.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_interface\_interp}(f_{\mathrm{k}} = f_{i, j, k}, f_{\mathrm{km1}} = f_{i, j, k - 1}, w_{\mathrm{k}} = \mathit{fnm}_{k}, w_{\mathrm{km1}} = \mathit{fnp}_{k})\right]^{\{f\}}_{i \in x, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum0\right]^{\{f\}}_{i \in x, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a layer field to the interfaces with WRF’s closures: wrf_interp_lev(f) for f [x, y, lev] gives, on interface k of lev_nodes, fnm[k] f[k] + fnp[k] f[k-1] for k = 2..NLEV (wrf_interface_interp), the extrapolation wrf_ground_extrap (grid.esm), cf1 f[1] + cf2 f[2] + cf3 f[3], to the ground (k = 1; cf1, cf2, cf3 are the consumer’s free names, WRF’s cf1/cf2/cf3 from the lowest three half levels), and 0 at the model top (k = NLEV+1), as horizontal_pressure_gradient’s dpn has it for a pressure field without top_lid (with top_lid WRF extrapolates there with cfn, cfn1; a separate variant when needed). The x average of the dpn of horizontal_pressure_gradient is wrf_avg_x of the vertical derivative of this field, wrf_avg_x(partial(wrf_interp_lev(p), lev)), equal up to the order of the floating-point operations.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_mean2_cell

op:interpolation order:2 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_mean2_cell.esm

Parameters: f_lo, f_hi

$$0.5 \left(f_{\mathrm{lo}} + f_{\mathrm{hi}}\right)$$

The equal-weight two-point mean WRF takes to move a coefficient half a cell along one horizontal axis (module_big_step_utilities_em.F horizontal_diffusion: 0.5*(msfuy(i,j)+msfuy(i,j-1)) and the like): (f_lo + f_hi)/2 of the values f_lo and f_hi on either side of the target point, written 0.5 (f_lo + f_hi). The C-grid averaging operators bind it at a grid point; a periodic seam binds the wrapped neighbour.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_mid_lev_mass

op:interpolation order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_mid_lev_mass.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j, k - 1} + f_{i, j, k}\right)\right]_{i \in x, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\limits\operatorname{wrf\_lid\_extrap}(f_{\mathrm{n}} = f_{i, j, \mathit{NLEV}}, f_{\mathrm{nm1}} = f_{i, j, \mathit{NLEV} - 1})\right]_{i \in x, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a layer field at the mass points to the interfaces with equal weights: wrf_mid_lev(f) for f [x, y, lev] gives (f[k-1] + f[k])/2 on the interior interfaces k = 2..NLEV, and the closures of the u- and v-point overloads (wrf_mid_lev_u, wrf_mid_lev_v) at the ends: wrf_ground_extrap (cf1 f[1] + cf2 f[2] + cf3 f[3]) at the ground and wrf_lid_extrap (cfn f[NLEV] + cfn1 f[NLEV-1]) at the model top, shape [x, y, lev_nodes]. The mass-point overload of wrf_mid_lev. Uses: the inverse density and the diffusivity at an interface in WRF’s constant-K diffusion (module_big_step_utilities_em.F vertical_diffusion ’m’ and vertical_diffusion_3dmp: 0.5*(alt(i,k,j)+alt(i,k+1,j)); vertical_diffusion ‘w’: 0.5*(alt(i,k,j)+alt(i,k-1,j)); vertical_diffusion_u/_v: the four-cell mean of alt, this mean averaged along x or y; horizontal_diffusion ‘w’: the four-cell mean of K, likewise), all of which read only the interior interfaces. It is NOT wrf_interp_lev, which weights by the layer thicknesses (fnm, fnp).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

wrf_mid_lev_u

op:interpolation order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_mid_lev_u.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j, k - 1} + f_{i, j, k}\right)\right]_{i \in x_{\mathrm{stag}}, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right]_{i \in x_{\mathrm{stag}}, j \in y, 1 \le k \le 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\limits\operatorname{wrf\_lid\_extrap}(f_{\mathrm{n}} = f_{i, j, \mathit{NLEV}}, f_{\mathrm{nm1}} = f_{i, j, \mathit{NLEV} - 1})\right]_{i \in x_{\mathrm{stag}}, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a horizontal velocity from the layers to the interfaces with equal weights, as rhs_ph has it (module_big_step_utilities_em.F: (u(i,k,j) + u(i,k-1,j)) times 0.25 = the mean times 0.5): wrf_mid_lev(f) for f [x_stag, y, lev] gives (f[k-1] + f[k])/2 on the interior interfaces k = 2..NLEV, WRF’s linear extrapolation wrf_lid_extrap (grid.esm), cfn f[NLEV] + cfn1 f[NLEV-1], to the model top k = NLEV+1 (rhs_ph’s k = kte rows: cfnu(k-1) + cfn1u(k-2)), and wrf_ground_extrap (grid.esm), cf1 f[1] + cf2 f[2] + cf3 f[3], at the ground (k = 1), the extrapolation wrf_interp_lev uses there; WRF applies no geopotential tendency at the ground, so that end is a closure for completeness. cf1-cf3, cfn and cfn1 are the consumer’s free names. Note the interior weights are 1/2, not fnm/fnp: rhs_ph’s horizontal transport and its vertical transport interpolate differently. Shape [x_stag, y, lev_nodes]. One of the overloads of wrf_mid_lev, scoped by the exact shape of its operand.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_mid_lev_v

op:interpolation order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_mid_lev_v.esm

Parameters: f

$$\left[\begin{array}{l|l} \left[\sum\limits0.5 \left(f_{i, j, k - 1} + f_{i, j, k}\right)\right]_{i \in x, j \in y_{\mathrm{stag}}, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [2, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right]_{i \in x, j \in y_{\mathrm{stag}}, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, 1] \\ \left[\sum\limits\operatorname{wrf\_lid\_extrap}(f_{\mathrm{n}} = f_{i, j, \mathit{NLEV}}, f_{\mathrm{nm1}} = f_{i, j, \mathit{NLEV} - 1})\right]_{i \in x, j \in y_{\mathrm{stag}}, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW interpolation of a horizontal velocity from the layers to the interfaces with equal weights, as rhs_ph has it (module_big_step_utilities_em.F: (u(i,k,j) + u(i,k-1,j)) times 0.25 = the mean times 0.5): wrf_mid_lev(f) for f [x, y_stag, lev] gives (f[k-1] + f[k])/2 on the interior interfaces k = 2..NLEV, WRF’s linear extrapolation wrf_lid_extrap (grid.esm), cfn f[NLEV] + cfn1 f[NLEV-1], to the model top k = NLEV+1 (rhs_ph’s k = kte rows: cfnu(k-1) + cfn1u(k-2)), and wrf_ground_extrap (grid.esm), cf1 f[1] + cf2 f[2] + cf3 f[3], at the ground (k = 1), the extrapolation wrf_interp_lev uses there; WRF applies no geopotential tendency at the ground, so that end is a closure for completeness. cf1-cf3, cfn and cfn1 are the consumer’s free names. Note the interior weights are 1/2, not fnm/fnp: rhs_ph’s horizontal transport and its vertical transport interpolate differently. Shape [x, y_stag, lev_nodes]. One of the overloads of wrf_mid_lev, scoped by the exact shape of its operand.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

wrf_outflow_hi

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_hi.esm

Parameters: rd, vel, U_lo, U_hi, q_m1, q_0

$$\mathit{rd} \left(\max(\mathit{vel}, 0) \left(q_{\mathrm{0}} - q_{\mathrm{m1}}\right) + q_{\mathrm{0}} \left(U_{\mathrm{hi}} - U_{\mathrm{lo}}\right)\right)$$

WRF’s advection at the edge point of a high open boundary (module_advect_em.F, open_xe / open_ye: the advective, not flux, form at the boundary point): rd (max(vel, 0) (q_0 - q_m1) + q_0 (U_hi - U_lo)). The first term upwinds outflow only (vel > 0 leaves through the high boundary; inflow contributes nothing), and the second is the divergence of the advecting mass flux U_lo, U_hi through the point’s low and high flux faces times the point’s value. vel is the outflow speed, rd the reciprocal spacing (rdx or rdy). The mirror of wrf_outflow_lo.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_outflow_hi_x

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_hi_x.esm

Parameters: V, q, i, j, k, a_lo, a_hi

$$\operatorname{wrf\_outflow\_hi}(U_{\mathrm{hi}} = V_{i + 1, j, k}, U_{\mathrm{lo}} = V_{i, j, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i - 1, j, k}, \mathit{rd} = \mathit{rdx}, \mathit{vel} = a_{\mathrm{lo}} V_{i, j, k} + a_{\mathrm{hi}} V_{i + 1, j, k})$$

WRF’s advection along x at the point (i, j, k) of a field q on the high open x boundary (module_advect_em.F, open_xe): wrf_outflow_hi(rdx, a_lo V[i] + a_hi V[i+1], V[i], V[i+1], q[i-1], q[i]), with V[i] and V[i+1] the advecting mass flux through the point’s low and high flux faces. The outflow speed is a_lo V[i] + a_hi V[i+1]: a_lo = a_hi = 1/2 for a mass-point field and for w (WRF’s mean of the two faces), and a_lo = 0, a_hi = 1 for v, whose advecting flux the consumer has averaged to the boundary face itself. The mirror of wrf_outflow_lo_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_outflow_hi_y

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_hi_y.esm

Parameters: V, q, i, j, k, a_lo, a_hi

$$\operatorname{wrf\_outflow\_hi}(U_{\mathrm{hi}} = V_{i, j + 1, k}, U_{\mathrm{lo}} = V_{i, j, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j - 1, k}, \mathit{rd} = \mathit{rdy}, \mathit{vel} = a_{\mathrm{lo}} V_{i, j, k} + a_{\mathrm{hi}} V_{i, j + 1, k})$$

WRF’s advection along y at the point (i, j, k) of a field q on the high open y boundary (module_advect_em.F, open_ye): wrf_outflow_hi(rdy, a_lo V[j] + a_hi V[j+1], V[j], V[j+1], q[j-1], q[j]). The outflow speed is a_lo V[j] + a_hi V[j+1]: a_lo = a_hi = 1/2 for a mass-point field and for w, and a_lo = 0, a_hi = 1 for u, whose advecting flux the consumer has averaged to the boundary face itself. The y twin of wrf_outflow_hi_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_outflow_lo

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_lo.esm

Parameters: rd, vel, U_lo, U_hi, q_0, q_p1

$$\mathit{rd} \left(\min(\mathit{vel}, 0) \left(q_{\mathrm{p1}} - q_{\mathrm{0}}\right) + q_{\mathrm{0}} \left(U_{\mathrm{hi}} - U_{\mathrm{lo}}\right)\right)$$

WRF’s advection at the edge point of a low open boundary (module_advect_em.F, open_xs / open_ys: the advective, not flux, form at the boundary point): rd (min(vel, 0) (q_p1 - q_0) + q_0 (U_hi - U_lo)). The first term upwinds outflow only (vel < 0 leaves through the low boundary; inflow has no interior upwind neighbour and contributes nothing), and the second is the divergence of the advecting mass flux U_lo, U_hi through the point’s low and high flux faces times the point’s value. vel is the outflow speed, rd the reciprocal spacing (rdx or rdy). The mirror of wrf_outflow_hi.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_outflow_lo_x

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_lo_x.esm

Parameters: V, q, i, j, k, a_lo, a_hi

$$\operatorname{wrf\_outflow\_lo}(U_{\mathrm{hi}} = V_{i + 1, j, k}, U_{\mathrm{lo}} = V_{i, j, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{p1}} = q_{i + 1, j, k}, \mathit{rd} = \mathit{rdx}, \mathit{vel} = a_{\mathrm{lo}} V_{i, j, k} + a_{\mathrm{hi}} V_{i + 1, j, k})$$

WRF’s advection along x at the point (i, j, k) of a field q on the low open x boundary (module_advect_em.F, open_xs): wrf_outflow_lo(rdx, a_lo V[i] + a_hi V[i+1], V[i], V[i+1], q[i], q[i+1]), with V[i] and V[i+1] the advecting mass flux through the point’s low and high flux faces. The outflow speed is a_lo V[i] + a_hi V[i+1]: a_lo = a_hi = 1/2 for a mass-point field and for w, whose speed WRF takes as the mean of the two faces, and a_lo = 1, a_hi = 0 for v, whose advecting flux the consumer has averaged to the boundary face itself (WRF’s vw at the face).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_outflow_lo_y

op:advection order:1 stencil width 2 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_outflow_lo_y.esm

Parameters: V, q, i, j, k, a_lo, a_hi

$$\operatorname{wrf\_outflow\_lo}(U_{\mathrm{hi}} = V_{i, j + 1, k}, U_{\mathrm{lo}} = V_{i, j, k}, q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{p1}} = q_{i, j + 1, k}, \mathit{rd} = \mathit{rdy}, \mathit{vel} = a_{\mathrm{lo}} V_{i, j, k} + a_{\mathrm{hi}} V_{i, j + 1, k})$$

WRF’s advection along y at the point (i, j, k) of a field q on the low open y boundary (module_advect_em.F, open_ys): wrf_outflow_lo(rdy, a_lo V[j] + a_hi V[j+1], V[j], V[j+1], q[j], q[j+1]), with V[j] and V[j+1] the advecting mass flux through the point’s low and high flux faces. The outflow speed is a_lo V[j] + a_hi V[j+1]: a_lo = a_hi = 1/2 for a mass-point field and for w (WRF’s mean of the two faces), and a_lo = 1, a_hi = 0 for u, whose advecting flux the consumer has averaged to the boundary face itself (WRF’s vw at the face). The y twin of wrf_outflow_lo_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad2_cell

op:advection order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad2_cell.esm

Parameters: rd, V_lo, V_hi, f_m1, f_0, f_p1

$$0.5 \mathit{rd} \left(V_{\mathrm{hi}} \left(f_{\mathrm{p1}} - f_{\mathrm{0}}\right) + V_{\mathrm{lo}} \left(f_{\mathrm{0}} - f_{\mathrm{m1}}\right)\right)$$

WRF’s second-order advective-form transport of an interface field at one point along one horizontal axis, the degraded order rhs_ph (module_big_step_utilities_em.F, h_sca_adv_order 5 or 6) uses at the second point from an open boundary: the mean of the two one-sided products, (rd/2)(V_hi (f_p1 - f_0) + V_lo (f_0 - f_m1)). V_lo and V_hi are the mass-weighted velocity on the point’s low and high faces, f_m1, f_0 and f_p1 the field at the point and its two neighbours, rd the reciprocal spacing (rdx or rdy). wrf_vgrad2_x and wrf_vgrad2_y bind it at a grid point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad2_x

op:advection order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad2_x.esm

Parameters: V, f, i, j, k

$$\operatorname{wrf\_vgrad2\_cell}(V_{\mathrm{hi}} = V_{i + 1, j, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{0}} = f_{i, j, k}, f_{\mathrm{m1}} = f_{i - 1, j, k}, f_{\mathrm{p1}} = f_{i + 1, j, k}, \mathit{rd} = \mathit{rdx})$$

WRF’s second-order advective transport along x at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x_stag, y, lev_nodes], the second point from an open x boundary in rhs_ph: wrf_vgrad2_cell(rdx, V[i], V[i+1], f[i-1], f[i], f[i+1]).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad2_y

op:advection order:2 stencil width 3 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad2_y.esm

Parameters: V, f, i, j, k

$$\operatorname{wrf\_vgrad2\_cell}(V_{\mathrm{hi}} = V_{i, j + 1, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{0}} = f_{i, j, k}, f_{\mathrm{m1}} = f_{i, j - 1, k}, f_{\mathrm{p1}} = f_{i, j + 1, k}, \mathit{rd} = \mathit{rdy})$$

WRF’s second-order advective transport along y at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x, y_stag, lev_nodes], the second point from an open y boundary in rhs_ph: wrf_vgrad2_cell(rdy, V[j], V[j+1], f[j-1], f[j], f[j+1]).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad4_cell

op:advection order:4 stencil width 5 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad4_cell.esm

Parameters: rd, V_lo, V_hi, f_m2, f_m1, f_p1, f_p2

$$\mathit{rd} \left(0.5 \left(V_{\mathrm{lo}} + V_{\mathrm{hi}}\right)\right) \left(\frac{1}{12} \left(8 \left(f_{\mathrm{p1}} - f_{\mathrm{m1}}\right) - \left(f_{\mathrm{p2}} - f_{\mathrm{m2}}\right)\right)\right)$$

WRF’s fourth-order advective-form transport of an interface field at one point along one horizontal axis, the degraded order rhs_ph (module_big_step_utilities_em.F, h_sca_adv_order 5 or 6) uses at the third point from an open boundary: rd (V_lo + V_hi)/2 times the centred difference (1/12)(8 (f_p1 - f_m1) - (f_p2 - f_m2)). The operands are as in wrf_vgrad6_cell. wrf_vgrad4_x and wrf_vgrad4_y bind it at a grid point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad4_x

op:advection order:4 stencil width 5 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad4_x.esm

Parameters: V, f, i, j, k

$$\operatorname{wrf\_vgrad4\_cell}(V_{\mathrm{hi}} = V_{i + 1, j, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{m1}} = f_{i - 1, j, k}, f_{\mathrm{m2}} = f_{i - 2, j, k}, f_{\mathrm{p1}} = f_{i + 1, j, k}, f_{\mathrm{p2}} = f_{i + 2, j, k}, \mathit{rd} = \mathit{rdx})$$

WRF’s fourth-order advective transport along x at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x_stag, y, lev_nodes], the third point from an open x boundary in rhs_ph: wrf_vgrad4_cell(rdx, V[i], V[i+1], f[i-2], f[i-1], f[i+1], f[i+2]).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad4_y

op:advection order:4 stencil width 5 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad4_y.esm

Parameters: V, f, i, j, k

$$\operatorname{wrf\_vgrad4\_cell}(V_{\mathrm{hi}} = V_{i, j + 1, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{m1}} = f_{i, j - 1, k}, f_{\mathrm{m2}} = f_{i, j - 2, k}, f_{\mathrm{p1}} = f_{i, j + 1, k}, f_{\mathrm{p2}} = f_{i, j + 2, k}, \mathit{rd} = \mathit{rdy})$$

WRF’s fourth-order advective transport along y at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x, y_stag, lev_nodes], the third point from an open y boundary in rhs_ph: wrf_vgrad4_cell(rdy, V[j], V[j+1], f[j-2], f[j-1], f[j+1], f[j+2]).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad6_cell

op:advection order:6 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad6_cell.esm

Parameters: rd, V_lo, V_hi, f_m3, f_m2, f_m1, f_p1, f_p2, f_p3

$$\mathit{rd} \left(0.5 \left(V_{\mathrm{lo}} + V_{\mathrm{hi}}\right)\right) \left(\frac{1}{60} \left(45 \left(f_{\mathrm{p1}} - f_{\mathrm{m1}}\right) + -9 \left(f_{\mathrm{p2}} - f_{\mathrm{m2}}\right) + \left(f_{\mathrm{p3}} - f_{\mathrm{m3}}\right)\right)\right)$$

WRF’s sixth-order advective-form transport of an interface field at one point along one horizontal axis (module_big_step_utilities_em.F rhs_ph, h_sca_adv_order 5 or 6, the term of the geopotential equation): rd (V_lo + V_hi)/2 times the centred difference (1/60)(45 (f_p1 - f_m1) - 9 (f_p2 - f_m2) + (f_p3 - f_m3)). V_lo and V_hi are the mass-weighted velocity on the point’s low and high faces, f_m3..f_m1 and f_p1..f_p3 the field’s neighbours toward the low and the high end, rd the reciprocal spacing (rdx or rdy). WRF writes 0.25 rd (U(+1) + U(0)) with U twice the face velocity, the same mean. wrf_vgrad6_x and wrf_vgrad6_y bind it at a grid point, with the neighbours at plain offsets in the interior and wrapped at the ends of a periodic axis.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad6_x

op:advection order:6 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad6_x.esm

Parameters: V, f, i, j, k, o_vhi, o_m3, o_m2, o_m1, o_p1, o_p2, o_p3

$$\operatorname{wrf\_vgrad6\_cell}(V_{\mathrm{hi}} = V_{i + o_{\mathrm{vhi}}, j, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{m1}} = f_{i + o_{\mathrm{m1}}, j, k}, f_{\mathrm{m2}} = f_{i + o_{\mathrm{m2}}, j, k}, f_{\mathrm{m3}} = f_{i + o_{\mathrm{m3}}, j, k}, f_{\mathrm{p1}} = f_{i + o_{\mathrm{p1}}, j, k}, f_{\mathrm{p2}} = f_{i + o_{\mathrm{p2}}, j, k}, f_{\mathrm{p3}} = f_{i + o_{\mathrm{p3}}, j, k}, \mathit{rd} = \mathit{rdx})$$

WRF’s sixth-order advective transport along x at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x_stag, y, lev_nodes] (rhs_ph): wrf_vgrad6_cell(rdx, V[i], V[i + o_vhi], f[i + o_m3], f[i + o_m2], f[i + o_m1], f[i + o_p1], f[i + o_p2], f[i + o_p3]). The offsets say where along x each operand sits relative to the point: o_vhi the high face (1 in the interior) and o_m3..o_p3 the neighbours (-3..3 in the interior). A periodic rule binds the ends’ operands wrapped (o_m3 = NX - 3 at i = 1 reads f[NX - 2]; o_vhi = 1 - NX at i = NX reads V[1]), so the interior and every wrapped end point apply this one stencil. A rule applies it inside an faq over the region’s points.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

wrf_vgrad6_y

op:advection order:6 stencil width 7 interior-only (match-less)

Source: grids/wrf_arw_c/stencils/wrf_vgrad6_y.esm

Parameters: V, f, i, j, k, o_vhi, o_m3, o_m2, o_m1, o_p1, o_p2, o_p3

$$\operatorname{wrf\_vgrad6\_cell}(V_{\mathrm{hi}} = V_{i, j + o_{\mathrm{vhi}}, k}, V_{\mathrm{lo}} = V_{i, j, k}, f_{\mathrm{m1}} = f_{i, j + o_{\mathrm{m1}}, k}, f_{\mathrm{m2}} = f_{i, j + o_{\mathrm{m2}}, k}, f_{\mathrm{m3}} = f_{i, j + o_{\mathrm{m3}}, k}, f_{\mathrm{p1}} = f_{i, j + o_{\mathrm{p1}}, k}, f_{\mathrm{p2}} = f_{i, j + o_{\mathrm{p2}}, k}, f_{\mathrm{p3}} = f_{i, j + o_{\mathrm{p3}}, k}, \mathit{rd} = \mathit{rdy})$$

WRF’s sixth-order advective transport along y at the point (i, j, k) of an interface field f [x, y, lev_nodes] by the face velocity V [x, y_stag, lev_nodes] (rhs_ph): wrf_vgrad6_cell(rdy, V[j], V[j + o_vhi], f[j + o_m3], f[j + o_m2], f[j + o_m1], f[j + o_p1], f[j + o_p2], f[j + o_p3]). The offsets say where along y each operand sits relative to the point: o_vhi the high face (1 in the interior) and o_m3..o_p3 the neighbours (-3..3 in the interior). A periodic rule binds the ends’ operands wrapped (o_m3 = NY - 3 at j = 1 reads f[NY - 2]; o_vhi = 1 - NY at j = NY reads V[1]), so the interior and every wrapped end point apply this one stencil. A rule applies it inside an faq over the region’s points.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97

Rules

Complete auto-applied rewrite rules on spatial D: imported stencil + boundary conditions in one makearray (esm-spec §9.6.8). Import a rule and every matching derivative in your model lowers through it.

wrf_adv3_lev

op:advection order:3 bc:wall axes:x,y,lev stencil width 4 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv3_lev.esm

Rewrites \(\frac{\partial}{\partial\mathit{lev}} \left(W q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["W", "q"]}], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when W is a bare field shaped [x, y, lev_nodes]; q is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv02\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\operatorname{wrf\_adv23\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y, 2 \le k \le 2} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [2, 2] \\ \left[\sum\operatorname{wrf\_adv33\_lev}(W = W, i = i, j = j, k = k, o_{\mathrm{whi}} = 1, o_{\mathrm{wlo}} = 0, q = q, \mathit{rd} = \mathit{rdnw}_{k})\right]^{\{W, q\}}_{i \in x, j \in y, 3 \le k \le \mathit{NLEV} - 2} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [3, \mathit{NLEV} - 2] \\ \left[\sum\operatorname{wrf\_adv32\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y, \mathit{NLEV} - 1 \le k \le \mathit{NLEV} - 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV} - 1, \mathit{NLEV} - 1] \\ \left[\sum\operatorname{wrf\_adv20\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y, \mathit{NLEV} \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV}, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW vertical flux-form advection of a mass-point field on the eta interfaces (module_advect_em.F advect_scalar, v_sca_adv_order = 3): matches partial(Wq, lev) for q [x, y, lev] and W = ww (WRF rom, coupled: mu times the contravariant eta velocity), the vertical mass flux on the interfaces [x, y, lev_nodes], and lowers it to wrf_flux_div(rdnw[k], G[k], G[k+1]) = (G[k+1] - G[k]) rdnw[k] at every layer, the derivative with respect to eta (rdnw = 1/dnw < 0, the consumer’s free name). A consuming component writes WRF’s term as -partial(Wq, lev) (WRF: tendency -= rdzw(k)*(vflux(k+1) - vflux(k)) with rdzw = rdnw). The interface fluxes are WRF’s: G[k] = wrf_flux3(W[k], q[k-2], q[k-1], q[k], q[k+1], s = -1), third order, on the interfaces k = 3..NLEV-1; second order G[k] = wrf_flux2_lev(W[k], q[k], q[k-1], fnm[k], fnp[k]) = W[k] (fnm[k] q[k] + fnp[k] q[k-1]) on the interfaces k = 2 and k = NLEV next to the boundaries, with the consumer’s interpolation weights fnm, fnp [lev_nodes]; and G = 0 at the ground (k = 1) and the model top (k = NLEV+1), WRF’s vflux(kts) = vflux(kte) = 0. The five regions are the five distinct combinations of those face fluxes, each a per-point stencil shared with wrf_adv3_lev_u and wrf_adv3_lev_v: layer 1 (wrf_adv02_lev, G[2] - 0), layer 2 (wrf_adv23_lev, third-order G[3] - second-order G[2]), layers 3..NLEV-2 (wrf_adv33_lev, both third order), layer NLEV-1 (wrf_adv32_lev, second-order G[NLEV] - third-order G[NLEV-1]) and layer NLEV (wrf_adv20_lev, 0 - G[NLEV]). The column sum of dnw times the result telescopes to zero, so the scheme conserves the column mass of q exactly. NLEV >= 4 (at NLEV = 4 the third region folds empty). ORDER: the third-order claim holds for uniformly spaced eta levels, where wrf_flux3’s fixed weights are exact for cell averages; tests/conformance/convergence/wrf_advection_lev measures it (q as layer averages, W vanishing at the ground and the lid like WRF’s ww). On stretched levels the fixed weights carry an O(dnw^2) interpolation error, as in WRF itself, and the order falls toward 2 as the grid is refined.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_advection_lev

Error norms read from the committed golden tests/conformance/convergence/wrf_advection_lev/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.219e-03—1.876e-02—
167.272e-042.842.871e-032.71
329.162e-052.993.820e-042.91
641.149e-053.004.841e-052.98

Expected order: 3 (± 0.3).

Convergence of wrf_advection_lev (log-log)

wrf_adv3_lev_u

op:advection order:3 bc:wall axes:x_stag,y,lev stencil width 4 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv3_lev_u.esm

Rewrites \(\frac{\partial}{\partial\mathit{lev}} \left(W q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["W", "q"]}], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when W is a bare field shaped [x_stag, y, lev_nodes]; q is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv02\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x_{\mathrm{stag}}, j \in y, 1 \le k \le 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\operatorname{wrf\_adv23\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x_{\mathrm{stag}}, j \in y, 2 \le k \le 2} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [2, 2] \\ \left[\sum\operatorname{wrf\_adv33\_lev}(W = W, i = i, j = j, k = k, o_{\mathrm{whi}} = 1, o_{\mathrm{wlo}} = 0, q = q, \mathit{rd} = \mathit{rdnw}_{k})\right]^{\{W, q\}}_{i \in x_{\mathrm{stag}}, j \in y, 3 \le k \le \mathit{NLEV} - 2} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [3, \mathit{NLEV} - 2] \\ \left[\sum\operatorname{wrf\_adv32\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x_{\mathrm{stag}}, j \in y, \mathit{NLEV} - 1 \le k \le \mathit{NLEV} - 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [\mathit{NLEV} - 1, \mathit{NLEV} - 1] \\ \left[\sum\operatorname{wrf\_adv20\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x_{\mathrm{stag}}, j \in y, \mathit{NLEV} \le k \le \mathit{NLEV}} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [\mathit{NLEV}, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW vertical flux-form advection of u (on the x faces; WRF advect_u) on the eta interfaces (module_advect_em.F, v_mom_adv_order = 3): matches partial(Wq, lev) for q [x_stag, y, lev] and W = (ww[i-1] + ww[i])/2, the consumer’s average of ww to the u columns [x_stag, y, lev_nodes] (WRF vel = 0.5(rom(i-1,k,j)+rom(i,k,j))) [x_stag, y, lev_nodes], and lowers it to (G[k+1] - G[k]) rdnw[k] at every layer, the derivative with respect to eta (rdnw = 1/dnw < 0, the consumer’s free name). A consuming component writes WRF’s term as -partial(W*q, lev). The interface fluxes are WRF’s: G[k] = wrf_flux3(W[k], q[k-2], q[k-1], q[k], q[k+1], s = -1), third order, on the interfaces k = 3..NLEV-1; second order G[k] = wrf_flux2_lev(W[k], q[k], q[k-1], fnm[k], fnp[k]) = W[k] (fnm[k] q[k] + fnp[k] q[k-1]) on the interfaces k = 2 and k = NLEV next to the boundaries, with the consumer’s interpolation weights fnm, fnp [lev_nodes]; and G = 0 at the ground (k = 1) and the model top (k = NLEV+1), WRF’s vflux(kts) = vflux(kte) = 0. The five regions are the five distinct combinations of those face fluxes, the per-point stencils wrf_adv02_lev, wrf_adv23_lev, wrf_adv33_lev, wrf_adv32_lev and wrf_adv20_lev shared with wrf_adv3_lev: layer 1 (G[2] - 0), layer 2 (third-order G[3] - second-order G[2]), layers 3..NLEV-2 (both third order), layer NLEV-1 (second-order G[NLEV] - third-order G[NLEV-1]) and layer NLEV (0 - G[NLEV]). The column sum of dnw times the result telescopes to zero, so the scheme conserves the column mass of q exactly. NLEV >= 4 (at NLEV = 4 the third region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv3_lev_v

op:advection order:3 bc:wall axes:x,y_stag,lev stencil width 4 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv3_lev_v.esm

Rewrites \(\frac{\partial}{\partial\mathit{lev}} \left(W q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["W", "q"]}], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when W is a bare field shaped [x, y_stag, lev_nodes]; q is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv02\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y_{\mathrm{stag}}, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, 1] \\ \left[\sum\operatorname{wrf\_adv23\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y_{\mathrm{stag}}, 2 \le k \le 2} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [2, 2] \\ \left[\sum\operatorname{wrf\_adv33\_lev}(W = W, i = i, j = j, k = k, o_{\mathrm{whi}} = 1, o_{\mathrm{wlo}} = 0, q = q, \mathit{rd} = \mathit{rdnw}_{k})\right]^{\{W, q\}}_{i \in x, j \in y_{\mathrm{stag}}, 3 \le k \le \mathit{NLEV} - 2} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [3, \mathit{NLEV} - 2] \\ \left[\sum\operatorname{wrf\_adv32\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y_{\mathrm{stag}}, \mathit{NLEV} - 1 \le k \le \mathit{NLEV} - 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [\mathit{NLEV} - 1, \mathit{NLEV} - 1] \\ \left[\sum\operatorname{wrf\_adv20\_lev}(W = W, i = i, j = j, k = k, q = q)\right]^{\{W, q\}}_{i \in x, j \in y_{\mathrm{stag}}, \mathit{NLEV} \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [\mathit{NLEV}, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW vertical flux-form advection of v (on the y faces; WRF advect_v) on the eta interfaces (module_advect_em.F, v_mom_adv_order = 3): matches partial(Wq, lev) for q [x, y_stag, lev] and W = (ww[j-1] + ww[j])/2, the consumer’s average of ww to the v columns [x, y_stag, lev_nodes] [x, y_stag, lev_nodes], and lowers it to (G[k+1] - G[k]) rdnw[k] at every layer, the derivative with respect to eta (rdnw = 1/dnw < 0, the consumer’s free name). A consuming component writes WRF’s term as -partial(Wq, lev). The interface fluxes are WRF’s: G[k] = wrf_flux3(W[k], q[k-2], q[k-1], q[k], q[k+1], s = -1), third order, on the interfaces k = 3..NLEV-1; second order G[k] = wrf_flux2_lev(W[k], q[k], q[k-1], fnm[k], fnp[k]) = W[k] (fnm[k] q[k] + fnp[k] q[k-1]) on the interfaces k = 2 and k = NLEV next to the boundaries, with the consumer’s interpolation weights fnm, fnp [lev_nodes]; and G = 0 at the ground (k = 1) and the model top (k = NLEV+1), WRF’s vflux(kts) = vflux(kte) = 0. The five regions are the five distinct combinations of those face fluxes, the per-point stencils wrf_adv02_lev, wrf_adv23_lev, wrf_adv33_lev, wrf_adv32_lev and wrf_adv20_lev shared with wrf_adv3_lev: layer 1 (G[2] - 0), layer 2 (third-order G[3] - second-order G[2]), layers 3..NLEV-2 (both third order), layer NLEV-1 (second-order G[NLEV] - third-order G[NLEV-1]) and layer NLEV (0 - G[NLEV]). The column sum of dnw times the result telescopes to zero, so the scheme conserves the column mass of q exactly. NLEV >= 4 (at NLEV = 4 the third region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv3_lev_w

op:advection order:3 bc:wall axes:x,y,lev_nodes stencil width 4 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv3_lev_w.esm

Rewrites \(\frac{\partial}{\partial\mathit{lev}} \left(W q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["W", "q"]}], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when W is a bare field shaped [x, y, lev]; q is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum0\right]^{\{W, q\}}_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k + 1}, q_{\mathrm{m1}} = q_{i, j, k}, q_{\mathrm{m2}} = q_{i, j, k - 1}, q_{\mathrm{p1}} = q_{i, j, k + 2}, s = -1, \mathit{vel} = W_{i, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j, k - 1}, \mathit{vel} = W_{i, j, k - 1}), \mathit{rd} = \mathit{rdn}_{k})\right]^{\{W, q\}}_{i \in x, j \in y, 2 \le k \le 2} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [2, 2] \\ \left[\sum\operatorname{wrf\_adv33\_lev}(W = W, i = i, j = j, k = k, o_{\mathrm{whi}} = 0, o_{\mathrm{wlo}} = -1, q = q, \mathit{rd} = \mathit{rdn}_{k})\right]^{\{W, q\}}_{i \in x, j \in y, 3 \le k \le \mathit{NLEV} - 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [3, \mathit{NLEV} - 1] \\ \left[\sum\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j, k + 1}, q_{\mathrm{m1}} = q_{i, j, k}, \mathit{vel} = W_{i, j, k}), F_{\mathrm{lo}} = \operatorname{wrf\_flux3}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j, k - 1}, q_{\mathrm{m2}} = q_{i, j, k - 2}, q_{\mathrm{p1}} = q_{i, j, k + 1}, s = -1, \mathit{vel} = W_{i, j, k - 1}), \mathit{rd} = \mathit{rdn}_{k})\right]^{\{W, q\}}_{i \in x, j \in y, \mathit{NLEV} \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV}, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = 0, F_{\mathrm{lo}} = \operatorname{wrf\_flux2}(q_{\mathrm{0}} = q_{i, j, k}, q_{\mathrm{m1}} = q_{i, j, k - 1}, \mathit{vel} = W_{i, j, k - 1}), \mathit{rd} = 2 \mathit{rdn}_{k - 1})\right]^{\{W, q\}}_{i \in x, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW vertical flux-form advection of w on the eta levels (module_advect_em.F advect_w, v_mom_adv_order = 3): matches partial(Wq, lev) for q = w on the interfaces [x, y, lev_nodes] and W = (ww[k] + ww[k+1])/2, the consumer’s average of ww to the mass layers [x, y, lev] (WRF vel = 0.5(rom(i,k,j)+rom(i,k-1,j)) for the flux between w(k-1) and w(k)), and lowers it to (G[k+1] - G[k]) rdn[k] at the interior levels k = 2..NLEV, with G[k] the flux between levels k-1 and k carried by layer k-1: second order wrf_flux2 (WRF 0.25*(rom(k)+rom(k-1))(w(k)+w(k-1))) for the bottom layer (G[2]) and the top layer (G[NLEV+1]), third order wrf_flux3(…, s = -1) between (the per-point stencil wrf_adv33_lev that the layer rules also use, with the flux offsets shifted down one and rd = rdn[k]); the other regions apply wrf_flux_div to these fluxes. rdn [lev_nodes] = 1/dn, the consumer’s reciprocal spacing of the mass levels (WRF rdn, rdzu inside advect_w). A consuming component writes WRF’s term as -partial(Wq, lev). BOUNDARIES: 0 at level 1 (the ground; w there is set by the kinematic lower boundary condition and WRF does not advect it), and at the lid (level NLEV+1) WRF’s one-sided half-cell form -2 rdn[NLEV] G[NLEV+1], written wrf_flux_div(2 rdn[NLEV], G[NLEV+1], 0) (tendency += 2*rdzu(k-1)*vflux(k), with WRF’s spacing rdn of the top layer pair, reproduced as written). NLEV >= 3: below that the regions overlap.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_u_x_open

op:advection order:5 bc:open axes:x_stag,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_u_x_open.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y, lev]; q is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev}} & [4, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{V, q\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of u along x (module_advect_em.F advect_u, h_mom_adv_order = 5): matches partial(Vq, x) for q [x_stag, y, lev] and the advecting mass flux V [x, y, lev], U = (ru[i] + ru[i+1])/2, the consumer’s average of ru to the MASS points [x, y, lev] (WRF: vel = 0.5(ru(i,k,j)+ru(i-1,k,j)) for the flux between u(i-1) and u(i)), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior, wrf_adv23_x, wrf_adv35_x, wrf_adv53_x and wrf_adv32_x (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_x / wrf_outflow_hi_x on the edge points. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msfuxrdx); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_xs, open_xe): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_xs / degrade_xe). The boundary points 1 and NX+1 (the u faces on the domain edge) are not advected by WRF: they evolve by the radiation condition -rdx min(V_b - c_b (c1 mu + c2), 0) du/dx (phase speed c_b, WRF’s cb), which is a boundary forcing the consuming component adds, not part of this derivative; the rule gives 0 there. WRF also skips the advection of these faces along the OTHER axes when x is open, which this rule (along x only) cannot see; the consumer masks them. NX >= 5: below that the regions overlap (at NX = 5 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_u_x_periodic

op:advection order:5 bc:periodic axes:x_stag,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_u_x_periodic.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y, lev]; q is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y, k \in \mathit{lev}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = \mathit{NX} - 1, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NX}, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i - \mathit{NX}, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = \mathit{NX} - 1, q = q)\right]^{\{V, q\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of u along x (module_advect_em.F advect_u, h_mom_adv_order = 5): matches partial(Vq, x) for q [x_stag, y, lev] and the advecting mass flux V [x, y, lev], U = (ru[i] + ru[i+1])/2, the consumer’s average of ru to the MASS points [x, y, lev] (WRF: vel = 0.5(ru(i,k,j)+ru(i-1,k,j)) for the flux between u(i-1) and u(i)), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msfuxrdx); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_x): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NX] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). q is a face field along x with NX+1 points whose last duplicates the first; the rule reads only points 1..NX of q and of V (wrapping V[0] to V[NX]) and returns point NX+1 equal to point 1 (its region applies point 1’s stencil, at i - NX). Exactly conservative: the sum over points 1..NX telescopes to zero. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_advection_u_x_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_advection_u_x_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
82.913e-03—2.762e-03—
169.513e-054.949.350e-054.88
323.002e-064.992.988e-064.97
649.398e-085.009.374e-084.99

Expected order: 5 (± 0.3).

Convergence of wrf_advection_u_x_periodic (log-log)

wrf_adv5_u_y_open

op:advection order:5 bc:open axes:x_stag,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_u_y_open.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y_stag, lev]; q is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_y}(V = V, a_{\mathrm{hi}} = 0, a_{\mathrm{lo}} = 1, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_y}(V = V, a_{\mathrm{hi}} = 1, a_{\mathrm{lo}} = 0, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of u along y (module_advect_em.F advect_u, h_mom_adv_order = 5): matches partial(Vq, y) for q [x_stag, y, lev] and the advecting mass flux V [x_stag, y_stag, lev], V = (rv[i-1, j] + rv[i, j])/2, the consumer’s average of rv to the u columns on the y faces [x_stag, y_stag, lev] (WRF: 0.5(rv(i,k,j)+rv(i-1,k,j))), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior, wrf_adv23_y, wrf_adv35_y, wrf_adv53_y and wrf_adv32_y (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_y / wrf_outflow_hi_y on the edge points. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfuyrdy); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_ys, open_ye): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_ys / degrade_ye). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min(V[1], 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max(V[N+1], 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the advecting flux on the edge face itself, as WRF’s advect_u has it (a scalar and w use the mean of the edge cell’s two faces instead). WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF keeps the map factor on these points (mrd = msfrd), as the consumer’s -m partial(Vq, x) does. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty). MIXED BOUNDARIES: on the edge points the outflow speed is the consumer’s V on the edge face. WRF builds it from rv with its x index clamped to the domain (ip = MIN(ide-1, i), im = MAX(ids, i-1)), so on the faces 1 and NX+1 of the other axis it uses the one adjacent column of rv. With an open x axis, wrf_avg_x_open gives the same thing; with a PERIODIC x axis (open y, periodic x), a consumer that averages rv with the periodic wrap gets a different outflow speed than WRF at those two corner points of each edge row.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_u_y_periodic

op:advection order:5 bc:periodic axes:x_stag,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_u_y_periodic.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y_stag, lev]; q is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NY}, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1 - \mathit{NY}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of u along y (module_advect_em.F advect_u, h_mom_adv_order = 5): matches partial(Vq, y) for q [x_stag, y, lev] and the advecting mass flux V [x_stag, y_stag, lev], V = (rv[i-1, j] + rv[i, j])/2, the consumer’s average of rv to the u columns on the y faces [x_stag, y_stag, lev] (WRF: 0.5(rv(i,k,j)+rv(i-1,k,j))), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfuyrdy); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_y): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NY] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NY reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NY+1] and is flux-conservative for any V: the sum of the result along y telescopes to zero. WRF’s halo makes V[NY+1] = V[1], so this is WRF’s result. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_v_x_open

op:advection order:5 bc:open axes:x,y_stag,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_v_x_open.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y_stag, lev]; q is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_x}(V = V, a_{\mathrm{hi}} = 0, a_{\mathrm{lo}} = 1, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_x}(V = V, a_{\mathrm{hi}} = 1, a_{\mathrm{lo}} = 0, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of v along x (module_advect_em.F advect_v, h_mom_adv_order = 5): matches partial(Vq, x) for q [x, y_stag, lev] and the advecting mass flux V [x_stag, y_stag, lev], U = (ru[i, j-1] + ru[i, j])/2, the consumer’s average of ru to the v rows on the x faces [x_stag, y_stag, lev] (WRF: 0.5(ru(i,k,j)+ru(i,k,j-1))), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior, wrf_adv23_x, wrf_adv35_x, wrf_adv53_x and wrf_adv32_x (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_x / wrf_outflow_hi_x on the edge points. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msfvxrdx); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_xs, open_xe): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_xs / degrade_xe). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min(V[1], 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max(V[N+1], 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the advecting flux on the edge face itself, as WRF’s advect_v has it (a scalar and w use the mean of the edge cell’s two faces instead). WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF keeps the map factor on these points (mrd = msfrd), as the consumer’s -m partial(Vq, x) does. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty). MIXED BOUNDARIES: on the edge points the outflow speed is the consumer’s V on the edge face. WRF builds it from ru with its y index clamped to the domain (jp = MIN(jde-1, j), jm = MAX(jds, j-1)), so on the faces 1 and NY+1 of the other axis it uses the one adjacent column of ru. With an open y axis, wrf_avg_y_open gives the same thing; with a PERIODIC y axis (open x, periodic y), a consumer that averages ru with the periodic wrap gets a different outflow speed than WRF at those two corner points of each edge row.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_v_x_periodic

op:advection order:5 bc:periodic axes:x,y_stag,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_v_x_periodic.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y_stag, lev]; q is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NX}, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1 - \mathit{NX}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of v along x (module_advect_em.F advect_v, h_mom_adv_order = 5): matches partial(Vq, x) for q [x, y_stag, lev] and the advecting mass flux V [x_stag, y_stag, lev], U = (ru[i, j-1] + ru[i, j])/2, the consumer’s average of ru to the v rows on the x faces [x_stag, y_stag, lev] (WRF: 0.5(ru(i,k,j)+ru(i,k,j-1))), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msfvxrdx); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_x): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NX] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NX reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NX+1] and is flux-conservative for any V: the sum of the result along x telescopes to zero. WRF’s halo makes V[NX+1] = V[1], so this is WRF’s result. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_v_y_open

op:advection order:5 bc:open axes:x,y_stag,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_v_y_open.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y, lev]; q is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{V, q\}}_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of v along y (module_advect_em.F advect_v, h_mom_adv_order = 5): matches partial(Vq, y) for q [x, y_stag, lev] and the advecting mass flux V [x, y, lev], V = (rv[j] + rv[j+1])/2, the consumer’s average of rv to the MASS points [x, y, lev] (WRF: 0.5(rv(i,k,j)+rv(i,k,j-1)) for the flux between v(j-1) and v(j)), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior, wrf_adv23_y, wrf_adv35_y, wrf_adv53_y and wrf_adv32_y (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_y / wrf_outflow_hi_y on the edge points. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfvyrdy); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_ys, open_ye): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_ys / degrade_ye). The boundary points 1 and NY+1 (the v faces on the domain edge) are not advected by WRF: they evolve by the radiation condition -rdy min(V_b - c_b (c1 mu + c2), 0) dv/dy (phase speed c_b, WRF’s cb), which is a boundary forcing the consuming component adds, not part of this derivative; the rule gives 0 there. WRF also skips the advection of these faces along the OTHER axes when y is open, which this rule (along y only) cannot see; the consumer masks them. NY >= 5: below that the regions overlap (at NY = 5 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_v_y_periodic

op:advection order:5 bc:periodic axes:x,y_stag,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_v_y_periodic.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y, lev]; q is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = \mathit{NY} - 1, q = q)\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NY}, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = -1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j - \mathit{NY}, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 0, o_{\mathrm{vlo}} = \mathit{NY} - 1, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of v along y (module_advect_em.F advect_v, h_mom_adv_order = 5): matches partial(Vq, y) for q [x, y_stag, lev] and the advecting mass flux V [x, y, lev], V = (rv[j] + rv[j+1])/2, the consumer’s average of rv to the MASS points [x, y, lev] (WRF: 0.5(rv(i,k,j)+rv(i,k,j-1)) for the flux between v(j-1) and v(j)), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfvyrdy); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_y): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NY] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). q is a face field along y with NY+1 points whose last duplicates the first; the rule reads only points 1..NY of q and of V (wrapping V[0] to V[NY]) and returns point NY+1 equal to point 1 (its region applies point 1’s stencil, at j - NY). Exactly conservative: the sum over points 1..NY telescopes to zero. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_w_x_open

op:advection order:5 bc:open axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_w_x_open.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev_nodes]; q is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv23\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [2, 2] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv35\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [3, 3] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv53\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv32\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_x}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [1, 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_x}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum0\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of w along x (module_advect_em.F advect_w, h_mom_adv_order = 5): matches partial(V*q, x) for q [x, y, lev_nodes] and the advecting mass flux V [x_stag, y, lev_nodes], U = fnm[k] ru[k] + fnp[k] ru[k-1], the consumer’s interpolation of ru to the w levels [x_stag, y, lev_nodes] (WRF: vel = fzm(k)*ru(i,k,j)+fzp(k)*ru(i,k-1,j), and the extrapolation (2-fzm(k-1))ru(k-1) - fzp(k-1)ru(k-2) at the top level k = NLEV+1), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior, wrf_adv23_x, wrf_adv35_x, wrf_adv53_x and wrf_adv32_x (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_x / wrf_outflow_hi_x on the edge points. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msftxrdx); the map factor stays in the component’s equation. The w levels: the rule covers lev_nodes 2..NLEV+1 and gives 0 at lev_nodes 1, the ground, where WRF does not advect w (w there is set by the kinematic lower boundary condition). OPEN BOUNDARIES (open_xs, open_xe): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_xs / degrade_xe). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min((V[1] + V[2])/2, 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max((V[N] + V[N+1])/2, 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the mean of the edge cell’s two faces. WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF omits the map factor on these two points (it multiplies by rd alone): the identity in idealized cases, a discrepancy on a real map projection that the consumer reproduces only by masking. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_w_x_periodic

op:advection order:5 bc:periodic axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_w_x_periodic.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev_nodes]; q is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [1, 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [2, 2] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [3, 3] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NX}, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1 - \mathit{NX}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, 2 \le k \le \mathit{NLEV} + 1} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum0\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of w along x (module_advect_em.F advect_w, h_mom_adv_order = 5): matches partial(V*q, x) for q [x, y, lev_nodes] and the advecting mass flux V [x_stag, y, lev_nodes], U = fnm[k] ru[k] + fnp[k] ru[k-1], the consumer’s interpolation of ru to the w levels [x_stag, y, lev_nodes] (WRF: vel = fzm(k)*ru(i,k,j)+fzp(k)*ru(i,k-1,j), and the extrapolation (2-fzm(k-1))ru(k-1) - fzp(k-1)ru(k-2) at the top level k = NLEV+1), and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msftxrdx); the map factor stays in the component’s equation. The w levels: the rule covers lev_nodes 2..NLEV+1 and gives 0 at lev_nodes 1, the ground, where WRF does not advect w (w there is set by the kinematic lower boundary condition). PERIODIC CLOSURE (periodic_x): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NX] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NX reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NX+1] and is flux-conservative for any V: the sum of the result along x telescopes to zero. WRF’s halo makes V[NX+1] = V[1], so this is WRF’s result. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_w_y_open

op:advection order:5 bc:open axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_w_y_open.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev_nodes]; q is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv23\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [2, 2] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv35\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [3, 3] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv53\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv32\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_y}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, 1] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_y}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum0\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of w along y (module_advect_em.F advect_w, h_mom_adv_order = 5): matches partial(Vq, y) for q [x, y, lev_nodes] and the advecting mass flux V [x, y_stag, lev_nodes], V = fnm[k] rv[k] + fnp[k] rv[k-1], the consumer’s interpolation of rv to the w levels [x, y_stag, lev_nodes] (with WRF’s extrapolation at the top level, as for U along x), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior, wrf_adv23_y, wrf_adv35_y, wrf_adv53_y and wrf_adv32_y (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_y / wrf_outflow_hi_y on the edge points. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfty*rdy); the map factor stays in the component’s equation. The w levels: the rule covers lev_nodes 2..NLEV+1 and gives 0 at lev_nodes 1, the ground, where WRF does not advect w (w there is set by the kinematic lower boundary condition). OPEN BOUNDARIES (open_ys, open_ye): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_ys / degrade_ye). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min((V[1] + V[2])/2, 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max((V[N] + V[N+1])/2, 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the mean of the edge cell’s two faces. WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF omits the map factor on these two points (it multiplies by rd alone): the identity in idealized cases, a discrepancy on a real map projection that the consumer reproduces only by masking. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_w_y_periodic

op:advection order:5 bc:periodic axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_w_y_periodic.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev_nodes]; q is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, 1] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [2, 2] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [3, 3] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [2, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NY}, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1 - \mathit{NY}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, 2 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [2, \mathit{NLEV} + 1] \\ \left[\sum0\right]_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of w along y (module_advect_em.F advect_w, h_mom_adv_order = 5): matches partial(Vq, y) for q [x, y, lev_nodes] and the advecting mass flux V [x, y_stag, lev_nodes], V = fnm[k] rv[k] + fnp[k] rv[k-1], the consumer’s interpolation of rv to the w levels [x, y_stag, lev_nodes] (with WRF’s extrapolation at the top level, as for U along x), and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfty*rdy); the map factor stays in the component’s equation. The w levels: the rule covers lev_nodes 2..NLEV+1 and gives 0 at lev_nodes 1, the ground, where WRF does not advect w (w there is set by the kinematic lower boundary condition). PERIODIC CLOSURE (periodic_y): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NY] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NY reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NY+1] and is flux-conservative for any V: the sum of the result along y telescopes to zero. WRF’s halo makes V[NY+1] = V[1], so this is WRF’s result. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_x_open

op:advection order:5 bc:open axes:x,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_x_open.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev]; q is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y, k \in \mathit{lev}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_x}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_x}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of a mass-point field (theta, moisture, any scalar) along x (module_advect_em.F advect_scalar, h_sca_adv_order = 5): matches partial(Vq, x) for q [x, y, lev] and the advecting mass flux V [x_stag, y, lev], U = ru, the face mass flux mu u/m_y on the x faces, and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior, wrf_adv23_x, wrf_adv35_x, wrf_adv53_x and wrf_adv32_x (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_x / wrf_outflow_hi_x on the edge points. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msftx*rdx); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_xs, open_xe): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_xs / degrade_xe). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min((V[1] + V[2])/2, 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max((V[N] + V[N+1])/2, 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the mean of the edge cell’s two faces. WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF omits the map factor on these two points (it multiplies by rd alone): the identity in idealized cases, a discrepancy on a real map projection that the consumer reproduces only by masking. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_x_periodic

op:advection order:5 bc:periodic axes:x,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_x_periodic.esm

Rewrites \(\frac{\partial}{\partial x} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev]; q is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{4 \le i \le \mathit{NX} - 3, j \in y, k \in \mathit{lev}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_x}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NX}, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1 - \mathit{NX}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of a mass-point field (theta, moisture, any scalar) along x (module_advect_em.F advect_scalar, h_sca_adv_order = 5): matches partial(Vq, x) for q [x, y, lev] and the advecting mass flux V [x_stag, y, lev], U = ru, the face mass flux mu u/m_y on the x faces, and lowers it to rdx (phi[r+1] - phi[r]) at the points r of q along x, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_x (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, x) with the map factor of the point (WRF msftx*rdx); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_x): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NX] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NX reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NX+1] and is flux-conservative for any V: the sum of the result along x telescopes to zero. WRF’s halo makes V[NX+1] = V[1], so this is WRF’s result. NX >= 6: below that the regions overlap (at NX = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_advection_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_advection_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
82.788e-03—5.394e-03—
169.387e-054.891.867e-044.85
322.988e-064.975.950e-064.97
649.380e-084.991.876e-074.99

Expected order: 5 (± 0.3).

Convergence of wrf_advection_xy_periodic (log-log)

wrf_adv5_y_open

op:advection order:5 bc:open axes:x,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_y_open.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev]; q is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv23\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv35\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv53\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv32\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_lo\_y}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_outflow\_hi\_y}(V = V, a_{\mathrm{hi}} = 0.5, a_{\mathrm{lo}} = 0.5, i = i, j = j, k = k, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of a mass-point field (theta, moisture, any scalar) along y (module_advect_em.F advect_scalar, h_sca_adv_order = 5): matches partial(Vq, y) for q [x, y, lev] and the advecting mass flux V [x, y_stag, lev], V = rv, the face mass flux mu v/m_x on the y faces, and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior, wrf_adv23_y, wrf_adv35_y, wrf_adv53_y and wrf_adv32_y (the degraded orders) at the second and third points from each edge, and wrf_outflow_lo_y / wrf_outflow_hi_y on the edge points. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfty*rdy); the map factor stays in the component’s equation. OPEN BOUNDARIES (open_ys, open_ye): WRF degrades the flux next to the boundary, second order (wrf_flux2) for the flux between the first two and the last two points, third order (wrf_flux3) for the next one in, fifth order inside (module_advect_em.F, degrade_ys / degrade_ye). At the boundary points themselves WRF switches to the advective form with outflow upwinding (the ‘radiation boundary conditions that do not require cb’ block): at point 1, rd ((min((V[1] + V[2])/2, 0) (q[2] - q[1]) + q[1] (V[2] - V[1])), and at the last point N, rd (max((V[N] + V[N+1])/2, 0) (q[N] - q[N-1]) + q[N] (V[N+1] - V[N])), i.e. q dV/dx plus the outflow part of V dq/dx; inflow contributes nothing to V dq/dx. The outflow speed is the mean of the edge cell’s two faces. WRF evaluates the upwind difference at the step’s starting state (field_old); rk_tendency passes the current state for both, so this is exact there. WRF omits the map factor on these two points (it multiplies by rd alone): the identity in idealized cases, a discrepancy on a real map projection that the consumer reproduces only by masking. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_adv5_y_periodic

op:advection order:5 bc:periodic axes:x,y,lev stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_adv5_y_periodic.esm

Rewrites \(\frac{\partial}{\partial y} \left(V q\right)\) at priority 10 — match pattern:

{"op": "partial", "args": [{"op": "*", "args": ["V", "q"]}], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev]; q is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV}] \\ \left[\sum\operatorname{wrf\_adv55\_y}(V = V, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NY}, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1 - \mathit{NY}, o_{\mathrm{vlo}} = 0, q = q)\right]^{\{V, q\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

WRF-ARW fifth-order flux-form advection of a mass-point field (theta, moisture, any scalar) along y (module_advect_em.F advect_scalar, h_sca_adv_order = 5): matches partial(Vq, y) for q [x, y, lev] and the advecting mass flux V [x, y_stag, lev], V = rv, the face mass flux mu v/m_x on the y faces, and lowers it to rdy (phi[r+1] - phi[r]) at the points r of q along y, phi[r] the flux between points r-1 and r: wrf_flux5 (WRF flux5, upwind-biased fifth order) wherever the stencil fits. Every region applies one per-point stencil (grids/wrf_arw_c/stencils), so the scheme is written once and the rule only says where each piece applies: wrf_adv55_y (fifth order through both flux faces) in the interior and at the wrapped end points, which bind their neighbours’ wrapped offsets. A consuming component writes WRF’s term as -m partial(Vq, y) with the map factor of the point (WRF msfty*rdy); the map factor stays in the component’s equation. PERIODIC CLOSURE (periodic_y): WRF’s halo fill makes the full stencil apply at every point; here the points near the ends read their wrapped neighbours explicitly (q[r + NY] = q[r]; esm-spec 9.6.8, the boundary condition inside the rule). The last point NY reads its high flux face from V[1], the face it shares with point 1 across the seam, so the rule never reads V[NY+1] and is flux-conservative for any V: the sum of the result along y telescopes to zero. WRF’s halo makes V[NY+1] = V[1], so this is WRF’s result. NY >= 6: below that the regions overlap (at NY = 6 the interior region folds empty).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_advection_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_advection_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
82.788e-03—5.394e-03—
169.387e-054.891.867e-044.85
322.988e-064.975.950e-064.97
649.380e-084.991.876e-074.99

Expected order: 5 (± 0.3).

Convergence of wrf_advection_xy_periodic (log-log)

wrf_diff_lev

op:gradient order:2 bc:any axes:x,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\mathit{rdnw}_{k} \left(f_{i, j, k + 1} - f_{i, j, k}\right)\right]^{\{f\}}_{i \in x, j \in y, k \in \mathit{lev}}$$

The WRF-ARW derivative with respect to eta of an interface field onto the layers: matches partial(f, lev) for f [x, y, lev_nodes] and lowers it to rdnw[k] (f[k+1] - f[k]) on layer k, shape [x, y, lev] (rdnw = 1/dnw, the consumer’s free name, negative). It is the rdnw(k)*(dpn(i,k+1)-dpn(i,k)) of horizontal_pressure_gradient’s non-hydrostatic term, with dpn the pressure interpolated to the interfaces by wrf_interp_lev, and the vertical part of the acoustic step’s divergence. Both ends of every layer are interfaces, so no boundary condition is involved.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_lev_nodes

op:gradient order:2 bc:wall axes:x,y,lev_nodes stencil width 3 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev_nodes.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\mathit{rdn}_{k} \left(f_{i, j, k} - f_{i, j, k - 1}\right)\right]^{\{f\}}_{i \in x, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum2 \mathit{rdnw}_{1} \left(f_{i, j, 1} - \operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right)\right]^{\{f\}}_{i \in x, j \in y, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum2 \mathit{rdnw}_{\mathit{NLEV}} \left(0 - f_{i, j, \mathit{NLEV}}\right)\right]^{\{f\}}_{i \in x, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW derivative with respect to eta of a layer field onto the interfaces: matches partial(f, lev) for f [x, y, lev] and lowers it to rdn[k] (f[k] - f[k-1]) on the interior interfaces k = 2..NLEV (rdn = 1/(eta_u(k) - eta_u(k-1)), the consumer’s free name over lev_nodes, negative), shape [x, y, lev_nodes]. It is the vertical pressure gradient of the w equation (module_big_step_utilities_em.F pg_buoy_w: rdn(k)*(p(i,k,j) - p(i,k-1,j))). The two ends take the boundary values wrf_interp_lev puts there: at the model top (k = NLEV+1) the field is 0 (a perturbation pressure without top_lid) and the derivative is the half-layer difference 2 rdnw[NLEV] (0 - f[NLEV]), which is pg_buoy_w’s k = kde row; at the ground (k = 1) the field is extrapolated with wrf_ground_extrap (grid.esm), cf1 f[1] + cf2 f[2] + cf3 f[3], and the derivative is 2 rdnw[1] (f[1] - that value). WRF applies no w tendency at the ground, so that end is a closure for completeness. rdnw [lev] and cf1-cf3 are the consumer’s free names.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_lev_nodes_u

op:gradient order:2 bc:wall axes:x_stag,y,lev_nodes stencil width 3 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev_nodes_u.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\mathit{rdn}_{k} \left(f_{i, j, k} - f_{i, j, k - 1}\right)\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [2, \mathit{NLEV}] \\ \left[\sum2 \mathit{rdnw}_{1} \left(f_{i, j, 1} - \operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right)\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, 1 \le k \le 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, 1] \\ \left[\sum2 \mathit{rdnw}_{\mathit{NLEV}} \left(0 - f_{i, j, \mathit{NLEV}}\right)\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW derivative with respect to eta of a layer field on the u points onto the interfaces: matches partial(f, lev) for f [x_stag, y, lev] and lowers it to rdn[k] (f[k] - f[k-1]) on the interior interfaces k = 2..NLEV (rdn, the consumer’s free name over lev_nodes, negative), shape [x_stag, y, lev_nodes]. The u-point overload of wrf_diff_lev_nodes, with the same closures at the two ends: 2 rdnw[NLEV] (0 - f[NLEV]) at the model top and 2 rdnw[1] (f[1] - wrf_ground_extrap) at the ground. The interior is the gradient in WRF’s vertical diffusion of u (module_big_step_utilities_em.F vertical_diffusion_u: rdn(k+1)*(field(i,k+1,j)-field(i,k,j)) for the flux through interface k+1); that routine sets its own end fluxes (a frozen lowest layer and an undiffused top layer), so a consumer of the ends there overrides them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_lev_nodes_v

op:gradient order:2 bc:wall axes:x,y_stag,lev_nodes stencil width 3 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev_nodes_v.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\mathit{rdn}_{k} \left(f_{i, j, k} - f_{i, j, k - 1}\right)\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, 2 \le k \le \mathit{NLEV}} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [2, \mathit{NLEV}] \\ \left[\sum2 \mathit{rdnw}_{1} \left(f_{i, j, 1} - \operatorname{wrf\_ground\_extrap}(f_{\mathrm{1}} = f_{i, j, 1}, f_{\mathrm{2}} = f_{i, j, 2}, f_{\mathrm{3}} = f_{i, j, 3})\right)\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, 1 \le k \le 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, 1] \\ \left[\sum2 \mathit{rdnw}_{\mathit{NLEV}} \left(0 - f_{i, j, \mathit{NLEV}}\right)\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, \mathit{NLEV} + 1 \le k \le \mathit{NLEV} + 1} & [1, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [\mathit{NLEV} + 1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW derivative with respect to eta of a layer field on the v points onto the interfaces: matches partial(f, lev) for f [x, y_stag, lev] and lowers it to rdn[k] (f[k] - f[k-1]) on the interior interfaces k = 2..NLEV (rdn, the consumer’s free name over lev_nodes, negative), shape [x, y_stag, lev_nodes]. The v-point overload of wrf_diff_lev_nodes, with the same closures at the two ends: 2 rdnw[NLEV] (0 - f[NLEV]) at the model top and 2 rdnw[1] (f[1] - wrf_ground_extrap) at the ground. The interior is the gradient in WRF’s vertical diffusion of v (module_big_step_utilities_em.F vertical_diffusion_v: rdn(k+1)*(field(i,k+1,j)-field(i,k,j)) for the flux through interface k+1); that routine sets its own end fluxes (a frozen lowest layer and an undiffused top layer), so a consumer of the ends there overrides them.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_lev_u

op:gradient order:2 bc:any axes:x_stag,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev_u.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x_stag, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\mathit{rdnw}_{k} \left(f_{i, j, k + 1} - f_{i, j, k}\right)\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, j \in y, k \in \mathit{lev}}$$

The WRF-ARW derivative with respect to eta of an interface field on the u points onto the layers: matches partial(f, lev) for f [x_stag, y, lev_nodes] and lowers it to rdnw[k] (f[k+1] - f[k]) on layer k, shape [x_stag, y, lev] (rdnw = 1/dnw, the consumer’s free name, negative). The u-point overload of wrf_diff_lev. It is the outer derivative of WRF’s vertical diffusion of u (module_big_step_utilities_em.F vertical_diffusion_u: rdnw(k)*(vflux(i,k)-vflux(i,k-1)), with vflux(k) the flux through the top of layer k, i.e. interface k+1 here). Both ends of every layer are interfaces, so no boundary condition is involved.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_lev_v

op:gradient order:2 bc:any axes:x,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_lev_v.esm

Rewrites \(\frac{\partial f}{\partial\mathit{lev}}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y_stag, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\mathit{rdnw}_{k} \left(f_{i, j, k + 1} - f_{i, j, k}\right)\right]^{\{f\}}_{i \in x, j \in y_{\mathrm{stag}}, k \in \mathit{lev}}$$

The WRF-ARW derivative with respect to eta of an interface field on the v points onto the layers: matches partial(f, lev) for f [x, y_stag, lev_nodes] and lowers it to rdnw[k] (f[k+1] - f[k]) on layer k, shape [x, y_stag, lev] (rdnw = 1/dnw, the consumer’s free name, negative). The v-point overload of wrf_diff_lev. It is the outer derivative of WRF’s vertical diffusion of v (module_big_step_utilities_em.F vertical_diffusion_v: rdnw(k)*(vflux(i,k)-vflux(i,k-1)), with vflux(k) the flux through the top of layer k, i.e. interface k+1 here). Both ends of every layer are interfaces, so no boundary condition is involved.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_x_open

op:gradient order:2 bc:open axes:x_stag,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_open.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\mathit{rdx} \left(f_{i, j, k} - f_{i - 1, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a mass-point field onto the x faces: matches partial(f, x) for f [x, y, lev] and lowers it to rdx (f[i] - f[i-1]) on face i of x_stag (the face between cells i-1 and i), shape [x_stag, y, lev]. This is every horizontal difference of WRF’s large-step pressure gradient (module_big_step_utilities_em.F horizontal_pressure_gradient: p, pb, the layer-mean geopotential and php, each differenced across the face and multiplied by a face-averaged coefficient, see wrf_avg_x_open) and of the acoustic step’s (module_small_step_em.F advance_uv). OPEN or specified boundaries: 0 on the edge faces 1 and NX+1, where WRF applies no pressure gradient (horizontal_pressure_gradient starts at its+1 and stops at ite-1 on an open, specified or nested edge; the normal velocity there evolves by the boundary condition). Import either this rule or wrf_diff_x_periodic for a model, not both: they match the same derivative at the same priority, so with both imported the first declared would apply silently.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_x_periodic

op:gradient order:2 bc:periodic axes:x_stag,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_periodic.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\mathit{rdx} \left(f_{i, j, k} - f_{i - 1, j, k}\right)\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\mathit{rdx} \left(f_{1, j, k} - f_{\mathit{NX}, j, k}\right)\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\mathit{rdx} \left(f_{1, j, k} - f_{\mathit{NX}, j, k}\right)\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a mass-point field onto the x faces: matches partial(f, x) for f [x, y, lev] and lowers it to rdx (f[i] - f[i-1]) on face i of x_stag (the face between cells i-1 and i), shape [x_stag, y, lev]. This is every horizontal difference of WRF’s large-step pressure gradient (module_big_step_utilities_em.F horizontal_pressure_gradient: p, pb, the layer-mean geopotential and php, each differenced across the face and multiplied by a face-averaged coefficient, see wrf_avg_x_periodic) and of the acoustic step’s (module_small_step_em.F advance_uv). PERIODIC (periodic_x): the edge faces 1 and NX+1 are the same face, rdx (f[1] - f[NX]). Import either this rule or wrf_diff_x_open for a model, not both: they match the same derivative at the same priority, so with both imported the first declared would apply silently.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_x_v_open

op:gradient order:2 bc:open axes:x_stag,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_v_open.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a field on the v points onto the corners of the horizontal grid (the v faces along x, x_stag x y_stag): matches partial(f, x) for f [x, y_stag, lev] and lowers it to rdx (f[i] - f[i-1]) on face i (the face between points i-1 and i), shape [x_stag, y_stag, lev]. It is the cross-derivative of v in WRF’s horizontal diffusion of v (horizontal_diffusion ‘v’: field(i,k,j)-field(i-1,k,j) times the four-cell mean of (c1 mu + c2) and K at the corner); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). OPEN or specified boundaries: 0 on the edge faces 1 and NX+1, which only feed the edge points WRF does not diffuse there (horizontal_diffusion starts at ids+1 and stops one short of the last point on an open, specified or nested edge; see wrf_interior_x). Import either this rule or its periodic twin for a model, not both: they match the same derivative at the same priority. The interior faces apply the two-point difference wrf_flux_div (stencils/).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_x_v_periodic

op:gradient order:2 bc:periodic axes:x_stag,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_v_periodic.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{2 \le i \le \mathit{NX}, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [2, \mathit{NX}] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i + \left(\mathit{NX} - 1\right), j, k}, \mathit{rd} = \mathit{rdx})\right]_{1 \le i \le 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [1, 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i - \mathit{NX}, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y_{\mathrm{stag}}, k \in \mathit{lev}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a field on the v points onto the corners of the horizontal grid (the v faces along x, x_stag x y_stag): matches partial(f, x) for f [x, y_stag, lev] and lowers it to rdx (f[i] - f[i-1]) on face i (the face between points i-1 and i), shape [x_stag, y_stag, lev]. It is the cross-derivative of v in WRF’s horizontal diffusion of v (horizontal_diffusion ‘v’: field(i,k,j)-field(i-1,k,j) times the four-cell mean of (c1 mu + c2) and K at the corner); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). PERIODIC (periodic_x): the edge faces 1 and NX+1 are the same face, rdx (f[1] - f[NX]). Import either this rule or its open twin for a model, not both: they match the same derivative at the same priority. Every face applies the two-point difference wrf_flux_div (stencils/); the seam faces bind the wrapped neighbour by offset from the loop index, f[i + NX - 1] at face 1 and f[i - NX] at face NX+1, so the formula is written once.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_v_x_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_v_x_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—4.784e-02—
161.269e-022.031.244e-021.94
323.156e-032.013.141e-031.99
647.880e-042.007.871e-042.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_v_x_periodic (log-log)

wrf_diff_x_w_open

op:gradient order:2 bc:open axes:x_stag,y,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_w_open.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a field on the w points (mass columns at the interfaces) onto the x faces at the interfaces: matches partial(f, x) for f [x, y, lev_nodes] and lowers it to rdx (f[i] - f[i-1]) on face i (the face between points i-1 and i), shape [x_stag, y, lev_nodes]. It is the horizontal diffusion of w (horizontal_diffusion ‘w’: field(i,k,j)-field(i-1,k,j) on the x faces, likewise along y, times the face mean of (c1f mu + c2f) and of K at the interface); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). OPEN or specified boundaries: 0 on the edge faces 1 and NX+1, which only feed the edge points WRF does not diffuse there (horizontal_diffusion starts at ids+1 and stops one short of the last point on an open, specified or nested edge; see wrf_interior_x). Import either this rule or its periodic twin for a model, not both: they match the same derivative at the same priority. The interior faces apply the two-point difference wrf_flux_div (stencils/).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_x_w_periodic

op:gradient order:2 bc:periodic axes:x_stag,y,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_x_w_periodic.esm

Rewrites \(\frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{2 \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [2, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i + \left(\mathit{NX} - 1\right), j, k}, \mathit{rd} = \mathit{rdx})\right]_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i - \mathit{NX}, j, k}, F_{\mathrm{lo}} = f_{i - 1, j, k}, \mathit{rd} = \mathit{rdx})\right]_{\mathit{NX} + 1 \le i \le \mathit{NX} + 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} + 1, \mathit{NX} + 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along x of a field on the w points (mass columns at the interfaces) onto the x faces at the interfaces: matches partial(f, x) for f [x, y, lev_nodes] and lowers it to rdx (f[i] - f[i-1]) on face i (the face between points i-1 and i), shape [x_stag, y, lev_nodes]. It is the horizontal diffusion of w (horizontal_diffusion ‘w’: field(i,k,j)-field(i-1,k,j) on the x faces, likewise along y, times the face mean of (c1f mu + c2f) and of K at the interface); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). PERIODIC (periodic_x): the edge faces 1 and NX+1 are the same face, rdx (f[1] - f[NX]). Import either this rule or its open twin for a model, not both: they match the same derivative at the same priority. Every face applies the two-point difference wrf_flux_div (stencils/); the seam faces bind the wrapped neighbour by offset from the loop index, f[i + NX - 1] at face 1 and f[i - NX] at face NX+1, so the formula is written once.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_w_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_w_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—9.568e-02—
161.269e-022.032.489e-021.94
323.156e-032.016.282e-031.99
647.880e-042.001.574e-032.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_w_xy_periodic (log-log)

wrf_diff_y_open

op:gradient order:2 bc:open axes:x,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_open.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\mathit{rdy} \left(f_{i, j, k} - f_{i, j - 1, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a mass-point field onto the y faces: matches partial(f, y) for f [x, y, lev] and lowers it to rdy (f[j] - f[j-1]) on face j of y_stag (the face between cells j-1 and j), shape [x, y_stag, lev]. This is every horizontal difference of WRF’s large-step pressure gradient (module_big_step_utilities_em.F horizontal_pressure_gradient: p, pb, the layer-mean geopotential and php, each differenced across the face and multiplied by a face-averaged coefficient, see wrf_avg_y_open) and of the acoustic step’s (module_small_step_em.F advance_uv). OPEN or specified boundaries: 0 on the edge faces 1 and NY+1, where WRF applies no pressure gradient (horizontal_pressure_gradient starts at its+1 and stops at ite-1 on an open, specified or nested edge; the normal velocity there evolves by the boundary condition). Import either this rule or wrf_diff_y_periodic for a model, not both: they match the same derivative at the same priority, so with both imported the first declared would apply silently.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_y_periodic

op:gradient order:2 bc:periodic axes:x,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_periodic.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\mathit{rdy} \left(f_{i, j, k} - f_{i, j - 1, k}\right)\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\mathit{rdy} \left(f_{i, 1, k} - f_{i, \mathit{NY}, k}\right)\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\mathit{rdy} \left(f_{i, 1, k} - f_{i, \mathit{NY}, k}\right)\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a mass-point field onto the y faces: matches partial(f, y) for f [x, y, lev] and lowers it to rdy (f[j] - f[j-1]) on face j of y_stag (the face between cells j-1 and j), shape [x, y_stag, lev]. This is every horizontal difference of WRF’s large-step pressure gradient (module_big_step_utilities_em.F horizontal_pressure_gradient: p, pb, the layer-mean geopotential and php, each differenced across the face and multiplied by a face-averaged coefficient, see wrf_avg_y_periodic) and of the acoustic step’s (module_small_step_em.F advance_uv). PERIODIC (periodic_y): the edge faces 1 and NY+1 are the same face, rdy (f[1] - f[NY]). Import either this rule or wrf_diff_y_open for a model, not both: they match the same derivative at the same priority, so with both imported the first declared would apply silently.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_diff_y_u_open

op:gradient order:2 bc:open axes:x_stag,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_u_open.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum0\right]^{\{f\}}_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a field on the u points onto the corners of the horizontal grid (the u faces along y, x_stag x y_stag): matches partial(f, y) for f [x_stag, y, lev] and lowers it to rdy (f[j] - f[j-1]) on face j (the face between points j-1 and j), shape [x_stag, y_stag, lev]. It is the cross-derivative of u in WRF’s horizontal diffusion of u (horizontal_diffusion ‘u’: field(i,k,j)-field(i,k,j-1) times the four-cell mean of (c1 mu + c2) and K at the corner); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). OPEN or specified boundaries: 0 on the edge faces 1 and NY+1, which only feed the edge points WRF does not diffuse there (horizontal_diffusion starts at ids+1 and stops one short of the last point on an open, specified or nested edge; see wrf_interior_y). Import either this rule or its periodic twin for a model, not both: they match the same derivative at the same priority. The interior faces apply the two-point difference wrf_flux_div (stencils/).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_y_u_periodic

op:gradient order:2 bc:periodic axes:x_stag,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_u_periodic.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x_{\mathrm{stag}}, 2 \le j \le \mathit{NY}, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [2, \mathit{NY}] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j + \left(\mathit{NY} - 1\right), k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x_{\mathrm{stag}}, 1 \le j \le 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [1, 1] \times [1, \mathit{NLEV}] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j - \mathit{NY}, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x_{\mathrm{stag}}, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev}} & [1, \mathit{NX} + 1] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV}] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a field on the u points onto the corners of the horizontal grid (the u faces along y, x_stag x y_stag): matches partial(f, y) for f [x_stag, y, lev] and lowers it to rdy (f[j] - f[j-1]) on face j (the face between points j-1 and j), shape [x_stag, y_stag, lev]. It is the cross-derivative of u in WRF’s horizontal diffusion of u (horizontal_diffusion ‘u’: field(i,k,j)-field(i,k,j-1) times the four-cell mean of (c1 mu + c2) and K at the corner); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). PERIODIC (periodic_y): the edge faces 1 and NY+1 are the same face, rdy (f[1] - f[NY]). Import either this rule or its open twin for a model, not both: they match the same derivative at the same priority. Every face applies the two-point difference wrf_flux_div (stencils/); the seam faces bind the wrapped neighbour by offset from the loop index, f[j + NY - 1] at face 1 and f[j - NY] at face NY+1, so the formula is written once.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_u_y_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_u_y_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—4.784e-02—
161.269e-022.031.244e-021.94
323.156e-032.013.141e-031.99
647.880e-042.007.871e-042.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_u_y_periodic (log-log)

wrf_diff_y_w_open

op:gradient order:2 bc:open axes:x,y_stag,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_w_open.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum0\right]^{\{f\}}_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a field on the w points (mass columns at the interfaces) onto the y faces at the interfaces: matches partial(f, y) for f [x, y, lev_nodes] and lowers it to rdy (f[j] - f[j-1]) on face j (the face between points j-1 and j), shape [x, y_stag, lev_nodes]. It is the horizontal diffusion of w (horizontal_diffusion ‘w’: field(i,k,j)-field(i-1,k,j) on the x faces, likewise along y, times the face mean of (c1f mu + c2f) and of K at the interface); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). OPEN or specified boundaries: 0 on the edge faces 1 and NY+1, which only feed the edge points WRF does not diffuse there (horizontal_diffusion starts at ids+1 and stops one short of the last point on an open, specified or nested edge; see wrf_interior_y). Import either this rule or its periodic twin for a model, not both: they match the same derivative at the same priority. The interior faces apply the two-point difference wrf_flux_div (stencils/).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

wrf_diff_y_w_periodic

op:gradient order:2 bc:periodic axes:x,y_stag,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_diff_y_w_periodic.esm

Rewrites \(\frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["f"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x, 2 \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j, k}, F_{\mathrm{lo}} = f_{i, j + \left(\mathit{NY} - 1\right), k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\limits\operatorname{wrf\_flux\_div}(F_{\mathrm{hi}} = f_{i, j - \mathit{NY}, k}, F_{\mathrm{lo}} = f_{i, j - 1, k}, \mathit{rd} = \mathit{rdy})\right]_{i \in x, \mathit{NY} + 1 \le j \le \mathit{NY} + 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} + 1, \mathit{NY} + 1] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

The WRF-ARW C-grid two-point derivative along y of a field on the w points (mass columns at the interfaces) onto the y faces at the interfaces: matches partial(f, y) for f [x, y, lev_nodes] and lowers it to rdy (f[j] - f[j-1]) on face j (the face between points j-1 and j), shape [x, y_stag, lev_nodes]. It is the horizontal diffusion of w (horizontal_diffusion ‘w’: field(i,k,j)-field(i-1,k,j) on the x faces, likewise along y, times the face mean of (c1f mu + c2f) and of K at the interface); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). PERIODIC (periodic_y): the edge faces 1 and NY+1 are the same face, rdy (f[1] - f[NY]). Import either this rule or its open twin for a model, not both: they match the same derivative at the same priority. Every face applies the two-point difference wrf_flux_div (stencils/); the seam faces bind the wrapped neighbour by offset from the loop index, f[j + NY - 1] at face 1 and f[j - NY] at face NY+1, so the formula is written once.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_w_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_w_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—9.568e-02—
161.269e-022.032.489e-021.94
323.156e-032.016.282e-031.99
647.880e-042.001.574e-032.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_w_xy_periodic (log-log)

wrf_div_x

op:divergence order:2 bc:any axes:x,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_x.esm

Rewrites \(\frac{\partial U}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x_stag, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdx} \left(U_{i + 1, j, k} - U_{i, j, k}\right)\right]_{i \in x, j \in y, k \in \mathit{lev}}$$

The WRF-ARW C-grid flux divergence along x: matches partial(U, x) for a face field U [x_stag, y, lev] (a mass flux such as ru = mu u/m_y) and lowers it to rdx (U[i+1] - U[i]) at the mass points [x, y, lev]. Every cell has both of its faces, so no boundary condition is involved. This is the divergence of calc_ww_cp (module_big_step_utilities_em.F) and of the acoustic step’s mass and theta updates (module_small_step_em.F advance_mu_t: rdx*(ru(i+1)-ru(i)) + rdy*(rv(j+1)-rv(j))), and the x part of the flux-form advection at second order. A consuming component multiplies by the mass-point map factor.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_div_x_2d

op:gradient order:2 bc:any axes:x,y stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_x_2d.esm

Rewrites \(\frac{\partial U}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x_stag, y]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\left(U_{i + 1, j} - U_{i, j}\right) \mathit{rdx}\right]_{i \in x, j \in y}$$

The WRF-ARW C-grid difference along x of a horizontal (column) field on the x faces onto the cells: matches partial(U, x) for U [x_stag, y] and lowers it to rdx (U[i+1] - U[i]) at the mass points, shape [x, y]. Every cell has both of its faces, so no boundary condition is involved. Use: the gradients of the map factors in WRF’s curvature term (module_big_step_utilities_em.F curvature, vxgm: (msfvx(i,j+1)-msfvx(i,j))*rdy and (msfuy(i+1,j)-msfuy(i,j))*rdx). The 2-D counterpart of wrf_div_x.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_div_x_v

op:divergence order:2 bc:any axes:x,y_stag,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_x_v.esm

Rewrites \(\frac{\partial U}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x_stag, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdx} \left(U_{i + 1, j, k} - U_{i, j, k}\right)\right]_{i \in x, j \in y_{\mathrm{stag}}, k \in \mathit{lev}}$$

The WRF-ARW C-grid flux divergence along x of a flux on the corners (x_stag x y_stag) onto the v points: matches partial(U, x) for U [x_stag, y_stag, lev] and lowers it to rdx (U[i+1] - U[i]), shape [x, y_stag, lev]. Every point has both of its faces, so no boundary condition is involved. It is the outer derivative of the cross term of v’s horizontal diffusion (horizontal_diffusion ‘v’: mrdx*(mkrdxp*(…) - mkrdxm*(…)), the corner fluxes at i+1 and i); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). A consuming component multiplies by the map factors of the point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_v_x_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_v_x_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—4.784e-02—
161.269e-022.031.244e-021.94
323.156e-032.013.141e-031.99
647.880e-042.007.871e-042.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_v_x_periodic (log-log)

wrf_div_x_w

op:divergence order:2 bc:any axes:x,y,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_x_w.esm

Rewrites \(\frac{\partial U}{\partial x}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "x"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x_stag, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdx} \left(U_{i + 1, j, k} - U_{i, j, k}\right)\right]_{i \in x, j \in y, k \in \mathit{lev\_nodes}}$$

The WRF-ARW C-grid flux divergence along x of a flux on the x faces at the interfaces onto the w points (mass columns at the interfaces): matches partial(U, x) for U [x_stag, y, lev_nodes] and lowers it to rdx (U[i+1] - U[i]), shape [x, y, lev_nodes]. Every point has both of its faces, so no boundary condition is involved. It is the outer derivative of w’s horizontal diffusion along x; WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). A consuming component multiplies by the map factors of the point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_w_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_w_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—9.568e-02—
161.269e-022.032.489e-021.94
323.156e-032.016.282e-031.99
647.880e-042.001.574e-032.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_w_xy_periodic (log-log)

wrf_div_y

op:divergence order:2 bc:any axes:x,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_y.esm

Rewrites \(\frac{\partial U}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdy} \left(U_{i, j + 1, k} - U_{i, j, k}\right)\right]_{i \in x, j \in y, k \in \mathit{lev}}$$

The WRF-ARW C-grid flux divergence along y: matches partial(U, y) for a face field U [x, y_stag, lev] (a mass flux such as ru = mu u/m_y) and lowers it to rdy (U[j+1] - U[j]) at the mass points [x, y, lev]. Every cell has both of its faces, so no boundary condition is involved. This is the divergence of calc_ww_cp (module_big_step_utilities_em.F) and of the acoustic step’s mass and theta updates (module_small_step_em.F advance_mu_t: rdx*(ru(i+1)-ru(i)) + rdy*(rv(j+1)-rv(j))), and the y part of the flux-form advection at second order. A consuming component multiplies by the mass-point map factor.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_div_y_2d

op:gradient order:2 bc:any axes:x,y stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_y_2d.esm

Rewrites \(\frac{\partial U}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x, y_stag]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\left(U_{i, j + 1} - U_{i, j}\right) \mathit{rdy}\right]_{i \in x, j \in y}$$

The WRF-ARW C-grid difference along y of a horizontal (column) field on the y faces onto the cells: matches partial(U, y) for U [x, y_stag] and lowers it to rdy (U[j+1] - U[j]) at the mass points, shape [x, y]. Every cell has both of its faces, so no boundary condition is involved. Use: the gradients of the map factors in WRF’s curvature term (module_big_step_utilities_em.F curvature, vxgm: (msfvx(i,j+1)-msfvx(i,j))*rdy and (msfuy(i+1,j)-msfuy(i,j))*rdx). The 2-D counterpart of wrf_div_y.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_div_y_u

op:divergence order:2 bc:any axes:x_stag,y,lev stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_y_u.esm

Rewrites \(\frac{\partial U}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x_stag, y_stag, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdy} \left(U_{i, j + 1, k} - U_{i, j, k}\right)\right]_{i \in x_{\mathrm{stag}}, j \in y, k \in \mathit{lev}}$$

The WRF-ARW C-grid flux divergence along y of a flux on the corners (x_stag x y_stag) onto the u points: matches partial(U, y) for U [x_stag, y_stag, lev] and lowers it to rdy (U[j+1] - U[j]), shape [x_stag, y, lev]. Every point has both of its faces, so no boundary condition is involved. It is the outer derivative of the cross term of u’s horizontal diffusion (horizontal_diffusion ‘u’: mrdy*(mkrdyp*(…) - mkrdym*(…)), the corner fluxes at j+1 and j); WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). A consuming component multiplies by the map factors of the point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_u_y_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_u_y_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—4.784e-02—
161.269e-022.031.244e-021.94
323.156e-032.013.141e-031.99
647.880e-042.007.871e-042.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_u_y_periodic (log-log)

wrf_div_y_w

op:divergence order:2 bc:any axes:x,y,lev_nodes stencil width 2 priority 10

Source: grids/wrf_arw_c/rules/wrf_div_y_w.esm

Rewrites \(\frac{\partial U}{\partial y}\) at priority 10 — match pattern:

{"op": "partial", "args": ["U"], "wrt": "y"}
Match scope (esm-spec §9.6.1 where): fires only when U is a bare field shaped [x, y_stag, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum\limits\mathit{rdy} \left(U_{i, j + 1, k} - U_{i, j, k}\right)\right]_{i \in x, j \in y, k \in \mathit{lev\_nodes}}$$

The WRF-ARW C-grid flux divergence along y of a flux on the y faces at the interfaces onto the w points (mass columns at the interfaces): matches partial(U, y) for U [x, y_stag, lev_nodes] and lowers it to rdy (U[j+1] - U[j]), shape [x, y, lev_nodes]. Every point has both of its faces, so no boundary condition is involved. It is the outer derivative of w’s horizontal diffusion along y; WRF’s constant-K diffusion on eta surfaces (diff_opt 1, module_big_step_utilities_em.F horizontal_diffusion: the tendency of a field is m m [ d/dx( K (c1 mu + c2) (m/m) df/dx ) + d/dy( … ) ] with every coefficient taken at the point of the flux). A consuming component multiplies by the map factors of the point.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection) and section 4.2 (explicit spatial diffusion). doi:10.5065/1dfh-6p97

Conformance fixtures

Convergence — case wrf_diffusion_w_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_diffusion_w_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
85.178e-02—9.568e-02—
161.269e-022.032.489e-021.94
323.156e-032.016.282e-031.99
647.880e-042.001.574e-032.00

Expected order: 2 (± 0.2).

Convergence of wrf_diffusion_w_xy_periodic (log-log)

wrf_integral_lev_nodes_cumulative_from_bottom

op:integral order:1 bc:any axes:x,y,lev_nodes priority 10

Source: grids/wrf_arw_c/rules/wrf_integral_lev_nodes_cumulative_from_bottom.esm

Rewrites \(\operatorname{integral}(f; \mathrm{lower} = z_{\mathrm{sfc}}, \mathrm{upper} = \mathit{lev\_nodes}, \mathrm{var} = \mathit{lev})\) at priority 10 — match pattern:

{"op": "integral", "args": ["f"], "lower": "z_sfc", "upper": "lev_nodes", "var": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum_{\substack{m \in \mathit{lev} \\ m < k}} f_{i, j, m} \mathit{dnw}_{m}\right]^{\{f\}}_{i \in x, j \in y, k \in \mathit{lev\_nodes}}$$

Cumulative integral in eta from the ground to each interface on the WRF-ARW grid: matches integral(f, var: lev, lower: z_sfc, upper: lev_nodes) for f [x, y, lev] and lowers it to F[k] = sum over the layers m < k of f[m] dnw[m] on the interfaces k of lev_nodes, shape [x, y, lev_nodes] (F[1] = 0 at the ground, F[NLEV+1] the whole column). dnw [lev] is the consumer’s layer thickness in eta (negative). It is the bottom-up sweep of calc_ww_cp, ww(k) = ww(k-1) - dnw(k-1)*(c1h(k-1) dmdt + divv(k-1)/dnw(k-1)), which unrolls to ww = -integral(c1h dmdt + m_x div, lev, z_sfc, lev_nodes): a prefix sum of the ORIGINAL layer values, so no recurrence is needed. AT THE LID the result at node NLEV+1 is the whole-column integral. WRF instead sets ww(kte) = 0 outright; the two agree analytically (the column sum of c1h dnw is -1, so the dmdt term cancels the column divergence), but this rule’s value carries the roundoff of the sum. A consumer that needs ww to be exactly zero at the lid sets that node itself.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_integral_lev_whole

op:integral order:1 bc:any axes:x,y priority 10

Source: grids/wrf_arw_c/rules/wrf_integral_lev_whole.esm

Rewrites \(\operatorname{integral}(f; \mathrm{lower} = z_{\mathrm{sfc}}, \mathrm{upper} = z_{\mathrm{top}}, \mathrm{var} = \mathit{lev})\) at priority 10 — match pattern:

{"op": "integral", "args": ["f"], "lower": "z_sfc", "upper": "z_top", "var": "lev"}
Match scope (esm-spec §9.6.1 where): fires only when f is a bare field shaped [x, y, lev]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Definition:

$$\left[\sum_{m \in \mathit{lev}} f_{i, j, m} \mathit{dnw}_{m}\right]^{\{f\}}_{i \in x, j \in y}$$

Whole-column integral in eta on the WRF-ARW grid: matches integral(f, var: lev, lower: z_sfc, upper: z_top) for f [x, y, lev] and lowers it to the sum over the layers of f[m] dnw[m], shape [x, y], with dnw [lev] = eta_w(m+1) - eta_w(m) the consumer’s layer thickness in eta (negative: eta falls from 1 at the ground to 0 at the top, so this is the integral from the ground up). It is WRF’s dmdt = sum dnw*divv of calc_ww_cp and advance_mu_t. z_sfc and z_top are the ground names of the column bounds (as in grids/column_nonuniform_1d).

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_vgrad6_x_open

op:advection order:6 bc:open axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_vgrad6_x_open.esm

Rewrites \(V \frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "*", "args": ["V", {"op": "partial", "args": ["f"], "wrt": "x"}]}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev_nodes]; f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{4 \le i \le \mathit{NX} - 3, j \in y, k \in \mathit{lev\_nodes}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad4\_x}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev\_nodes}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad4\_x}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad2\_x}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev\_nodes}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad2\_x}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ 0 & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ 0 & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW advective-form transport of an interface field along x, the horizontal part of the geopotential equation (module_big_step_utilities_em.F rhs_ph, h_sca_adv_order 5 or 6): matches V * partial(f, x) for f [x, y, lev_nodes] (the geopotential phb + ph) and V [x_stag, y, lev_nodes] (the mass-weighted velocity on the x faces at the interfaces, (c1f mu + c2f) u m_u, which the consumer builds with wrf_mid_lev) and lowers it, at the points of f, to the stencil wrf_vgrad6_x: rdx (V[i] + V[i+1])/2 times the centred sixth-order difference (1/60)(45 (f[i+1] - f[i-1]) - 9 (f[i+2] - f[i-2]) + (f[i+3] - f[i-3])), shape [x, y, lev_nodes]. WRF’s 0.25rdx(U(+1) + U(0)) with U = (c1f mu + c2f)(u(k) + u(k-1)) m_u is this mean of V, since WRF’s U carries twice the interface velocity. Every interface is computed; the consumer keeps the ground interface (k = 1) fixed, where WRF applies no geopotential tendency, and divides by the map factor of the point, as WRF’s 1/msfty. OPEN boundaries (open_xs/open_xe): WRF lowers the order next to the edge, fourth order (wrf_vgrad4_x: (1/12)(8 (f[i+1] - f[i-1]) - (f[i+2] - f[i-2])) with the same mean V) at points 3 and NX-2, and at points 2 and NX-1 the second-order form (wrf_vgrad2_x: (rdx/2) (V[i+1] (f[i+1] - f[i]) + V[i] (f[i] - f[i-1]))), the mean of the two face products rather than the mean V times a centred difference. At the edge points 1 and NX the rule returns 0: WRF replaces the advection there by an outflow radiation condition on the perturbation geopotential with a differently interpolated speed (rhs_ph’s last four blocks), which the consuming component writes. A specified or nested boundary degrades the same way, but WRF’s 4th-order row there is gated on open_xs/open_xe alone; a separate variant when needed.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_vgrad6_x_periodic

op:advection order:6 bc:periodic axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_vgrad6_x_periodic.esm

Rewrites \(V \frac{\partial f}{\partial x}\) at priority 10 — match pattern:

{"op": "*", "args": ["V", {"op": "partial", "args": ["f"], "wrt": "x"}]}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x_stag, y, lev_nodes]; f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{4 \le i \le \mathit{NX} - 3, j \in y, k \in \mathit{lev\_nodes}} & [4, \mathit{NX} - 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NX} - 1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{1 \le i \le 1, j \in y, k \in \mathit{lev\_nodes}} & [1, 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NX} - 2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{2 \le i \le 2, j \in y, k \in \mathit{lev\_nodes}} & [2, 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NX} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{3 \le i \le 3, j \in y, k \in \mathit{lev\_nodes}} & [3, 3] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{\mathit{NX} - 2 \le i \le \mathit{NX} - 2, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} - 2, \mathit{NX} - 2] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{\mathit{NX} - 1 \le i \le \mathit{NX} - 1, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX} - 1, \mathit{NX} - 1] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_x}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NX}, o_{\mathrm{p2}} = 2 - \mathit{NX}, o_{\mathrm{p3}} = 3 - \mathit{NX}, o_{\mathrm{vhi}} = 1 - \mathit{NX})\right]^{\{V, f\}}_{\mathit{NX} \le i \le \mathit{NX}, j \in y, k \in \mathit{lev\_nodes}} & [\mathit{NX}, \mathit{NX}] \times [1, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW advective-form transport of an interface field along x, the horizontal part of the geopotential equation (module_big_step_utilities_em.F rhs_ph, h_sca_adv_order 5 or 6): matches V * partial(f, x) for f [x, y, lev_nodes] (the geopotential phb + ph) and V [x_stag, y, lev_nodes] (the mass-weighted velocity on the x faces at the interfaces, (c1f mu + c2f) u m_u, which the consumer builds with wrf_mid_lev) and lowers it, at the points of f, to the stencil wrf_vgrad6_x: rdx (V[i] + V[i+1])/2 times the centred sixth-order difference (1/60)(45 (f[i+1] - f[i-1]) - 9 (f[i+2] - f[i-2]) + (f[i+3] - f[i-3])), shape [x, y, lev_nodes]. WRF’s 0.25rdx(U(+1) + U(0)) with U = (c1f mu + c2f)(u(k) + u(k-1)) m_u is this mean of V, since WRF’s U carries twice the interface velocity. Every interface is computed; the consumer keeps the ground interface (k = 1) fixed, where WRF applies no geopotential tendency, and divides by the map factor of the point, as WRF’s 1/msfty. PERIODIC (periodic_x): WRF’s halo makes the sixth-order stencil apply at every point; here every point applies wrf_vgrad6_x, and the points within three of an end bind their neighbours wrapped (f[i + NX] = f[i]). At i = NX the high face is wrapped too (V[NX+1] is read as V[1]), so, as grids/wrf_arw_c/grid.esm promises of its periodic rules, the duplicate face NX+1 is never read.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_vgrad6_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_vgrad6_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
89.190e-04—1.832e-03—
161.571e-055.873.121e-055.88
322.511e-075.975.021e-075.96
643.945e-095.997.887e-095.99

Expected order: 6 (± 0.3).

Convergence of wrf_vgrad6_xy_periodic (log-log)

wrf_vgrad6_y_open

op:advection order:6 bc:open axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_vgrad6_y_open.esm

Rewrites \(V \frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "*", "args": ["V", {"op": "partial", "args": ["f"], "wrt": "y"}]}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev_nodes]; f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad4\_y}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad4\_y}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad2\_y}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad2\_y}(V = V, f = f, i = i, j = j, k = k)\right]^{\{V, f\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV} + 1] \\ 0 & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ 0 & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW advective-form transport of an interface field along y, the horizontal part of the geopotential equation (module_big_step_utilities_em.F rhs_ph, h_sca_adv_order 5 or 6): matches V * partial(f, y) for f [x, y, lev_nodes] (the geopotential phb + ph) and V [x, y_stag, lev_nodes] (the mass-weighted velocity on the y faces at the interfaces, (c1f mu + c2f) v m_v, which the consumer builds with wrf_mid_lev) and lowers it, at the points of f, to the stencil wrf_vgrad6_y: rdy (V[j] + V[j+1])/2 times the centred sixth-order difference (1/60)(45 (f[j+1] - f[j-1]) - 9 (f[j+2] - f[j-2]) + (f[j+3] - f[j-3])), shape [x, y, lev_nodes]. WRF’s 0.25rdy(V(+1) + V(0)) with V = (c1f mu + c2f)(v(k) + v(k-1)) m_v is this mean of V, since WRF’s V carries twice the interface velocity. Every interface is computed; the consumer keeps the ground interface (k = 1) fixed, where WRF applies no geopotential tendency, and divides by the map factor of the point, as WRF’s 1/msfty. OPEN boundaries (open_ys/open_ye): WRF lowers the order next to the edge, fourth order (wrf_vgrad4_y: (1/12)(8 (f[j+1] - f[j-1]) - (f[j+2] - f[j-2])) with the same mean V) at points 3 and NY-2, and at points 2 and NY-1 the second-order form (wrf_vgrad2_y: (rdy/2) (V[j+1] (f[j+1] - f[j]) + V[j] (f[j] - f[j-1]))), the mean of the two face products rather than the mean V times a centred difference. At the edge points 1 and NY the rule returns 0: WRF replaces the advection there by an outflow radiation condition on the perturbation geopotential with a differently interpolated speed (rhs_ph’s last four blocks), which the consuming component writes. A specified or nested boundary degrades the same way, but WRF’s 4th-order row there is gated on open_ys/open_ye alone; a separate variant when needed.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

wrf_vgrad6_y_periodic

op:advection order:6 bc:periodic axes:x,y,lev_nodes stencil width 7 priority 10

Source: grids/wrf_arw_c/rules/wrf_vgrad6_y_periodic.esm

Rewrites \(V \frac{\partial f}{\partial y}\) at priority 10 — match pattern:

{"op": "*", "args": ["V", {"op": "partial", "args": ["f"], "wrt": "y"}]}
Match scope (esm-spec §9.6.1 where): fires only when V is a bare field shaped [x, y_stag, lev_nodes]; f is a bare field shaped [x, y, lev_nodes]. Under import-edge renaming (§9.7.7) the wrt literal and this shape follow the renamed axis together, so the rule can be imported more than once (each instance scoped to its own grid) without a first-declared-wins collision. A consumer differentiating a compound inline expression must bind it to a declared shaped observed first.

Discretization — one makearray tiling the output axes; boundary conditions live in the face regions of this same rule (esm-spec §9.6.8; later regions overwrite earlier, §4.3.2). Imported stencils appear as template applications name<param=value, ...>, defined in the Stencils section of this page:

$$\left[\begin{array}{l|l} \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, 4 \le j \le \mathit{NY} - 3, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [4, \mathit{NY} - 3] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = \mathit{NY} - 1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, 1 \le j \le 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [1, 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = \mathit{NY} - 2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, 2 \le j \le 2, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [2, 2] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = \mathit{NY} - 3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, 3 \le j \le 3, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [3, 3] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, \mathit{NY} - 2 \le j \le \mathit{NY} - 2, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} - 2, \mathit{NY} - 2] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1)\right]^{\{V, f\}}_{i \in x, \mathit{NY} - 1 \le j \le \mathit{NY} - 1, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY} - 1, \mathit{NY} - 1] \times [1, \mathit{NLEV} + 1] \\ \left[\sum\operatorname{wrf\_vgrad6\_y}(V = V, f = f, i = i, j = j, k = k, o_{\mathrm{m1}} = -1, o_{\mathrm{m2}} = -2, o_{\mathrm{m3}} = -3, o_{\mathrm{p1}} = 1 - \mathit{NY}, o_{\mathrm{p2}} = 2 - \mathit{NY}, o_{\mathrm{p3}} = 3 - \mathit{NY}, o_{\mathrm{vhi}} = 1 - \mathit{NY})\right]^{\{V, f\}}_{i \in x, \mathit{NY} \le j \le \mathit{NY}, k \in \mathit{lev\_nodes}} & [1, \mathit{NX}] \times [\mathit{NY}, \mathit{NY}] \times [1, \mathit{NLEV} + 1] \end{array}\right]$$

WRF-ARW advective-form transport of an interface field along y, the horizontal part of the geopotential equation (module_big_step_utilities_em.F rhs_ph, h_sca_adv_order 5 or 6): matches V * partial(f, y) for f [x, y, lev_nodes] (the geopotential phb + ph) and V [x, y_stag, lev_nodes] (the mass-weighted velocity on the y faces at the interfaces, (c1f mu + c2f) v m_v, which the consumer builds with wrf_mid_lev) and lowers it, at the points of f, to the stencil wrf_vgrad6_y: rdy (V[j] + V[j+1])/2 times the centred sixth-order difference (1/60)(45 (f[j+1] - f[j-1]) - 9 (f[j+2] - f[j-2]) + (f[j+3] - f[j-3])), shape [x, y, lev_nodes]. WRF’s 0.25rdy(V(+1) + V(0)) with V = (c1f mu + c2f)(v(k) + v(k-1)) m_v is this mean of V, since WRF’s V carries twice the interface velocity. Every interface is computed; the consumer keeps the ground interface (k = 1) fixed, where WRF applies no geopotential tendency, and divides by the map factor of the point, as WRF’s 1/msfty. PERIODIC (periodic_y): WRF’s halo makes the sixth-order stencil apply at every point; here every point applies wrf_vgrad6_y, and the points within three of an end bind their neighbours wrapped (f[j + NY] = f[j]). At j = NY the high face is wrapped too (V[NY+1] is read as V[1]), so, as grids/wrf_arw_c/grid.esm promises of its periodic rules, the duplicate face NY+1 is never read.

References

  • Skamarock, W. C., et al. (2021). A Description of the Advanced Research WRF Model Version 4.3. NCAR Technical Note NCAR/TN-556+STR. Chapter 3 (temporal and spatial discretization, advection). doi:10.5065/1dfh-6p97
  • Wicker, L. J., and W. C. Skamarock (2002). Time-splitting methods for elastic models using forward time schemes. Monthly Weather Review, 130(8), 2088-2097. doi:10.1175/1520-0493(2002)130<2088:TSMFEM>2.0.CO;2

Conformance fixtures

Convergence — case wrf_vgrad6_xy_periodic

Error norms read from the committed golden tests/conformance/convergence/wrf_vgrad6_xy_periodic/golden/errors.json (binding: julia; nothing recomputed for display).

nL2_errorobserved orderLinf_errorobserved order
89.190e-04—1.832e-03—
161.571e-055.873.121e-055.88
322.511e-075.975.021e-075.96
643.945e-095.997.887e-095.99

Expected order: 6 (± 0.3).

Convergence of wrf_vgrad6_xy_periodic (log-log)