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_ndsit 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):
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
The face value \(q_f\) is a MUSCL reconstruction from the upwind side. For \(F \ge 0\),
where \(s(a, b)\) is a slope limiter, set by convection.limiter:
Limiter |
Slope \(s(a, b)\) |
Typical use |
|---|---|---|
|
\(2ab/(a+b)\) where \(ab > 0\), else 0 |
Momentum and \(\theta\); total-variation diminishing. |
|
\(\dfrac{(b^2+\epsilon^2)\,a + (a^2+\epsilon^2)\,b}{a^2 + b^2 + 2\epsilon^2}\) |
Smooth; suited to Newton methods. |
|
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
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 = logarithmicuses \((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
where \(\bar u, \bar v\) are four-point averages around the z-face. The pressure gradient \(G\) is the negative adjoint of the divergence:
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
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:
\(\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.