Construction of hydrostatically stratified base state

Here we describe how ERF initializes base state values of density and potential temperature such that the density, pressure and potential temperature satisfy both the hydrostatic balance and the equation of state.

Users have the option to define a dry or moist background state.

Computation of the dry density

We express the total pressure \(p\) as:

\[p = \rho_d R_d T_v.\]

By definition, we have:

\[T_v = \theta_m\left(\frac{p}{p_0}\right)^{R_d/C_p},\]
\[T = \theta_d\left(\frac{p}{p_0}\right)^{R_d/C_p}.\]

This gives:

\[p = \rho_d R_d \theta_m\left(\frac{p}{p_0}\right)^{R_d/C_p},\]

which, on rearranging, yields:

\[p = p_0\left(\frac{\rho_d R_d \theta_m}{p_0}\right)^\gamma.\]

To obtain \(\theta_m\), consider the density of dry air:

\[\rho_d = \frac{p - p_v}{R_d T}.\]

Substituting for \(\rho_d\) from the above equation, we get:

\[\frac{p}{T_v} = \frac{p - p_v}{T},\]

which implies:

\[\frac{T_v}{T} = \frac{p}{p - p_v} = \frac{1}{1-\left(\cfrac{p_v}{p}\right)}.\]

We also have:

\[q_v = \frac{\rho_v}{\rho_d} = \frac{p_v}{R_v T}\frac{R_d T}{p-p_v} = \frac{r p_v}{p - p_v},\]

where \(p_v\) is the partial pressure of water vapor, \(r = R_d/R_v \approx 0.622\), and \(q_v\) is the vapor mass mixing ratio—the ratio of the mass of vapor to the mass of dry air. Rearranging and using \(q_v \ll r\), we get:

\[\frac{p_v}{p} = \frac{1}{1 + \left(\cfrac{r}{q_v}\right)} \approx \frac{q_v}{r},\]

which, on substitution in the equation for \(\frac{T_v}{T}\), gives:

\[\frac{T_v}{T} = \frac{1}{1 - \left(\cfrac{q_v}{r}\right)}.\]

As \(q_v \ll 1\), a binomial expansion, ignoring higher-order terms, gives:

\[T_v = T\left(1 + \frac{R_v}{R_d}q_v\right).\]

Hence, the density of dry air is given by:

\[\rho_d = \frac{p}{R_d T_v} = \frac{p}{R_d T\left(1 + \cfrac{R_v}{R_d}q_v\right)}.\]

Initialization with a second-order integration of the hydrostatic equation

We have the hydrostatic equation given by

\[\frac{\partial p}{\partial z} = -\rho g,\]

where \(\rho = \rho_d(1 + q_t)\), \(\rho_d\) is the dry density, and \(q_t\) is the total mass mixing ratio – water vapor and liquid water. Using an average value of \(\rho\) for the integration from \(z = z(k-1)\) to \(z(k)\), we get

\[p(k) = p(k-1) - \frac{(\rho(k-1) + \rho(k))}{2} g\Delta z.\]

The density at a point is a function of the pressure, potential temperature, and relative humidity. The latter two quantities are computed using user-specified profiles, and hence, for simplicity, we write \(\rho(k) = f(p(k))\). Hence

\[p(k) = p(k-1) - \frac{\rho(k-1)}{2}g\Delta z - \frac{f(p(k))}{2}g\Delta z.\]

Now, we define

\[F(p(k)) \equiv p(k) - p(k-1) + \frac{\rho(k-1)}{2}g\Delta z + \frac{f(p(k))}{2}g\Delta z = 0.\]

This is a non-linear equation in \(p(k)\). Consider a Newton-Raphson iteration (where \(n\) denotes the iteration number) procedure

\[F(p+\delta p) \approx F(p) + \delta p \frac{\partial F}{\partial p} = 0,\]

which implies

\[\delta p = -\frac{F}{F'},\]

with the gradient being evaluated as

\[F' = \frac{F(p+\epsilon) - F(p)}{\epsilon},\]

and the iteration update is given by

\[p^{n+1} = p^n + \delta p.\]

For the first cell (\(k=0\)), which is at a height of \(z = \frac{\Delta z}{2}\) from the base, we have

\[p(0) = p_0 - \rho(0)g\frac{\Delta z}{2},\]

where \(p_0 = 1e5 \, \text{N/m}^2\) is the pressure at the base. Hence, we define

\[F(p(0)) \equiv p(0) - p_0 + \rho(0)g\frac{\Delta z}{2},\]

and the Newton-Raphson procedure is the same.