Dynamical core: governing equations
The dynamical core of MicroHH solves the conservation equations of mass,
momentum, and energy under the anelastic approximation .
Under this approximation, the state variables density, pressure, and
temperature are described as small fluctuations (denoted with a prime in this
paper) from corresponding vertical reference profiles (denoted with subscript
zero) that are functions of height only. This form of the approximation
directly simplifies to the Boussinesq approximation if the reference density
ρ0(z) is taken to be constant with height z. Consequently, MicroHH
does not need separate implementations of Boussinesq and anelastic
approximations. To facilitate the subsequent discussion of the conservation
equations, we define the scale height for density Hρ based on the
reference density profile:
Hρ≡1ρ0dρ0dz-1.
Conservation of mass
The conservation of mass is formulated using Einstein summation as
∂ρ0ui∂xi=ρ0∂ui∂xi+ρ0wHρ-1=0,
where ui represents the components of the velocity vector (u,v,w) and xi
represents the components of the position vector (x,y,z). This formulation conserves the reference
mass, as density perturbations are ignored in the equation .
Under the Boussinesq approximation (Hρ→∞),
Eq. () simplifies to conservation of volume:
∂ui∂xi=0.
Thermodynamic relations and conservation of momentum
The thermodynamic relation between the fluctuations of virtual potential
temperature, pressure, and density under the anelastic approximation is (see
for its derivation)
θv′θv0=p′ρ0gHρ-ρ′ρ0,
where θv′ is the perturbation virtual potential
temperature, θv0 the reference virtual potential
temperature, p′ is the perturbation pressure, g is the gravity
acceleration, and ρ′ is the perturbation density.
The corresponding momentum equation is written in the flux form in order to
assure momentum conservation. The hydrostatic balance dp0/dz=-ρ0g has been subtracted, and Eq. () has
been used to introduce potential temperature as the buoyancy variable to
formulate the conservation of momentum as
∂ui∂t=-1ρ0∂ρ0uiuj∂xj-∂∂xip′ρ0+δi3gθv′θv0+ν∂2ui∂xj2+Fi,
where δ is the Kronecker delta, ν is the kinematic viscosity, and
vector Fi represents external forces resulting from parameterizations or
large-scale forcings. As showed, this formulation is
energy-conserving in the sense that there is a consistent transfer between
kinetic and potential energy.
Under the Boussinesq approximation, the two equations simplify to
θv′θv0=-ρ′ρ0,∂ui∂t=-∂uiuj∂xj-1ρ0∂p′∂xi+δi3gθv′θv0+ν∂2ui∂xj2+Fi.
Pressure equation
The equation to acquire the pressure is diagnostic because density
fluctuations are neglected in the mass conservation equation under the
anelastic approximation (Eq. ). To simplify the notation,
we define a function fui that contains all right-hand-side
terms of Eq. (), except the pressure gradient. To arrive at
the equation that allows us to solve for the pressure, we multiply the
equation with the base density ρ0 and take its divergence. Conservation
of mass ensures that the tendency term vanishes, and an elliptic equation for
pressure remains:
∂∂xiρ0∂∂xip′ρ0=∂ρ0fui∂xi.
Under the Boussinesq approximation, the equation simplifies to
∂2∂xi2p′ρ0=∂fui∂xi.
In Sect. , we explain how these equations are solved
numerically.
Conservation of an arbitrary scalar
The conservation equation of an arbitrary scalar ϕ is written in flux
form:
∂ϕ∂t=-1ρ0∂ρ0ujϕ∂xj+κϕ∂2ϕ∂xj2+Sϕ,
where κϕ is the diffusivity of the scalar and Sϕ represents sources and sinks of the variable.
Conservation of energy
MicroHH provides multiple options for the energy conservation equation. The
conservation equation for potential temperature for dry dynamics θ can
be written as
∂θ∂t=-1ρ0∂ρ0ujθ∂xj+κθ∂2θ∂xj2+θ0ρ0cpT0Q,
where κθ is the thermal diffusivity for heat, and Q represents
external sources and sinks of heat. A second option for moist dynamics is
available. This has an identical conservation equation, but with liquid water
potential temperature θl rather than θ as the conserved
variable (see Sect. for details).
A third, more simplified mode, is available for dry dynamics under the
Boussinesq approximation. Here, the equation of state (Eq. )
can be eliminated and the conservation of momentum and energy can be written
in terms of buoyancy b≡g/θv0θv′ as
∂ui∂t+∂uiuj∂xj=-1ρ0∂p′∂xi+δi3b+ν∂2ui∂xj2,∂b∂t+∂buj∂xj=κb∂2b∂xj2+Qb,
with κb as the diffusivity for buoyancy and Qb as an
external buoyancy source. By using buoyancy, length and time remain as the
only two dimensions, which proves convenient for dimensional analysis. In
this formulation, θv′ is the fluctuation of the virtual
potential temperature with respect to the surface value θv0.
The consequence is that the buoyancy increases with height in a stratified
atmosphere, analogously to the virtual potential temperature (see
, their Fig. B1 and , their
Fig. 7a)
With a slight modification to the definition of θv′,
it is possible to study slope flows in periodic domains. We define
θv′ as the fluctuation with respect to a linearly
stratified background profile θv0+(dθv/dz)0z. The background stratification in units
of buoyancy is N2≡g/θv0(dθv/dz)0. If we work out the governing equations
again and introduce a slope α (x axis pointing upslope; see
, their Fig. 1) in the x direction, we find
∂u∂t+∂uju∂xj=-1ρ0∂p′∂x+sin(α)b+ν∂2u∂xj2,∂w∂t+∂ujw∂xj=-1ρ0∂p′∂z+cos(α)b+ν∂2w∂xj2,∂b∂t+∂buj∂xj=κb∂2b∂xj2-usin(α)+wcos(α)N2+Qb,
where the evolution equation of v is omitted, as it contains no changes.
Dynamical core: numerical implementation
Grid
MicroHH is discretized on a staggered Arakawa C-grid, where the scalars are
located in the center of a grid cell and the three velocity components are at the
faces. The code can work with stretched grids in the vertical dimension. The
grid is initialized from a vertical profile that contains the heights of the
cell centers. The locations of the faces are determined consistently with the
spatial order of the interpolations that are described in
Sect. . All spatial operators in the model, such as
the advection and diffusion, default to the same order as the grid and can
be overridden according to the user's wishes (see Sect. ).
There is the option to apply a uniform translation velocity to the grid and thus
to let the grid move with the flow. This so-called Galilean transformation is
allowed as the Navier–Stokes equations are invariant under translation. It
has the potential to allow for larger time steps and to increase the accuracy
of simulations.
Three-dimensional fields
In order to solve the governing equations, MicroHH generates at
initialization three-dimensional fields of the prognostic variables. These
are the three velocity components (Eqs. or
) and the thermodynamic variables
(Eqs. , , or ).
Furthermore, the user has the option to define additional passive scalars
(Eq. ). Each of the prognostic fields has an additional
three-dimensional field assigned to store its tendency (see
Sect. ). Furthermore, a diagnostic field is
assigned for the pressure, as well as three or four additional ones for
intermediate computations. Newly implemented physical parameterizations have
the option to request additional three-dimensional fields at initialization
of the specific parameterization.
The generation of turbulence requires perturbations to the initial fields.
MicroHH has two options to superimpose perturbations on any of the prognostic
variables. These perturbations can be random noise of which the amplitude and
location can be controlled, as well as two-dimensional rotating vortices with
an axis aligned with the x or y dimension. The former option is the most
commonly used method to start convective turbulence, whereas the latter is
the default for neutral or stably stratified flows, which develop turbulence
more easily from larger perturbations.
Time integration
The prognostic equations are solved using low-storage Runge–Kutta time
integration schemes. Such schemes require two fields per variable: one that
contains the actual value, which we denote with ϕ in this section, and
one that represents the tendencies, denoted with δϕ. The code
provides two options: a three-stage, third-order scheme
and a five-stage, fourth-order scheme . Both can be
written in the same generic form in semi-discrete formulation as
δϕn=fϕn+anδϕn-1ϕn+1=ϕn+bnΔtδϕn,
where f is a function that represents the computation of all right-hand-side
terms, an and bn are the coefficients for the Runge–Kutta method
at stage n, and Δt is the time step. Expression fϕn thus represents the actual tendency calculated using, for instance,
Eqs. () or (), whereas (δϕ)n is
a composite of the actual tendency and those from the previous stages. In
low-storage form, the tendencies of the previous stage δϕn-1 are retained and multiplied with an at the beginning of a
stage, except for the first stage, where a1=0.
For the third-order scheme, the vectors an and bn are
an=0,-59,-153128,bn=13,1516,815.
For the fourth-order scheme, the vectors a and b are
an=0,-5673018057731357537059087,-24042679903932016746695238,-35509186866462091501179385,-1275806237668842570457699bn=14329971744779575080441755,516183667771713612068292357,17201463215492090206949498,31345643535374481467310338,227782119143714882151754819.
The reduced truncation error of the fourth-order scheme makes the scheme
preferable over the third-order scheme under many conditions (see
Sect. ). The code can be run with a fixed Δt,
as well as an adaptive time step based on the local flow velocities.
Building blocks of the spatial discretization
The spatial operators are based on finite differences. The code supports
second-order and fourth-order accurate discretizations following
and . From Taylor series, spatial
operators can be derived that constitute the building blocks of more advanced
operators, such as the advection and diffusion operators. In the following
subsections, we describe the elementary operators and the composite operators
that can be derived from them. We have selected a set of examples that cover
the relevant operators.
We define two second-order interpolation operators, one with a small stencil and one with a wide stencil, as
ϕi,j,k≈ϕ‾i,j,k2x≡ϕi-12,j,k+ϕi+12,j,k2,ϕi,j,k≈ϕ‾i,j,k2xL≡ϕi-32,j,k+ϕi+32,j,k2.
Interpolations are marked with a bar. The superscript indicates the spatial
order (2) and the direction (x), and has an extra qualifier L when it is
taken using the wide stencil. The subscript indicates the position on the
grid (i,j).
The gradient operators, denoted with letter δ, are defined in a similar
way:
∂ϕ∂xi,j,k≈δ2xϕi,j,k≡ϕi+12,j,k-ϕi-12,j,kxi+12-xi-12∂ϕ∂xi,j,k≈δ2xLϕi,j,k≡ϕi+32,j,k-ϕi-32,j,kxi+32-xi-32.
We use the Einstein summation in the operators. For instance, the divergence of vector uii,j,k can be written as δ2xiuii,j,k.
The fourth-order operators, written down in the same notation, are defined as
ϕi,j,k≈ϕ‾i,j,k4x≡-ϕi-32,j,k+9ϕi-12,j,k+9ϕi+12,j,k-ϕi+32,j,k16.
The biased version of this operator (suffix b in the superscript) can be applied in the vicinity of the boundaries at the bottom
and top. Here, we show the biased stencil that can be applied for vertical
interpolation near the bottom:
ϕi,j,k≈ϕ‾i,j,k4zb≡5ϕi,j,k-12+15ϕi,j,k+12-5ϕi,j,k+32+ϕi,j,k+5216.
Note that we only write down the bottom boundary for brevity.
The centered and biased fourth-order gradient operators are
∂ϕ∂xi,j,k≈δ4xϕi,j,k≡ϕi-32,j,k-27ϕi-12,j,k+27ϕi+12,j,k-ϕi+32,j,kxi-32-27xi-12+27xi+12-xi+32,
and
∂ϕ∂zi,j,k≈δ4zbϕi,j,k≡-23ϕi,j,k-12+21ϕi,j,k+12+3ϕi,j,k+32-ϕi,j,k+52-23zk-12+21zk+12+3zk+32-zk+52.
Boundary conditions
The lateral boundaries in MicroHH are periodic. The bottom and top boundary
conditions can be formulated in their most general form as the Robin boundary
condition:
aϕs+b∂ϕ∂zs=c,
with a, b, and c as constants. This gives the Dirichlet boundary
condition when a=1, b=0, and the Neumann boundary condition when a=0,
b=1.
MicroHH makes use of ghost cells in order to avoid the need of biased schemes
for single interpolation or gradient operators near the wall. The values at
the ghost cells are derived making use of the boundary conditions following
. The ghost cells for the Dirichlet boundary conditions
in the second-order accurate discretization are
ϕ-12=2c-ϕ12,
whereas those for the Neumann boundary condition are
ϕ-12=-c-z-12+z12+ϕ12.
In the case of the fourth-order scheme, we have two ghost cells, and therefore a
second boundary condition is required. Here, we set the third derivative
equal to zero following . For the Dirichlet boundary
condition we then acquire the following expressions for the ghost cells:
ϕ-12=8c-6ϕ12+ϕ323,ϕ-32=8c-6ϕ12+ϕ32,
whereas in the case of a Neumann boundary condition, we find
ϕ-12=-cz-32-27z-12+27z12-z3224+ϕ12,ϕ-32=-3cz-32-27z-12+27z12-z3224+ϕ32.
Advection
We use the previously introduced notation to describe the more complex
operators and expand them for illustration. The advection term is discretized
in the flux form, where ϕ is an arbitrary scalar located in the center
of the grid cell. In the second-order case, this gives the following
discretization:
∂uϕ∂xi,j,k+∂vϕ∂yi,j,k≈δ2xuϕ‾2xi,j,k+δ2yvϕ‾2yi,j,k=ui+12,j,kϕ‾i+12,j,k2x-ui-12,j,kϕ‾i-12,j,k2xxi+12-xi-12+vi,j+12,kϕ‾i,j+12,k2y-vi,j-12,kϕ‾i,j-12,k2yyj+12-yj-12.
The discretization of the advection of the velocity components (see
Eqs. and ) involves extra interpolations
as the following example illustrates:
∂vu∂xi,j,k=δ2xv‾2yu‾2xi,j,k=v‾i+12,j,k2yu‾i+12,j,k2x-v‾i-12,j,k2yu‾i-12,j,k2xxi+12-xi-12.
In the standard fourth-order scheme, the scalar advection in flux form is represented by
∂uϕ∂xi,j,k≈δ4xuϕ‾4xi,j,k=ui-32,j,kϕ‾i-32,j,k4x-27ui-12,j,kϕ‾i-12,j,k4x+27ui+12,j,kϕ‾i+12,j,k4x-ui+32,j,kϕ‾i+32,j,k4x/xi-32-27xi-12+27xi+12-xi+32.
Hereafter, we assume that operator notation is clear and only expand it where
necessary.
MicroHH has a fully kinetic energy-conserving fourth-order advection scheme
available. The scheme is constructed by interpolation
of two kinetic energy-conserving second-order discretizations to eliminate
the second-order error (as illustrated below)
∂uϕ∂xi,j,k≈98δ2xuϕ‾2xi,j,k-18δ2xLuϕ‾2xLi,j,k,
to ensure that velocity variances are conserved under advection.
Velocity interpolations, such as those in Eq. (), still need
to be performed with fourth-order accuracy (Eq. ) in order to
be fourth-order accurate (see for details). The
expression
∂vu∂xi,j,k≈98δ2xv‾4yu‾2xi,j,k-18δ2xLv‾4yu‾2xLi,j,k
includes, for instance, a combination of second- and fourth-order interpolations.
To increase the overall accuracy of the second-order advection operator,
there is an option available to only increase the interpolation part to
fourth order:
∂uϕ∂xi,j,k≈δ2xuϕ‾4xi,j,k.
Diffusion
We apply a discretization for diffusion that can be written as the divergence
of a gradient, using the building blocks defined earlier in this section. As
this operator is identical in all directions, we present it in one direction
only:
κϕ∂2ϕ∂x2i,j,k≈κϕδ2xδ2xϕi,j,k,κϕ∂2ϕ∂x2i,j,k≈κϕδ4xδ4xϕi,j,k.
On an equidistant grid, this provides the well-known second-order accurate
operator for the second derivative:
κϕδ2xδ2xϕi,j,k=κϕϕi-1,j,k-2ϕi,j,k+ϕi+1,j,kΔx2,
where Δx is the uniform grid spacing.
For the fourth-order accurate operator, a seven-point stencil is used:
κϕδ4xδ4xϕi,j,k=κϕ576Δx2ϕi-3,j,k-54ϕi-2,j,k+783ϕi-1,j,k-1460ϕi,j,k+783ϕi+1,j,k-54ϕi+2,j,k+ϕi+3,j,k.
Whereas diffusion can be computed with fourth-order accuracy using a
five-point stencil, we use a seven-point stencil, as it extends naturally to
non-uniform grids as explained in . The usage of a
seven-point stencil requires special care near the walls. In
Fig. , we show an example of how the second derivative
in the vertical direction is computed for a scalar at the first model level
(green node in Fig. ). The calculation of the
divergence (Fig. , red stencil) requires the gradient
located at the first face below the wall (lowest red node in
Fig. ), which can only be acquired using the biased
gradient operator (Eq. and yellow stencil connected to
lowest red node in Fig. ). The extent of the complete
stencil near the wall (white nodes; Fig. ) is thus six
points, rather than seven.
Schematic of the diffusion discretization near the wall. The green
node is the evaluation point at the center of the first cell above the wall,
the red nodes are the stencil of the divergence operator, and yellow nodes
show the stencils of the four gradient operators over which the divergence is
evaluated. White nodes indicate the extent of the stencil.
Pressure
Equations () and () are solved following the
method of . This is a fractional step method that first
computes intermediate values of the velocity components for the next time
step, based on all right-hand-side terms of the momentum conservation
equation (Eq. ):
ui*i,j,kt+1=uii,j,kt+Δtfii,j,kt,
with the intermediate velocity components denoted with an asterisk.
The velocity values at the next time step can be computed as soon as the
pressure is known, using
uii,j,kt+1=ui*i,j,kt+1-Δtδnxipρ0i,j,kt.
In order to compute the pressure, we multiply the previous equation with the
reference density and take its gradient, arriving at
δnxiρ0uii,j,kt+1=δnxiρ0ui*i,j,kt+1-Δtδnxiρ0δnxipρ0i,j,kt,
where n indicates the spatial order, and the subscript i in superscript
xi indicates that δnxi is a divergence operator. The left-hand
side equals zero due to mass conservation at the next time step
(Eq. ). The resulting equation is the Poisson equation that
is the discrete equivalent of Eq. (). Rewriting this equation
leads to
δnxiρ0ui*i,j,kt+1Δt=δnxiρ0δnxipρ0i,j,kt.
To simplify the notation, we denote the left-hand-side term as ψ and the
p/ρ0 term on the right-hand side as π. Solving a Poisson equation
is a global operation. Because the computed fields are periodic in the
horizontal directions on an equidistant grid, and a Poisson equation is
linear, we can perform a Fourier transform in the two horizontal directions:
ψ^l,m,k=-k*n2π^l,m,k-l*n2π^l,m,k+δnzρ0δnzπ^l,m,k,
where Fourier-transformed variables are denoted with a hat, the spatial order
of the operation with n, and the wavenumbers in the two horizontal
dimensions x and y are l and m, respectively. Variables k*2 and
l*2 are the squares of the modified wavenumbers:
-k*22≡2cos(kΔx)Δx2-2Δx2
and
-k*42≡2cos(3kΔx)-54cos(2kΔx)+783cos(kΔx)576Δx2-1460576Δx2,
where the former is the modified wavenumber for the second-order accurate
solver and the latter is the wavenumber for the fourth-order one. Note that
the coefficients correspond to those in Eqs. () and
(). Both expressions satisfy the limit limΔx→0k*n2=k2, where n is the order of the scheme.
Solving Eq. () for π^ requires solving a
banded matrix for the vertical direction in which the walls are located. This
matrix is tridiagonal for the second-order solver and heptadiagonal for the
fourth-order solver. For this, a standard Thomas algorithm
is used. After the pressure is acquired, inverse Fourier transforms are
applied and subsequently the pressure gradient term (see
Eqs. and ) is computed for all three
components of the velocity tendency. Note that the computation of the
corrected velocity components does not require a boundary condition for
pressure (see for details).
Thermodynamics
MicroHH supports the potential (θ) and liquid water potential
(θl) temperature as thermodynamic variables
(Sect. ). The dry (θ) and moist
(θl) thermodynamics are related through the use of a total
specific humidity qt, which is defined as the sum of the water
vapor specific humidity (qv) and the cloud liquid water specific
humidity (ql). In the absence of liquid water, θl=θ; in the presence of liquid water, the liquid water potential
temperature is approximated as
θl≈θ-LvcpΠql,
where Lv is the latent heat of vaporization, cp the specific
heat of dry air at constant pressure, and Π is the Exner function:
Π=pp00Rd/cp,
where p is the hydrostatic pressure, p00 a constant reference
pressure, and Rd the gas constant for dry air. The cloud liquid
water content is calculated as
ql=max(0,qt-qs),
where qs is the saturation specific humidity:
qs=ϵesp-(1-ϵ)es,
with ϵ the ratio between the gas constant for dry air and the gas
constant for water vapor (Rd/Rv), and es
the saturation vapor pressure. The latter is approximated using a 10th order
Taylor expansion at T=0 ∘C of the Arden Buck equation
. ql is adjusted iteratively to arrive at a
consistent state where qv=qs. Finally, the virtual
potential temperature (Eq. ) is defined in MicroHH as
θv≡θ1-1-RvRdqt-RvRdql.
The base state pressure and density are calculated assuming a hydrostatic
equilibrium: dp0=-ρ0gdz, with the density
defined as ρ0=p0/(RdΠθv0).
Integration with height results in
p0;k+1=p0;kexp-g(zk+1-zk)RdΠθv0,
where θv0 is the average virtual potential temperature
between zk and zk+1. This equation is applied from a given surface
pressure to the model top, alternating the calculations at the full and half
model levels. That is, given the full thermodynamic state (pressure and
density) at a full level k, the thermodynamic state can be advanced from
the half level k-12 to k+12. Using the newly calculated
state at k+12, pressure and density at k+1 can be calculated.
The base state density ρ0 that is used in the dynamical core
(Sect. ) is calculated using the initial virtual potential
temperature profile and is not updated during the experiment. The density
and hydrostatic pressure used in the moist thermodynamics can optionally be
updated every time step, following the same procedure as explained in
.
Rotation
The effects of a rotating reference frame on an f plane can be included
through the Coriolis force. The acceleration due to the Coriolis force
Fi,cor is computed for the two horizontal velocity components
(indices 1 and 2 in Eqs. and ) as
F1,cori,j,k=f0vi,j,k,F2,cori,j,k=-f0ui,j,k,
with f0 as Coriolis parameter specified by the user.
Physical parameterizations
Subfilter-scale model for large-eddy simulation
With the governing equations described in Sect. it is
possible to resolve the flow down to the scales where molecular viscosity
acts. In many applications, however, such simulations are too costly. In that
case, one may opt for large-eddy simulation (LES), where filtered equations
are used to describe the largest scales of the flow, and the subfilter-scale
motions are modeled. The LES implementation in MicroHH assumes very high
Reynolds numbers in which the molecular viscosity is neglected. Filtering of
the anelastic conservation of momentum equation (Eq. ), with
a tilde applied to denote filtered variables, leads to
∂ũi∂t=-1ρ0∂ρ0ũiũj∂xj-∂π∂xi-1ρ0∂ρ0τij∂xj+δi3gθ̃v′θv0+Fi.
In this equation, a tensor τij is defined as
τij≡uiuj̃-ũiũj-13uiuĩ-ũiũi.
This is the anisotropic subfilter-scale kinematic momentum flux tensor. The
isotropic part of the full momentum flux tensor has been added to the
pressure, providing the modified pressure:
π≡p̃′ρ0+13uiuĩ-ũiũi.
As τij contains the filtered product of unfiltered velocity
components, this quantity needs to be parameterized. MicroHH uses the
Smagorinsky–Lilly model, in which τij is modeled as
τij=-Km∂ũi∂xj+∂ũj∂xi,
with Km interpreted as the subfilter eddy diffusivity. This quantity is modeled as
Km=λ2S1-gθv0∂θ̃v∂zPrtS212,
and is proportional to the magnitude S≡2SijSij12 of the strain tensor Sij, which is defined as
Sij≡12∂ũi∂xj+∂ũj∂xi.
The subfilter eddy diffusivity thus takes into account the local
stratification and the turbulent Prandtl number Prt. The
latter is set to one-third by default but can be overridden in the settings. The
length scale λ is the mixing length defined following
, as
1λn=1κz+z0n+1csΔn,
which is an arbitrary matching function (n is a free parameter, set to 2 in
MicroHH) between the mixing length following wall scaling to the subfilter
length scale (filter size) Δ≡(ΔxΔyΔz)1/3, related to the grid spacing. The grid scale is used as an implicit
filter; thus, no explicit filtering is applied. In the case of a high Reynolds
number atmospheric LES with an unresolved near-wall flow, the vertical
gradients of the horizontal velocity components ∂ũi,j/∂z in the strain tensor are replaced with the
theoretical gradients predicted from Monin–Obukhov similarity theory.
Evaluation of these gradients is explained in detail in
Sect. .
The same approach is followed for all scalars, including the thermodynamic
variables discussed in Sect. :
∂ϕ̃∂t=-1ρ0∂ρ0ũjϕ̃∂xj-1ρ0∂ρ0Rϕ,j∂xj+S̃ϕ.
The term Rϕ,j refers to the subfilter flux of ϕ̃ and is
defined as
Rϕ,j=ujϕ̃-ũjϕ̃.
The subfilter-scale flux is parameterized in terms of the gradient
Rϕ,j=-KmPrt∂ϕ̃∂xj.
Surface model
The LES implementation of MicroHH uses a surface model that is constrained to
rough surfaces and high Reynolds numbers, which is a typical configuration for
atmospheric flows. This model computes the surface fluxes of the horizontal
momentum components and the scalars (including thermodynamic variables) using
Monin–Obukhov similarity theory (MOST) (, his
Sect. 10.2). MOST relates surface fluxes of variables to their near-surface
gradients using empirical functions that depend on the height of the first
model level z1 divided by the Obukhov length L as an argument. Length
L is defined as
L≡-u*3κB0,
where u* is the friction velocity, κ is the Von Karman constant, and
B0 is the surface kinematic buoyancy flux. L represents the height at
which the buoyancy production/destruction of turbulence kinetic energy equals
the shear production. In MicroHH, we use a local implementation of MOST,
i.e., each grid point has its own value of L. This choice can lead to a
overestimation of near-surface wind due to violation of the MOST assumption
of horizontal homogeneity their Fig. 18, but it allows
for a more straightforward extension to heterogeneous land surfaces.
Following MOST, the friction velocity u* and the momentum fluxes may be related to the near-surface wind gradient as
κz1u*∂U∂z≈-κz1u*u′w′‾∂ũ∂z≈-κz1u*v′w′‾∂ṽ∂z≈ϕmz1L,
where U is defined as ũ2+ṽ2, and
u′w′‾ and v′w′‾ as the
surface momentum fluxes for the two wind components. These relationships can
be integrated from the roughness length z0m to z1 resulting in
u*=fmU1-U0,u′w′‾=-u*fmũ1-ũ0,v′w′‾=-u*fmṽ1-ṽ0,
with fm defined as
fm≡κlnz1z0m-Ψmz1L+Ψmz0mL,
with Ψm described in Eqs. () and ().
The same procedure for scalars is followed, with
κz1u*ϕ′w′‾∂ϕ̃∂z=ϕhz1L,
and in integrated form:
ϕ′w′‾=u*fhϕ̃1-ϕ̃0,
with
fh≡κlnz1z0h-Ψhz1L+Ψhz0hL,
with Ψh described in Eqs. () and ().
The functions ϕm, ϕh, Ψm, and Ψh are empirical and
depend on the static stability of the atmosphere. Under unstable conditions,
we follow :
ϕm,h=1+γm,hζ2/3-1/2,Ψm,h=3ln1+ϕm,h-12,
where ζ is the ratio of a height and the Obukhov length L, γm=3.6, and γh=7.9. Under stable conditions, we use
ϕm,h=1+λm,hζ,Ψm,h=-λm,hζ,
where λm=4.8 and λh=7.8.
With the equations above, the surface fluxes, surface values, and near-surface
gradients can be computed but only if the Obukhov length L is known. The
surface model calculates the Obukhov length by relating the dimensionless
parameter z1/L to a Richardson number. The employed formulation of the
Richardson number depends on the chosen boundary condition in the model.
Three possible options are available:
The first option is fixed momentum fluxes and a fixed surface buoyancy flux. Both the
friction velocity u* and the surface buoyancy flux B0 are specified.
Under these conditions, we define the Richardson number Ria equal
to z1/L; L can be computed directly from the expressionRia≡z1L=-κz1B0u*3.
The second option is a fixed horizontal velocity U0 at the surface and a fixed surface
buoyancy flux B0. The friction velocity u* is unknown. Now, L needs
to be retrieved from the implicit relationship:Rib≡z1Lfm3=-κz1B0U1-U03.
The third option is a fixed surface velocity U0 and a fixed surface buoyancy b0. With
this boundary condition, the surface values of the horizontal velocities and
the buoyancy are given, and both u* and the surface buoyancy flux B0
are unknown. L is then retrieved fromRic≡z1Lfm2fh=κz1b̃1-b̃0U1-U02.
In the event of the latter two options, a solver is required to find the value of
L that satisfies the equation, as fm (Eq. ) and fh
(Eq. ) both depend on L as well. For performance reasons, we
have created a lookup-table-based approach that relates L to the Richardson
number. The lookup table has 104 entries, of which 90 % is spaced
uniformly between z1/L=-5 to 5. The remaining 10 % are used to
stretch the negative range up to z1/L=-104 to allow for the correct
free convection limit.
Large-scale forcings
Pressure force
MicroHH provides two options to introduce a large-scale pressure force into
the model. The first is to enforce a constant mass flux through the domain in
the streamwise direction. In this approach, the desired large-scale velocity
Uf is set, and the corresponding pressure gradient is computed. We follow
here the approach of . In this approach, the
u component of the horizontal momentum equation (Eq. ) is
volume averaged to acquire
un+1-unΔt=f1-∂∂xpρ0+Fp;ls,
where brackets indicate a volume average, f1 contains all the right-hand-side
terms of the u component of the conservation of momentum, except for
the dynamic pressure, which is contained in the second term. The large-scale
pressure force Fp;ls, which is to be computed, is the last
term. We can now set un+1=Uf to explicitly set the
volume-averaged velocity in the next time step. Furthermore, the
volume-averaged horizontal pressure gradient vanishes, because of the
periodic boundary condition, which makes Fp;ls the only
unknown. The acquired pressure force Fp;ls will be added as an
external force in the equation of zonal velocity (F1 in
Eqs. and ).
The second option is to enforce a large-scale pressure force through the
geostrophic wind components ug and vg, in combination
with rotation, with the accelerations of the two horizontal velocity
components Fi,p;ls calculated as
F1,p;lsi,j,k=-f0vg;k,F2,p;lsi,j,k=f0ug;k,
where ug;k and vg;k are user-specified vertical
profiles of geostrophic wind components.
Large-scale sources and sinks
Large-scale sources and sinks, representing, for instance, large-scale
advection or radiative cooling, can be prescribed for each variable
separately. The user has to provide vertical profiles of large-scale sources
and sinks Sϕ;ls that are added to the total tendencies.
Large-scale vertical velocity
A second method of introducing large-scale thermodynamic effects is through
the inclusion of a large-scale vertical velocity. In this case, each scalar
gets an additional source term Sϕ,w,ls of the form
Sϕ,w,lsi,j,k=-wls;kδ2xϕk,
where wls;k is a user-specified vertical profile of large-scale
vertical velocity and ϕk is the horizontally averaged
vertical profile at height zk for scalar ϕ. The tendency term is not
applied to the momentum variables.
Buffer layer
MicroHH has the option to damp gravity waves in the top of the simulation
domain in a so-called buffer layer. The source term Sϕ,buf
associated with the damping at grid cell i,j,k is calculated for an
arbitrary variable ϕ as
Sϕ,bufi,j,k=ϕi,j,k-ϕ0;kτd;k,
where ϕ0 is taken from a user-specified vertical reference profile, and
timescale τd is a measure for the strength of the damping. It
varies with height and is calculated at height zk following
τd;k-1=σzk-zb;botzb;top-zb;botβ,
where σ is the damping frequency chosen by the user and β an
exponent that describes the shape of the vertical profile of the damping
frequency, which is always zero at the bottom (zb;bot) and
σ at the top (zb;top) of the layer.
Validation of the dynamical core
In this section, we present a series of cases intended to validate MicroHH
under a wide range of settings. Each of these test cases is available in the
cases/ directory in the MicroHH repository, where all detailed
settings can be found (see code availability section). Below, we present
only the most relevant information per case.
Taylor–Green vortex
The two-dimensional Taylor–Green vortex (cases/taylorgreen) presents
an ideal test case for a dynamical core, as it has an analytical solution
even though it is nonlinear. This flow is composed of two rotating vortices
whose evolution in a domain 0,1;0,0.5 is described with
u(x,z,t)=sin(2πx)cos(πz)f(t),w(x,z,t)=cos(2πx)sin(πz)f(t),p(x,z,t)=14sin(4πx)+sin(4πz)f(t)2,
where f(t)=8π2νt.
Normalized numerical Prandtl model solutions for velocity u (a)
and buoyancy b (b) compared to their analytical counterparts.
We use the analytical form at t=0 as the initial condition and run this
case for one vortex rotation (t=1), with ν=(800π2)-1. We
compare the result against the analytical solution for a set of grid spacings
and with the second-order and fourth-order dynamical cores; for the latter we
compare the most accurate advection scheme and the fully energy-conserving
one.
Figure shows the error convergence of the simulations.
The error for a variable ϕ is computed as ∑ΔxΔzϕi,k-ϕref,i,k, over the two-dimensional
domain, where Δx and Δz are the uniform grid spacings used in
this case and ϕref is the analytical solution. All variables
converge according to the order of the numerical scheme. The fourth-order
dynamical core loses accuracy at fine grid spacings. This is due to the
boundary condition for the vertical velocity that sacrifices an order of
accuracy to ensure global mass conservation .
Kinetic energy conservation and time accuracy
The second test of the dynamical core consists of combined evaluation of
kinetic energy (KE≡12u2+v2+w2) conservation and time accuracy (cases/conservation). In
this experiment, we run the model with only the advection and pressure solver
enabled and advect random noise through the domain for 1000 s. These tests
have been conducted with the third- and fourth-order Runge–Kutta schemes. We
have chosen the fourth-order spatial discretization in order to demonstrate
its energy conservation.
Velocity means (a) and variances (b) for channel flow case
at a Reynolds τ of 590. The dashed vertical lines mark the spectra
locations. Height z is normalized with uτ/ν; velocities with
uτ-1.
The loss of kinetic energy as a function of time is shown in
Fig. a. The fourth-order scheme results in a smaller
energy loss for the same time step and a faster convergence. The
error-convergence plot (Fig. b) shows that the error
convergence is in accordance with the order of the respective scheme.
Furthermore, it illustrates the fact that, if high accuracy in time is
desired, the five-stage, fourth-order scheme is less expensive than the
three-stage, third-order scheme. For instance, at a Δt of 10, the
error of the fourth-order scheme is approximately equal to the error of the
third-order scheme at a Δt of 2.5. To reach this accuracy, the
fourth-order scheme needs only 5 steps per 10 time units, whereas the
third-order scheme needs 12 steps.
Laminar anabatic flow
To test the buoyancy routine and the option to put the domain on a slope, a
Prandtl-type anabatic slope flow has been simulated
(cases/prandtlslope). In this test case, the surface is inclined at
an angle of 30∘ and a linearly stratified atmosphere (N=1 s-1) is heated from below with a fixed surface buoyancy flux of
0.005 m2 s-3.
Budgets of variances and turbulence kinetic energy (TKE, defined as u′2+v′2+w′2/2) compared against 's
reference data at a Reynolds τ of 590. Height z is normalized with
uτ/ν; the variances and TKE budget with ν/uτ4.
The fluid, which was initially at rest, goes through a series of decaying
oscillations after the buoyancy flux is applied at the surface. Eventually,
it reaches the steady state corresponding to the Prandtl model solution.
Numerical integration was performed sufficiently long for the oscillation
amplitude to become a small fraction of the amplitude of the first
oscillation. Comparison of horizontal wind u and buoyancy b of analytical
and numerical solutions is shown in Fig. . For both
variables, the solutions closely agree with each other.
Turbulent channel flow
For fully turbulent flows, the numerical solutions cannot be compared against
any analytical test cases. Therefore, we validate our results against a
channel flow at a Reynolds τ number of 590 for means,
variances, spectra, and second-order budget statistics
(cases/moser590). The case is run at a resolution of 768 ×
384 × 256 grid points. The original numerical simulation data of
have been produced on a 384 × 384 × 256
grid with spectral schemes in the horizontal dimensions and Chebyshev
polynomials in the vertical.
Figure a shows the normalized horizontally averaged
streamwise velocity. The normalized rms values of all three velocity components are
presented in Fig. b. All plotted variables show a
perfect match with the data and are indistinguishable from Moser's data. In
order to further assess the accuracy of the data, we show the second-order
budgets of the variances in Fig. . Also here, the match
with the reference data is excellent, which indicates that the whole range of
spatial scales in the flow is represented well and that the fourth-order
scheme is well able to pick up the small-scale details of the flow.
The findings in the previous paragraph are further corroborated by the
spectra shown in Fig. . Over the whole range of
scales, the match between our simulation and that of is
excellent. Note that the spectra from Moser's simulation display an increase
in pressure variance at the highest wavenumbers. This increase is the result
of aliasing errors at high wavenumbers that are typical for the spectral
schemes that used.
Spectra of all velocity components and pressure compared against
's reference data at a Reynolds τ of 590. The velocity
spectra are normalized with uτ-2; the pressure spectra with
uτ-4.
Turbulent katabatic flow
The final evaluation of the dynamical core without parameterizations enabled
is based on the direct numerical simulation of a turbulent katabatic flow.
Here, a buoyancy-driven slope flow is simulated following the setup of
(cases/drycblslope). A flow over a slope
inclined at an angle α of 60∘ is simulated with a fixed
uniform surface buoyancy flux of -0.5 m2 s-3. The simulation is
performed in a domain of 0.64 m × 0.64 m × 1.6 m using a
uniform grid of 256 × 256 × 640 points. The initial state
is a fluid at rest with a linear buoyancy stratification N of 1 s-1.
No-slip boundary conditions are applied at the bottom; free-slip at the top.
Turbulent motion starts quickly after the buoyancy flux is applied at the
surface. It is characterized by random, large-amplitude fluctuations of
velocity and buoyancy fields in the near-slope core region and shows
quasi-periodic oscillatory behavior at larger distances from the slope. Mean
profiles of the along-slope velocity component and buoyancy, as well as profiles
of second-order turbulence statistics, such as kinematic turbulent fluxes of
momentum and buoyancy, and velocity component and buoyancy fluctuation
variances, were evaluated by averaging the simulated flow fields spatially
over the along-slope planes and temporally over five oscillation periods
beyond the transition stage.
For comparison, the same katabatic flow case was reproduced using the
numerical code (hereafter referred to as FS09) that was employed to simulate
turbulent slope flows in and
. In that code, the time advancement was
performed with an Asselin-filtered second-order leapfrog scheme
. The spatial discretizations are identical to the
second-order accurate ones of MicroHH.
Numerical results obtained with both numerical codes testify that stable
environmental stratification in combination with negative surface buoyancy
forcing in the katabatic flow leads to an effective suppression of vertical
turbulent exchange in the flow region adjacent to the slope. This suppression
results in a shallow near-surface sublayer with strong buoyancy gradients
(Fig. a) capped by a narrow jet with peak velocity located
very close to the ground (Fig. b). Further comparison has
been performed on the slope-normal fluxes of momentum and buoyancy (not
shown), where a nearly perfect match has been reproduced as well.