Doing the hamiltonian myself

We assume that the derivation of the prognostic equations should be fine, aside from the definition of pseudodensity. We use Dubos and Tort TD14 to explain how to get a correct pseudodensity for our equation set in Lagrangian mass coordinates.

Useful stuff from TD14:

Pseudodensity in Lagrangian coordinates

We work continuously for the moment. Let μ^\hat{\mu} be the pseudodensity in Eulerian coordinates. The paragraph between Eqn (6) and Eqn (7) gives that μ^=r2cosϕα=ρr2cosϕ.\hat{\mu} = \frac{r^2 \cos\phi}{\alpha} = \rho r^2 \cos\phi. Let η\eta be an arbitrary vertical coordinate. Let ξ3\xi^3 be the vertical Eulerian vertical coordinate. The aforementioned paragraph gives that for spherical geometry ξ3r\xi^3 \equiv r.

The mass budget, which is quite closely related to the question we want to answer, is governed in Lagrangian coordinates by 0=tμ+l(μul)μ=Jμ^J=detlξk \begin{align*} 0 &= \partial_t \mu + \partial_l (\mu u^l) \\ \mu &= J\hat{\mu} \\ J &= \det{\partial_l \xi^k } \end{align*}

Eqn (24) in TD14 states that pseudodensity under an arbitrary vertical coordinate η\eta is μ=μ^ηξ3=μ^ηr, \begin{align*} \mu &= \hat{\mu} \partial_\eta \xi^3 \\ &= \hat{\mu} \partial_\eta r, \end{align*} which follows from the expression for JJ and the fact that λ,ϕ\lambda, \phi are still Eulerian. Therefore the Jacobian is diagonal, with all entries equal to 1 except for the ηr\partial_\eta r term.

Now suppose that η\eta is specifically the mass-based eta coordinate used by HOMME. It is Lagrangian, i.e. u3=η˙=0.u^3 = \dot{\eta} = 0.

Let η[0,1]\eta \in [0, 1]. This is defined in terms of M(ξ1,ξ2,t)=01μ(ξ1,ξ2,η)dημ=η[A]M+η[B] \begin{align*} M(\xi^{1},\xi^2, t) &= \int_0^1 \mu(\xi^{1}, \xi^{2}, \eta) \,\mathrm{d}\eta\\ \mu &= \partial_\eta [A]M + \partial_\eta[B] \end{align*}

The rather peculiar dependence of μ\mu on MM leads TD14 to claim that MM is the quantity which should be used to determine the prognostic equations. TD14 prognoses MM. This should be equivalent to calculating it within levels, since we are prognosing ηiηi+1μdη\int_{\eta_i}^{\eta_{i+1}} \mu \, \mathrm{d}\eta?

TD14 makes the definition H[vi,r,μv3,M,S]=H[vi,r,μv3,AM+B,S].\mathcal{H}'[v_i, r, \mu v_3, M, S] = \mathcal{H}[v_i, r, \mu v_3, A'M + B', S]. Why is this a problem?}

Note: Chris's appendix in Tea20 attempts to derive the equations of motion using δHδπs \begin{align*} \frac{\delta \mathcal{H}}{\delta \frac{\partial \pi}{\partial s}} \end{align*} I suspect that the "energetically neutral transport term" of Tea20 Vs˙\mathcal{V} \cdot \dot{s} rectifies the difference. In any case,

Miscellany from appendix

M(ξ1,ξ2,t)=bottomtopμdη=bottomtopμ^dr \begin{align*} M(\xi^{1},\xi^2, t) &= \int_{\textrm{bottom}}^{\textrm{top}} \mu \, \mathrm{d}\eta = \int_{\textrm{bottom}}^{\textrm{top}} \hat{\mu} \, \mathrm{d} r \end{align*}

This uniquely defines the position of r(ξ1,ξ2,η)r(\xi^1, \xi^2, \eta) according to A(η)M(ξ1,ξ2)+B(η)=r0r(η)μ^dr \begin{align*} A(\eta) M(\xi^1, \xi^2) + B(\eta) = \int_{r_0}^{r(\eta)}\hat{\mu} \, \mathrm{d}r \end{align*}

Oksana's notes

For the purposes of disambiguation, I'll stick with calling pseudodensity μ\mu and refer to the pressure adjustment factor (μ\mu in Oksana's notes) as ψ\psi.

A pseudodensity is simply a quantity which evolves according to a flux-form continuity equaiton. The simplest such density is a rewrite of the continuity equation ρt+(ρv)=0 \begin{align*} \rho_t + \nabla \cdot (\rho \mathbf{v}) = 0 \end{align*} and the notes state that from this we could derive (rsr2ρ)τ+s(r1rsr2u)+(s˙rsr2ρ)s.(r_sr^2\rho)_\tau + \nabla_s (r^{-1} r_s r^2 \mathbf{u}) + (\dot{s}r_sr^2\rho)_s. The definition above μ=μ^sr\mu = \hat{\mu} \partial_s r combined with μ^=r2ρ\hat{\mu} = r^2\rho gives μ=rsr2ρ.\mu = r_s r^2\rho.

