Spatial discretization

The equations are discretized with a second-order finite-volume method. The domain is divided into cells; each equation is integrated over a cell, which turns it into a balance of fluxes through the cell faces. The same discretization serves flat ground and terrain: on flat ground \(z_x = z_y = 0\) and every operator reduces to its Cartesian form. The operators are in Source/Convection, Source/Diffusion, Source/MassFlux, Source/Forcing and Source/Residual.

Staggered grid

GUST uses ERF’s staggered (Arakawa C) grid:

  • \(u, v, w\) sit on the x-, y- and z-faces of the cells;

  • \(p, \theta, k\) sit at the cell centres;

  • the node heights z_phys_nd sit at the cell corners.

Each variable has its own control volume centred on its location. For a velocity component this is the two half cells on either side of its face. The staggering couples pressure and velocity tightly and avoids the checkerboard pressure modes of a collocated grid.

Boxes are split in x and y only, so every vertical column lies inside one box.

Every operator is a discrete form of (2):

\[L(q) = \frac{1}{J}\left[\frac{\delta G_x}{\delta\xi} + \frac{\delta G_y}{\delta\eta} + \frac{\delta G_z}{\delta\zeta}\right],\]

where \(G_d\) is the flux through the faces of the control volume and \(\delta/\delta\xi\) is the difference across the control volume divided by \(\Delta\xi\). Values between grid points are two-point averages; all operators are second order on a smooth mesh.

Convection

\[C(q) = \frac{1}{J}\left[\frac{\delta (F_x q_f)}{\delta\xi} + \frac{\delta (F_y q_f)}{\delta\eta} + \frac{\delta (F_z q_f)}{\delta\zeta}\right], \qquad F_x = a_x u,\quad F_y = a_y v,\quad F_z = \Omega .\]

The face value \(q_f\) is a MUSCL reconstruction from the upwind side. For \(F \ge 0\),

\[q_f = q_0 + \tfrac12\,s(q_0 - q_{-1},\ q_1 - q_0),\]

where \(s(a, b)\) is a slope limiter, set by convection.limiter:

Limiter

Slope \(s(a, b)\)

Typical use

van_leer (default)

\(2ab/(a+b)\) where \(ab > 0\), else 0

Momentum and \(\theta\); total-variation diminishing.

van_albada

\(\dfrac{(b^2+\epsilon^2)\,a + (a^2+\epsilon^2)\,b}{a^2 + b^2 + 2\epsilon^2}\)

Smooth; suited to Newton methods.

upwind

0

First order.

\(k\) always uses first-order upwinding in the bounded form \(C(k) - k\,C(1)\), so \(k\) stays non-negative. The MUSCL stencil reaches two cells upwind, which is why the fields carry two ghost layers.

Diffusion

\[D(q) = \nabla\cdot(\gamma\nabla q), \qquad D_c(\mathbf u) = \frac{\partial \tau_{cj}}{\partial x_j}, \qquad G_d = \boldsymbol\tau_c\cdot\mathbf A_d .\]
  • The face flux is the physical gradient (chain rule, Terrain-following coordinates) dotted with the face area vector. All metric cross terms are included.

  • The momentum stress keeps the transposed term \(\partial_c u_j\), which matters where \(\nu\) varies.

  • Cell diffusivities are averaged to the faces. turb.face_mean = logarithmic uses \((a - b)/\ln(a/b)\) across vertical pairs.

The logarithmic mean is exact for the wall layer: there the diffusivity \(\kappa u_*(z + z_0)\) is linear in height, and the logarithmic mean gives the exact face flux of the log profile. The arithmetic mean underestimates the first face flux by about 10 %.

Divergence and pressure gradient

\[D(\mathbf U) = \frac1J\left[\frac{\delta(a_x u)}{\delta\xi} + \frac{\delta(a_y v)}{\delta\eta} + \frac{\delta\Omega}{\delta\zeta}\right], \qquad \Omega = w - z_x\bar u - z_y\bar v ,\]

where \(\bar u, \bar v\) are four-point averages around the z-face. The pressure gradient \(G\) is the negative adjoint of the divergence:

\[(Gp)_x = \frac{1}{J_u}\left[a_x\frac{\delta p}{\delta\xi} - \frac14\sum z_x \frac{\delta p}{\delta\zeta}\right], \qquad (Gp)_z = \frac{1}{J_w}\frac{\delta p}{\delta\zeta} .\]

With \(G = -D^T\) (except in the ground row, below), the pressure operator \(DG\) is symmetric and negative semidefinite, and only constants lie in its null space. There are no spurious pressure modes. On the ground face the slope term uses the one-sided difference \(-2p_0 + 3p_1 - p_2\).

Source terms

  • Buoyancy on a w-face uses the average of its two cells, \(g(\theta - \theta_\mathrm{ref})/\theta_0\).

  • Coriolis uses four-point averages of the other velocity components around each face, as in ERF.

Approximate Jacobian

The implicit solvers (Solution algorithm) need a cheap approximation of the Jacobian \(\partial R/\partial q\). GUST uses the first-order operator

\[A_1 q = a_P\,q_P - \sum_{nb} a_{nb}\,q_{nb}, \qquad a_P = \sum_{nb} a_{nb},\]

over the six neighbours of each point:

Term

Weight of the neighbour across a face

Convection

First-order upwind, \(\max(\pm F, 0)/(J\Delta\xi_d)\)

Diffusion, x- and y-faces

\(g\,z_\zeta\,(1 + \delta_{cd})/(J\,\Delta\xi_d^2)\)

Diffusion, z-faces

\(g\,(|\mathbf n|^2 + n_c^2)/(z_\zeta\,J\,\Delta\zeta^2)\)

Here \(g\) is the face diffusivity and \(\mathbf n = \mathbf A_\zeta\). The metric cross terms stay on the right-hand side.

Every \(a_{nb} \ge 0\), so \(1/\Delta\tau + A_1\) is an M-matrix and each grid line is a well-conditioned tridiagonal system. \(A_1\) only steers the iteration: a converged state satisfies the full second-order \(R = 0\).

Jacobian–vector product

The Newton–Krylov solver (Solution algorithm) needs products \(Jv\) with the exact Jacobian \(J = \partial R/\partial q\), without forming \(J\). They are computed by a finite difference:

\[J v \approx \frac{R(q + \epsilon v) - R(q)}{\epsilon}, \qquad \epsilon = h\;\frac{1 + \mathrm{mean}\,|\tilde q|}{\mathrm{rms}\,\tilde v} .\]
  • \(\tilde q = q/s\) and \(\tilde v = v/s\) are scaled by 10 m/s, 100 m²/s², 10 K and 0.1 m²/s², with \(\theta\) taken as \(\theta - \theta_\mathrm{ref}\). Without the scaling, \(\theta \approx 300\) K would dominate the norm.

  • \(h\) is steady.newton_fd_eps_scale, by default \(\sqrt{\epsilon_\mathrm{mach}}\), which balances truncation and round-off errors.

Everything inside \(R\) (boundary conditions, damping, wall model, turbulence model) is seen by \(Jv\). The relative error of \(Jv\) is 2e-8 to 5e-8 in double precision; the \(\theta\) rows are 3 to 10 times less accurate (1.6e-7), because \(q + \epsilon v\) is formed with the absolute \(\theta\) near 300 K.