The trouble with defining sph=s[ph]r[s]=gρrsr^2 \begin{align*} \partial_s p_h &= \partial_s [p_h] \partial_r [s] \\ &= -g\rho r_s \hat{r}^2 \end{align*} is that g=g0r^2.g = g_0 \hat{r}^{-2}. This implies that the actual pressure value per gridpoint in the deep atmosphere would be essentially the same, but it would represent a fundamentally different quantity.

Ok so the hypsometric equation is hidden in here (assume shallow atm for the moment): sϕ=Rds[π]θvΠp    s[ϕ]ds=Rds[π]θvΠpds    Δϕ=Rds[π]θvΠpds    Δϕ=RdTps[π]ds    Δϕ=RdTpdπ \begin{align*} &\partial_s \phi = -R_d \partial_s[\pi] \theta_v \frac{\Pi}{p}\\ \implies& \int \partial_s [\phi] \, \mathrm{d}s = -R_d \int \partial_s[\pi] \theta_v \frac{\Pi}{p} \, \mathrm{d}s\\ \implies& \Delta \phi = -R_d \int \partial_s[\pi] \theta_v \frac{\Pi}{p} \, \mathrm{d}s\\ \implies& \Delta \phi = -R_d \int \frac{T}{p} \partial_s[\pi]\, \mathrm{d}s\\ \implies& \Delta \phi = -R_d \int \frac{T}{p}\, \mathrm{d}\pi\\ \end{align*} Assuming T=T0T=T_0 and p=π,p=\pi, then we get the standard hydrostatic hypsometric equation.

Following Quasi-hamiltonian derivation in Tea20

The definition for the mass coordinate is πA(η)p0+B(η)ps \begin{align*} \pi \equiv A(\eta) p_0 + B(\eta) p_s \end{align*}

which allows us to back out that η˙ηπ=B(η)ηtop1ηη[π]udηηtopηηη[π]uds \begin{align*} \dot{\eta} \partial_\eta \pi = B(\eta) \int_{\eta_{\textrm{top}}}^{1} \nabla_{\eta}\cdot \partial_{\eta} [\pi ] \mathbf{u} \intd{\eta} - \int_{\eta_{\textrm{top}}}^{\eta} \nabla_\eta \cdot \partial_\eta [\pi] \mathbf{u} \intd{s} \end{align*}

Assuming that π\pi is defined with respect to the deep atmosphere, I see no problems with this so far.

The components to assemble the equation of state include η[π]z[η]=ρg=η[π](η[gz])1g \begin{align*} \partial_{\eta}[\pi] \partial_{z} [\eta] &= -\rho g\\ &= -\partial_{\eta} [\pi] \left(\partial_{\eta} [gz] \right)^{-1} \cdot g \end{align*}

Mass integrals:

Shallow:

zsurfztopρXdz=zsurfztopη[π](η[g0z])1Xdz=g01zsurfztopη[π]z[η]Xdz=g01ηtopηsurfη[π]Xdη \begin{align*} \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \rho X \intd{z} &= \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \partial_{\eta} [\pi] \left(\partial_{\eta} [g_0z] \right)^{-1} X \intd{z}\\ &= g_0^{-1} \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \partial_{\eta} [\pi] \partial_{z} [\eta] X \intd{z}\\ &= g_0^{-1} \int_{\eta_\textrm{top}}^{\eta_{\textrm{surf}}} \partial_{\eta} [\pi] X \intd{\eta} \end{align*} which demonstrates the shallow atmosphere identity from the paper.

Deep:

Let's do this for the deep atmosphere in a naive way: zsurfztopρXdz=zsurfztopη[π](η[g0zR02(R0+z)2])1Xdz \begin{align*} \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \rho X \intd{z} &= \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \partial_{\eta} [\pi] \left(\partial_{\eta} \left[g_0\frac{zR_0^2}{(R_0+z)^2}\right] \right)^{-1} X \intd{z} \end{align*} which is garbage. But can we get further if we don't expand geopotential (it's still monotonic in η\eta so we can use the inverse function theorem) zsurfztopρXdz=zsurfztopη[π]ϕ[η]Xdz \begin{align*} \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \rho X \intd{z} &= \int_{z_\textrm{surf}}^{z_{\textrm{top}}} \partial_{\eta} [\pi] \partial_{\phi} \left[\eta \right] X \intd{z} \end{align*} which invites the question whether the physical integral on the LHS can be restated in terms of geopotential. zbotztopρXdz=ϕbotϕtopρ(z[ϕ])1Xdϕ=ϕbotϕtopη[π]ϕ[η](z[ϕ])1Xdϕ=ηtopηbotη[π](z[ϕ])1Xdη \begin{align*} \int_{z_{\textrm{bot}}}^{z_{\textrm{top}}} \rho X \intd{z} &= \int_{\phi_{\textrm{bot}}}^{\phi_{\textrm{top}}} \rho \left(\partial_{z} [\phi]\right)^{-1} X \intd{\phi} \\ &= \int_{\phi_{\textrm{bot}}}^{\phi_{\textrm{top}}} \partial_{\eta} [\pi] \partial_{\phi} [\eta] \left(\partial_{z} [\phi]\right)^{-1} X \intd{\phi} \\ &= \int_{\eta_{\textrm{top}}}^{\eta_{\textrm{bot}}} \partial_{\eta} [\pi] \left(\partial_{z} [\phi]\right)^{-1} X \intd{\eta} \\ \end{align*} where z[ϕ]=g(z)z+g(z) \begin{align*} \partial_z [\phi] &= g'(z) z + g(z) \end{align*} where g(z)z=R02z2(R0+z)3    g(z)z0.024 m s2 \begin{align*} &g'(z)z = -R_0^2 z\frac{2}{(R_0+z)^3}\\ \implies& |g'(z) z| \approx 0.024 \textrm{~m~s}^{-2} \end{align*} so in assuming that (zϕ)1=1g0\left(\partial_z \phi\right)^{-1} = \frac{1}{g_0} we incur a 0.3% multiplicative error.

The Hamiltonian derivation

Kinetic, internal, and potential energy are supposedly given by K=12η[π]v2,I=cpΘΠη[π]1ρp+ptopϕtopP=η[π]ϕ \begin{align*} K = \frac{1}{2} \partial_{\eta} [\pi] \mathbf{v}^2, \qquad I = c_p \Theta \Pi - \partial_{\eta} [\pi] \frac{1}{\rho} p + p_{\textrm{top}} \phi_{\textrm{top}} \qquad P = \partial_{\eta} [\pi] \phi \end{align*} and note that ptopp_{\textrm{top}} is really a hydrostatic pp. This section simply notes that dA\intd{A} is an "area" metric. This has no radial dependence in the shallow atmosphere but (in the most naive formulation) gains a radial dependence in the deep atmosphere. Note: no functional derivatives with respect to non-hydrostatic pressure pp are sought. Due to the EOS pp is subjugated byϕ\phi.

Therefore define H=12η[π](u,u+w2)(1)+cpΘΠ+η[ϕ]p+ptopϕtop(2)+η[π]ϕ(3)dAdη \begin{align*} \mathcal{H} = \iint \textcolor{#2a3d45}{\stackrel{(1)}{\frac{1}{2} \partial_{\eta} [\pi](\langle \mathbf{u}, \mathbf{u}\rangle + w^2)}} + \textcolor{#DDC9B4}{\stackrel{(2)}{c_p \Theta \Pi + \partial_{\eta} [\phi] p + p_{\textrm{top}} \phi_{\textrm{top}}}} + \textcolor{#C17C74}{\stackrel{(3)}{\partial_{\eta} [\pi] \phi}} \intd{A} \intd{\eta} \end{align*} and we do the typical algebraic shenanigans and discard second-order terms: (1):12(η[π]+δ[η[π]])(u+δu,u+δu+(w+δw)2)=12(η[π]+δ[η[π]])(u,u+2δu,u+δu,δu+w2+2wδw+δw2)=12(η[π]+δ[η[π]])(u,u+2δu,u+w2+2wδw)+O(ε2)=12η[π](u,u+w2)+η[π](δu,u+wδw)+12δ[η[π]](u,u)+w2)+δ[η[π]](δu,u+wδw)+O(ε2)=K+η[π](δu,u+wδw)+12δ[η[π]](u,u)+w2)+O(ε2)=K+η[π]u,δu+η[π]wδw+12(u,u+w2)δ[η[π]]+O(ε2) \begin{align*} \textcolor{#2a3d45}{(1)}:&\frac{1}{2} (\partial_{\eta} [\pi] + \delta \left[\partial_{\eta} [\pi]\right])(\langle \mathbf{u} + \delta \mathbf{u}, \mathbf{u} + \delta \mathbf{u} \rangle + (w + \delta w)^2)\\ =& \frac{1}{2} (\partial_{\eta} [\pi] + \delta \left[\partial_{\eta} [\pi]\right])(\langle \mathbf{u}, \mathbf{u} \rangle + 2 \langle \delta \mathbf{u}, \mathbf{u} \rangle + \langle \delta \mathbf{u}, \delta \mathbf{u} \rangle + w^2 + 2w\delta w + \delta w^2)\\ =& \frac{1}{2} (\partial_{\eta} [\pi] + \delta \left[\partial_{\eta} [\pi]\right])(\langle \mathbf{u}, \mathbf{u} \rangle + 2 \langle \delta \mathbf{u}, \mathbf{u} \rangle + w^2 + 2w\delta w ) + \mathcal{O}(\varepsilon^2)\\ =& \frac{1}{2} \partial_{\eta}[\pi]( \langle \mathbf{u}, \mathbf{u} \rangle + w^2) + \partial_{\eta} [\pi] (\langle \delta \mathbf{u}, \mathbf{u} \rangle + w \delta w) + \frac{1}{2} \delta \left[\partial_{\eta} [\pi]\right] (\langle \mathbf{u}, \mathbf{u}) + w^2) + \delta \left[\partial_{\eta} [\pi]\right] (\langle \delta \mathbf{u}, \mathbf{u} \rangle + w\delta w) + \mathcal{O}(\varepsilon^2)\\ =& K + \partial_{\eta} [\pi] (\langle \delta \mathbf{u}, \mathbf{u} \rangle + w \delta w) + \frac{1}{2} \delta \left[\partial_{\eta} [\pi]\right] (\langle \mathbf{u}, \mathbf{u}) + w^2) +\mathcal{O}(\varepsilon^2) \\ =& K + \langle \partial_{\eta} [\pi] \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi] w \delta w + \frac{1}{2} (\langle \mathbf{u}, \mathbf{u}\rangle + w^2) \delta \left[\partial_{\eta} [\pi]\right] +\mathcal{O}(\varepsilon^2) \\ \end{align*} and (2):cp(Θ+δΘ)Π+(η[ϕ]+δ[η[ϕ]])p+ptop(ϕtop+δϕtop)=cpΘΠ+η[ϕ]p+ptopϕtop+cpΠδΘ+pδ[η[ϕ]]+ptopδ[ϕtop]=I+cpΠδΘ+pδ[η[ϕ]]+ptopδ[ϕtop] \begin{align*} \textcolor{#DDC9B4}{(2)}:& c_p (\Theta + \delta \Theta) \Pi + (\partial_{\eta} [\phi] + \delta [\partial_{\eta} [\phi]]) p + p_{\textrm{top}} (\phi_{\textrm{top}} + \delta \phi_{\textrm{top}}) \\ =& c_p \Theta \Pi + \partial_{\eta} [\phi] p + p_{\textrm{top}}\phi_{\textrm{top}} + c_p \Pi \delta \Theta + p \delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] \\ =& I + c_p \Pi \delta \Theta + p \delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] \end{align*} and (3):(η[π]+δ[η[π]])(ϕ+δϕ)=η[π]ϕ+η[π]δϕ+ϕδ[η[π]]+δ[η[π]]δϕ=P+η[π]δϕ+ϕδ[η[π]]+O(ε2) \begin{align*} \textcolor{#C17C74}{(3)}:& (\partial_\eta [\pi] + \delta [\partial_{\eta}[\pi]])(\phi + \delta \phi) \\ =& \partial_{\eta}[\pi] \phi + \partial_{\eta} [\pi] \delta \phi + \phi \delta [\partial_{\eta}[\pi]] + \delta[\partial_{\eta}[\pi]] \delta \phi \\ =& P + \partial_{\eta} [\pi] \delta \phi + \phi \delta [\partial_{\eta}[\pi]] +\mathcal{O}(\varepsilon^2) \end{align*} giving δH=limε0H(u+εδu,w+εδw,ϕ+εδϕ,Θ+δΘ,η[π]+δ[η[π]])H(u,w,ϕ,Θ,η[π])ε=η[π]u,δu+η[π]wδw+12(u,u+w2)δ[η[π]]+cpΠδΘ+pδ[η[ϕ]]+ptopδ[ϕtop]+η[π]δϕ+ϕδ[η[π]]dAdη=η[π]u,δu+η[π]wδw+(u,u+w22+ϕ)δ[η[π]]+cpΠδΘ+pδ[η[ϕ]]+ptopδ[ϕtop]+η[π]δϕdAdη. \begin{align*} \delta \mathcal{H} &= \lim_{\varepsilon \to 0} \frac{\mathcal{H}(\mathbf{u} + \varepsilon \delta \mathbf{u}, w + \varepsilon \delta w, \phi + \varepsilon \delta \phi, \Theta + \delta \Theta, \partial_{\eta}[\pi] + \delta[\partial_{\eta}[\pi]] )- \mathcal{H}(\mathbf{u}, w, \phi , \Theta , \partial_{\eta}[\pi] )}{\varepsilon}\\ &= \iint \langle \partial_{\eta} [\pi] \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi] w \delta w + \frac{1}{2} (\langle \mathbf{u}, \mathbf{u}\rangle + w^2) \delta \left[\partial_{\eta} [\pi]\right] + c_p \Pi \delta \Theta + p \delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] + \partial_{\eta} [\pi] \delta \phi + \phi \delta [\partial_{\eta}[\pi]] \intd{A} \intd{\eta} \\ &= \iint \langle \partial_{\eta} [\pi] \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi] w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]\right] + c_p \Pi \delta \Theta + p \delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] + \partial_{\eta} [\pi] \delta \phi \intd{A} \intd{\eta}. \end{align*} and we rewrite pδ[η[ϕ]]+ptopδϕtopdAdη=pδ[η[ϕ]]dη+ptopδϕtopdA=[pδϕ]η=ηtopη=1η[p]δϕdη+ptopδϕtopdA=pbotδϕbotptopδϕtop+ptopδϕtopη[p]δϕdηdA \begin{align*} \int \int p\delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \intd{\eta} &= \int \int p\delta[\partial_{\eta}[\phi]] \intd{\eta} + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \\ &= \int [p \delta \phi]_{\eta = \eta_{\textrm{top}}}^{\eta = 1} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \\ &= \int p_{\textrm{bot}}\delta\phi_{\textrm{bot}} - p_{\textrm{top}}\delta\phi_{\textrm{top}} + p_{\textrm{top}} \delta \phi_{\textrm{top}} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ \end{align*} and we now note that δϕbot=0\delta \phi_{\textrm{bot}} = 0 due to the stationary topography at the lower boundary condition. Therefore pδ[η[ϕ]]+ptopδϕtopdAdη=pbotδϕbotη[p]δϕdηdA=η[p]δϕdηdA. \begin{align*} \int \int p\delta[\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \intd{\eta} &= \int p_{\textrm{bot}}\delta\phi_{\textrm{bot}} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ &= \int \int -\partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ \end{align*}. where we have relied on the fact that ηδϕ=δηϕ\partial_{\eta} \delta \phi = \delta \partial_{\eta} \phi. We can return to the total functional differential to find δH=η[π]u,δu+η[π]wδw+(u,u+w22+ϕ)δ[η[π]]+cpΠδΘ+(η[π]η[p])δϕdAdη. \begin{align*} \delta \mathcal{H} &= \iint \langle \partial_{\eta} [\pi] \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi] w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]\right] + c_p \Pi \delta \Theta + (\partial_{\eta} [\pi] - \partial_{\eta} [p]) \delta \phi \intd{A} \intd{\eta}. \end{align*} which gives δHδu=η[π]uδHδw=η[π]wδHδϕ=η[π]η[p]δHδΘ=cpΠδHδη[π]=u2+w22+ϕ \begin{align*} \fder{\mathcal{H}}{\mathbf{u}} &= \partial_{\eta}[\pi] \mathbf{u}\\ \fder{\mathcal{H}}{w} &= \partial_{\eta} [\pi] w \\ \fder{\mathcal{H}}{\phi} &= \partial_{\eta} [\pi] - \partial_{\eta} [p]\\ \fder{\mathcal{H}}{\Theta} &= c_p \Pi \\ \fder{\mathcal{H}}{\partial_{\eta} [\pi]} &= \frac{\mathbf{u}^2 + w^2}{2} + \phi \end{align*} which agrees precisely with Tea20. However: does the integration by parts trickery work if we do the pseudodensity trick instead of modifying dA\mathrm{d}A?

Rectifying pseudodensity using TD14:

A fundamental property of our pseudodensity is that ms=psg=01μdη \begin{align*} m_s = \frac{p_s}{g} &= \int_0^1 \mu \intd{\eta} \end{align*} and TD14 suggests that we define μ=η(A)M+η(B)M0\mu = \partial_{\eta} (A) M + \partial_{\eta} (B) M_0 . Let's validate that this works: 01η(A)M+η(B)dη=[A]η=0η=1M+[B]η=0η=1=M \begin{align*} \int_0^1 \partial_{\eta} (A) M + \partial_{\eta} (B) \intd{\eta} &= \left[A\right]_{\eta=0}^{\eta =1} M + \left[B\right]_{\eta=0}^{\eta =1} \\ &= M \end{align*} so this constrains that the dp3d=psΔA+p0ΔB=g0(msΔA+m0ΔB) \textrm{dp3d} = p_s\Delta A + p_0 \Delta B = g_0(m_s \Delta A + m_0 \Delta B). Dividing by g0g_0, even in the deep atmosphere, gives the mass located between particular model levels. This means that the correct generalization to the deep atmosphere is dp3d=g0a2(a+z)2(msΔA+m0ΔB) \textrm{dp3d} = g_0 \frac{a^2}{(a+z)^2} (m_s \Delta A + m_0 \Delta B) This would make the value of dp3d\sum \textrm{dp3d} coincide with the mass-weighted integral. However, this means that the gg correction really must be inside the integral.

Curl form for mass coordinates in TD14:

In TD14 notation we have tM+iδHδvidη=0tS+i(sδHδvi)+η(Sη˙)=0tvi+(ηviiv3)η˙+jviivjμδHδvj+i(δHδμ+η˙v3)+si(δHδS)=0tV3+η(V3η˙)+δHδξ3=0tξ3+η˙ηξ3δHδV3=0 \begin{align*} \partial_t M + \partial_i \int \fder{\mathcal{H}'}{v_i} \intd{\eta} &= 0 \\ \partial_t S + \partial_i \left(s \fder{\mathcal{H}'}{v_i} \right) + \partial_{\eta} \left( S \dot{\eta} \right) &= 0 \\ \partial_{t} v_i + (\partial_\eta v_i - \partial_i v_3) \dot{\eta} + \frac{\partial_j v_i - \partial_i v_j}{\mu} \fder{\mathcal{H'}}{v_j} + \partial_i \left( \fder{\mathcal{H}}{\mu} + \dot{\eta} v_3 \right) + s \partial_i \left(\fder{\mathcal{H}'}{S} \right) &= 0\\ \partial_t V_3 + \partial_{\eta} (V_3 \dot{\eta}) + \fder{\mathcal{H}'}{\xi^3} = 0\\ \partial_t \xi^3 + \dot{\eta} \partial_{\eta} \xi^3 - \fder{\mathcal{H}'}{V_3} = 0 \end{align*} where V3μv^3viv^i+v^3iξ3vl^L^u^l. \begin{align*} V_3 &\equiv \mu \hat{v}_3 \\ v_i &\equiv \hat{v}_i + \hat{v}_3 \partial_i \xi^3 \\ \hat{v_l} &\equiv \pder{\hat{L}}{\hat{u}^l}. \end{align*} We note that ξ3=r\xi^3 = r.

Tea20 makes the definition μ=η[A]M+η[B]\mu = \partial_{\eta} [A] M + \partial_{\eta} [B]. With this definition tM+iδHδvidη=tμdη+iμuidη \begin{align*} \partial_t M + \partial_i \int \fder{\mathcal{H}'}{v_i} \intd{\eta} &= \partial_t \int \mu \intd{\eta} + \partial_i \int \mu u_i \intd{\eta} \end{align*} which is quite straightforwardly the continuity equation in weak form. It remains to show that (43) and (44) in TD14 are satisfied by this definition, but I suspect they are.

Let's examine η \begin{align*} \int \partial_{\eta} \end{align*}

The Hamiltonian derivation for Oksana's notes

The idea for this hack is to essentially redefine dA\mathrm{d}A as r^2dA\hat{r}^2 \intd{A} by defining dp3d\mathrm{dp3d}.

Kinetic, internal, and potential energy are supposedly given by K=12η[π]r^2v2,I=cpΘΠη[π]r^21ρp+ptopϕtopP=η[π]r^2ϕ \begin{align*} K = \frac{1}{2} \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{v}^2, \qquad I = c_p \Theta \Pi - \partial_{\eta} [\pi]_{\hat{r}^2} \frac{1}{\rho} p + p_{\textrm{top}} \phi_{\textrm{top}} \qquad P = \partial_{\eta} [\pi]_{\hat{r}^2} \phi \end{align*} and note that ptopp_{\textrm{top}} is really a hydrostatic pp. In mass-based coordinates, it is also time-invariant. Since Θ=η[π]θv\Theta = \partial_{\eta} [\pi] \theta_v, terms containing Θ\Theta gain a correction. This time we are rather more careful, noting that if r^2ηϕ=Rdη[π]r^2θvΠp=RdpθvTvθvη[π]r^2=1ρη[π]r^2.. \begin{align*} \hat{r}^2 \partial_{\eta} \phi &= -R_d \partial_{\eta} [\pi]_{\hat{r}^2} \theta_v \frac{\Pi}{p} \\ &= -\frac{R_d}{p} \theta_v\frac{T_v}{\theta_v} \partial_{\eta} [\pi]_{\hat{r}^2} \\ &= -\frac{1}{\rho} \partial_{\eta} [\pi]_{\hat{r}^2}. \end{align*}.

Therefore define H=12η[π]r^2(u,u+w2)(1)+cpΘr^2Π+η[ϕ]r^2p+r^top2ptopϕtop(2)+η[π]r^2ϕ(3)dAdη \begin{align*} \mathcal{H} = \iint \textcolor{#2a3d45}{\stackrel{(1)}{\frac{1}{2} \partial_{\eta} [\pi]_{\hat{r}^2}(\langle \mathbf{u}, \mathbf{u}\rangle + w^2)}} + \textcolor{#DDC9B4}{\stackrel{(2)}{c_p \Theta_{\hat{r}^2} \Pi + \partial_{\eta} [\phi]_{\hat{r}^2} p + \hat{r}_{\textrm{top}}^2p_{\textrm{top}} \phi_{\textrm{top}}}} + \textcolor{#C17C74}{\stackrel{(3)}{\partial_{\eta} [\pi]_{\hat{r}^2} \phi}} \intd{A} \intd{\eta} \end{align*} and the same algebraic manipulations gives δH=limε0H(u+εδu,w+εδw,ϕ+εδϕ,Θr^2+δΘr^2,η[π]r^2+δ[η[π]r^2])H(u,w,ϕ,Θr^2,η[π]r^2)ε=η[π]r^2u,δu+η[π]r^2wδw+12(u,u+w2)δ[η[π]r^2]+cpΠδΘr^2+pδ[η[ϕ]r^2]+ptopδ[ϕtop]+η[π]r^2δϕ+ϕδ[η[π]r^2]dAdη=η[π]r^2u,δu+η[π]r^2wδw+(u,u+w22+ϕ)δ[η[π]r^2]+cpΠδΘr^2+pδ[η[ϕ]r^2]+ptopδ[ϕtop]+η[π]r^2δϕdAdη.. \begin{align*} \delta \mathcal{H} &= \lim_{\varepsilon \to 0} \frac{\mathcal{H}(\mathbf{u} + \varepsilon \delta \mathbf{u}, w + \varepsilon \delta w, \phi + \varepsilon \delta \phi, \Theta_{\hat{r}^2} + \delta \Theta_{\hat{r}^2} , \partial_{\eta}[\pi]_{\hat{r}^2} + \delta[\partial_{\eta}[\pi]_{\hat{r}^2} ] )- \mathcal{H}(\mathbf{u}, w, \phi , \Theta_{\hat{r}^2} , \partial_{\eta}[\pi]_{\hat{r}^2} )}{\varepsilon}\\ &= \iint \langle \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi]_{\hat{r}^2} w \delta w + \frac{1}{2} (\langle \mathbf{u}, \mathbf{u}\rangle + w^2) \delta \left[\partial_{\eta} [\pi]_{\hat{r}^2} \right] + c_p \Pi \delta \Theta_{\hat{r}^2} + p \delta[\partial_{\eta}[\phi]_{\hat{r}^2}] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] + \partial_{\eta} [\pi]_{\hat{r}^2} \delta \phi + \phi \delta [\partial_{\eta}[\pi]_{\hat{r}^2} ] \intd{A} \intd{\eta} \\ &= \iint \langle \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi]_{\hat{r}^2} w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]_{\hat{r}^2} \right] + c_p \Pi \delta \Theta_{\hat{r}^2} + p \delta[\partial_{\eta}[\phi]_{\hat{r}^2}] + p_{\textrm{top}} \delta[\phi_{\textrm{top}}] + \partial_{\eta} [\pi]_{\hat{r}^2} \delta \phi \intd{A} \intd{\eta}. \end{align*}. We rewrite pδ[η[ϕ]r^2]+ptopδϕtopdηdA=pδ[η[ϕ]r^2]dη+ptopδϕtopdA=[pδϕ]η=ηtopη=1η[p]δϕdη+ptopδϕtopdηdA=pbotδϕbotptopδϕtop+ptopδϕtopη[p]δϕdηdA, \begin{align*} \int \int p\delta[\partial_{\eta}[\phi]_{\hat{r}^2}] + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{\eta} \intd{A} &= \int \int p\delta[\partial_{\eta}[\phi]_{\hat{r}^2}] \intd{\eta} + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \\ &= \int [p \delta \phi]_{\eta = \eta_{\textrm{top}}}^{\eta = 1} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} + \int p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{\eta} \intd{A} \\ &= \int p_{\textrm{bot}}\delta\phi_{\textrm{bot}} - p_{\textrm{top}}\delta\phi_{\textrm{top}} + p_{\textrm{top}} \delta \phi_{\textrm{top}} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ \end{align*}, which relies on the fact that reconstructing ϕ\phi from ηϕr^2\partial_{\eta} \phi_{\hat{r}^2} is a mass-weighted integral, which consumes the r^2\hat{r}^2 factor. We now note that δϕbot=0\delta \phi_{\textrm{bot}} = 0 due to the stationary topography at the lower boundary condition. Therefore pδ[r^2η[ϕ]]+ptopδϕtopdAdη=pbotδϕbotη[p]δϕdηdA=η[p]δϕdηdA \begin{align*} \int \int p\delta[\hat{r}^2\partial_{\eta}[\phi]] + p_{\textrm{top}} \delta \phi_{\textrm{top}} \intd{A} \intd{\eta} &= \int p_{\textrm{bot}}\delta\phi_{\textrm{bot}} - \int \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ &= \int \int -\partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} \\ \end{align*} where we have relied on the fact that ηδϕ=δηϕ\partial_{\eta} \delta \phi = \delta \partial_{\eta} \phi. We can return to the total functional differential to find δH=η[π]r^2u,δu+η[π]r^2wδw+(u,u+w22+ϕ)δ[η[π]r^2]+cpΠδΘr^2+(η[π]r^2η[p])δϕdAdη. \begin{align*} \delta \mathcal{H} &= \iint \langle \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi]_{\hat{r}^2} w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]_{\hat{r}^2} \right] + c_p \Pi \delta \Theta_{\hat{r}^2} + (\partial_{\eta} [\pi]_{\hat{r}^2} - \partial_{\eta} [p]) \delta \phi \intd{A} \intd{\eta}. \end{align*} The only problem term in this equation is in the differential for δϕ\delta \phi, namely η[p]δϕ \partial_{\eta} [p] \delta \phi . The lack of a r^2\hat{r}^2 correction in this term dictates the modification of μη[p](η[π])1\mu \equiv \partial_{\eta} [p] \left(\partial_{\eta} [\pi] \right)^{-1} so we rewrite δH=η[π]r^2u,δu+η[π]r^2wδw+(u,u+w22+ϕ)δ[η[π]r^2]+cpΠδΘr^2+η[π]r^2(1η[p](η[π]r^2)1)δϕdAdη=η[π]r^2u,δu+η[π]r^2wδw+(u,u+w22+ϕ)δ[η[π]r^2]+cpΠδΘr^2+η[π]r^2(1η[p](η[π]r^2)1)δϕdAdη. \begin{align*} \delta \mathcal{H} &= \iint \langle \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi]_{\hat{r}^2} w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]_{\hat{r}^2} \right] + c_p \Pi \delta \Theta_{\hat{r}^2} + \partial_{\eta} [\pi]_{\hat{r}^2}( 1 - \partial_{\eta} [p] \left( \partial_{\eta} [\pi]_{\hat{r}^2}\right)^{-1}) \delta \phi \intd{A} \intd{\eta} \\ &= \iint \langle \partial_{\eta} [\pi]_{\hat{r}^2} \mathbf{u}, \delta \mathbf{u} \rangle + \partial_{\eta} [\pi]_{\hat{r}^2} w \delta w + \left( \frac{\langle \mathbf{u}, \mathbf{u}\rangle + w^2}{2} + \phi \right) \delta \left[\partial_{\eta} [\pi]_{\hat{r}^2} \right] + c_p \Pi \delta \Theta_{\hat{r}^2} + \partial_{\eta} [\pi]_{\hat{r}^2}( 1 - \partial_{\eta} [p] \left( \partial_{\eta} [\pi]_{\hat{r}^2}\right)^{-1}) \delta \phi \intd{A} \intd{\eta}. \end{align*} which dictates that μr^2=r^2η[p](η[π]r^2)1\mu_{\hat{r}^2} = \hat{r}^2 \partial_{\eta} [p] \left( \partial_{\eta} [\pi]_{\hat{r}^2}\right)^{-1}. δHδu=η[π]uδHδw=η[π]wδHδϕ=η[π]r^2(1μr^2)δHδΘ=cpΠδHδη[π]=u2+w22+ϕ \begin{align*} \fder{\mathcal{H}}{\mathbf{u}} &= \partial_{\eta}[\pi] \mathbf{u}\\ \fder{\mathcal{H}}{w} &= \partial_{\eta} [\pi] w \\ \fder{\mathcal{H}}{\phi} &= \partial_{\eta} [\pi]_{\hat{r}^2}(1 - \mu_{\hat{r}^2})\\ \fder{\mathcal{H}}{\Theta} &= c_p \Pi \\ \fder{\mathcal{H}}{\partial_{\eta} [\pi]} &= \frac{\mathbf{u}^2 + w^2}{2} + \phi \end{align*} which illustrates that the integration by parts trick works Let us check if this is consistent by returning to the implicit hypsometric equation that defines our EOS.

Returning to EOS

ηϕ=Rdη[π]r^2θvΠp    η[ϕ]dη=Rdη[π]r^2θvΠpdη    Δϕ=Rdη[π]r^2θvΠpdη    Δϕ=RdTpη[π]r^2dη    Δϕ=RdTpdπ \begin{align*} &\partial_\eta \phi = -R_d \partial_\eta[\pi]_{\hat{r}^2} \theta_v \frac{\Pi}{p}\\ \implies& \int \partial_\eta [\phi] \, \mathrm{d}\eta = -R_d \int \partial_\eta[\pi]_{\hat{r}^2} \theta_v \frac{\Pi}{p} \, \mathrm{d}\eta\\ \implies& \Delta \phi = -R_d \int \partial_\eta[\pi]_{\hat{r}^2} \theta_v \frac{\Pi}{p} \, \mathrm{d}\eta\\ \implies& \Delta \phi = -R_d \int \frac{T}{p} \partial_\eta [\pi]_{\hat{r}^2} \, \mathrm{d}\eta\\ \implies& \Delta \phi = -R_d \int \frac{T}{p}\, \mathrm{d}\pi\\ \end{align*} and so we see that this holds if []η[π]r^2dη=[]r^2η[π]dη=[]dπ\int [\cdot]\, \partial_\eta [\pi]_{\hat{r}^2} \intd{\eta} = \int [\cdot]\, \hat{r}^2 \partial_\eta [\pi] \intd{\eta} = \int [\cdot] \intd{\pi} which is precisely what we constructed η[π]r^2\partial_{\eta} [\pi]_{\hat{r}^2} to satisfy!

The integration by parts:

pr^2δ[η[ϕ]]+BC+r^2η[p]δϕdηdA=[pr^2ϕ]η=1η=0+BC+η[pr^2δϕ]+r^2η[p]δϕdηdA \begin{align*} &\int \int p\hat{r}^2\delta[\partial_{\eta}[\phi]] + \textrm{BC} +\hat{r}^2 \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A} = \int \left[p\hat{r}^2 \phi\right]_{\eta = 1}^{\eta = 0} + \textrm{BC} + \int -\partial_{\eta} [p\hat{r}^2\delta \phi] + \hat{r}^2 \partial_{\eta} [p] \delta \phi \intd{\eta} \intd{A}\\ \end{align*} and so ^

Parent post: