1 Introduction

The Solar Tachocline is a thin layer situated at the base of the convection zone and is believed to play an important role in the Sun’s magnetic activity, since it is able to store strong magnetic fluxes (Thomas and Weiss 2012). Transitional layers of the same nature are thought of to be present in other stars as well (Guerrero et al. 2016) and are believed to play an important role in their respective magnetic activities. Planetary cores and their resulting magnetic fields might also have their dynamics associated with thin layers of conducting fluids, for instance the recent discovery of a stratified layer at the top of the Earth’s core (Raphaldini and Raupp 2020; Buffett 2014). The feature in common between the dynamics of stellar tachoclines and planetary cores is that their dynamics can be described by thin layers of conducting fluids (plasma or liquid metallic alloys) which are affected by both the magnetic fields and the Coriolis force. Such systems can be modelled by the shallow-water MHD equations (Gilman 2000), which consist of an hybrid between the atmospheric/oceanic shallow-water models (Majda 2003) and the 2-D MHD equations. Similarly to the atmospheric/oceanic case, such systems bear MHD generalisations of inertio-gravity and Rossby waves as linear eigenmodes. As in the purely hydrodynamic case, an approximation has been introduced that filters out the fast propagating gravity waves, giving rise to the so-called quasi-geostrophic MHD equations (Zeitlin 2013). Recent studies (Dikpati et al. 2017, 2018) suggest the shallow-water magnetized waves to be responsible for the spatio-temporal organisation of Solar sunspot activity, opening perspective for its forecasting.

A similar model for MHD flows in thick shells is the Hide’s beta-plane model, which consists of the same aforementioned quasigeostrophic MHD equations, but with a different interpretation. Instead of the usual beta-plane interpretation as an approximation of the spherical geometry to a plane tangent to the globe in which linear variations of the Coriolis parameter with latitude are taken into account, in Hide’s beta-plane model the dynamics takes place in a plane crossing the sphere on the equator, and the “beta term” in the equations represents the latitudinal variation of the thickness of the fluid layer, resembling therefore the effect of topography on the usual beta-plane approximation (Hide 1966; Canet et al. 2014).

Flows at stellar tachoclines are usually dominated by sheared zonal flows associated with the core’s differential rotation; in the case of the Sun, the fluid rotates faster at the equator than at the poles. The dynamics of such equatorial acceleration seems to be crucial for the determination of the strength/configuration of the Solar cycle (Javaraiah et al. 2005) and was recently shown to be an energy source for MHD Rossby waves that drive the solar magnetic activity (Dikpati et al. 2018; Raphaldini et al. 2019), because solar-like differential rotation with equatorial acceleration, coexisting with toroidal magnetic fields, can trigger instability when perturbed by Rossby wave-type patterns. It is important, therefore, to understand the circumstances under which differential rotation and toroidal magnetic field profiles are stable/unstable.

A comprehensive approach to study the nonlinear stability of either magnetohydrodynamic or hydrodynamic systems is the energy-Casimir approach pioneered by the seminal work of Arnold (1966). This approach is appropriately studied using the Hamiltonian description of fluids/plasmas, whose the formulation in Eulerian coordinates was introduced by Morrison and Greene (1980) and has several advantages associated with the fact that symmetries become more evident in this setting. Unlike the usual finite dimensional systems, the Hamiltonian formulation of fluid systems in Eulerian coordinates is non-canonical in the sense that the corresponding Poisson bracket is degenerate, giving rise to the so-called Casimir invariants. The Hamiltonian formulation has found numerous applications in geophysical flows (Shepherd 1990; Salmon 1988; Flierl et al. 2019) and in plasma physics (Morrison and Hazeltine 1984; Tassi et al. 2009); in particular the Hamiltonian structure of the shallow-water MHD equations was established in Dellar (2003). Among the main applications of the Hamiltonian formulation of fluids and plasmas are the nonlinear (Lyapunov) stability, given that the corresponding system have enough Casimir invariants (Holm et al. 1985; Majda 2003; Flierl et al. 2019).

In this article, we introduce the Hamiltonian formulation of the quasi-geostrophic MHD equations. In this formulation, it becomes clear how to determine the conserved quantities of the governing equations, which are related to the symmetries of the system via the Noether’s Theorem. Conserved quantities are of two kinds; the first one refers to the so-called Casimir invariants. These quantities have their conservation related to the particle relabelling symmetry of the full Lagrangian system. The other conservation laws refer to the momenta and are related to the translational symmetries of the system. In this context, due to the aforementioned zonal shear flows associated with the differential rotation of stars, the zonal momentum associated with the translational symmetry in the zonal direction is the most relevant for astrophysical applications. After introducing the conserved quantities of the system, we have proved the nonlinear (Lyapunov) stability of some steady-state solutions mimicking the aforementioned zonal flows by using the energy-Casimir method (Holm et al. 1985).

2 Basic theory

2.1 Non-canonical Hamiltonian formulation

Most conservative models in nature can be cast into a Hamiltonian formulation. For a finite-dimensional system described by its positions \({{\textbf {q}}}=(q_1,\ldots ,q_n)\) and momenta \({{\textbf {p}}}=(p_1,\ldots ,p_n)\), where \(q_i,p_i\in \mathbb {R}^m\), for \(i=1,\ldots ,n\), and Hamiltonian function \({\mathscr {H}}({{\textbf {p}}},{{\textbf {q}}})\), the Hamilton’s equations are:

$$\begin{aligned} \frac{\textrm{d} p_i}{\textrm{d}t}&=-\frac{\partial {\mathscr {H}}}{\partial q_i} \end{aligned}$$
(1)
$$\begin{aligned} \frac{\textrm{d} q_i}{\textrm{d}t}&= \frac{\partial {\mathscr {H}}}{\partial p_i} \end{aligned}$$
(2)

One may still define \({{\textbf {u}}}=({{\textbf {q,p}}})^T\) and write Eqs. (1)–(2) as:

$$\begin{aligned} \frac{\textrm{d}{{\textbf {u}}}}{\textrm{d}t}={\mathscr {J}}\nabla {\mathscr {H}}({{\textbf {u}}}) \end{aligned}$$
(3)

where \({\mathscr {J}}\) is the cosymplectic operator, given by

$$\begin{aligned} {{\mathscr {J}}}= \begin{bmatrix} 0 &{}&{}\quad -I\\ I &{}&{} \quad 0 \end{bmatrix} \end{aligned}$$
(4)

For computing the evolution of a functional of the canonical variables in phase space, it is convenient to introduce the Poisson bracket. For any differentiable function \(F:\mathbb {R}^{2\times m\times n}\rightarrow \mathbb {R}\), we have:

$$\begin{aligned} \frac{\textrm{d}F}{\textrm{d}t}=\{{\mathscr {H}},F\} \end{aligned}$$
(5)

where \(\{.,.\}\) is the Poisson bracket acting on smooth functions of the canonical variables; for any FG smooth, we have:

$$\begin{aligned} \{G,F\}=\sum _{i=1}^n\Bigg [\frac{\partial G}{\partial q_i}\frac{\partial F}{\partial p_i}-\frac{\partial G}{\partial p_i}\frac{\partial F}{\partial q_i}\Bigg ]=\nabla G {\mathscr {J}} \nabla F \end{aligned}$$
(6)

For any smooth functions FG of the canonical variables, the Poisson bracket \(\{.,.\}\) satisfies:

  1. 1.

    \(\{F,G\}=-\{G,F\}\). (anti-symmetry)

  2. 2.

    \(\{F,\{G,{\mathscr {H}}\}\}+\{{\mathscr {H}},\{F,G\}\}+\{G,\{{\mathscr {H}},F\}\}=0\) (Jacobi-identity)

  3. 3.

    \(\{F,G\}\ne 0\) for any F,G functionally independent (non-degeneracy).

Fluid systems are often described in Eulerian coordinates, which means that one does not care about the positions of each of the system’s particles, but only on their velocities. This gives rise to a symmetry in the system: the equations of motion are invariant under changes in the positions of the particles, yielding the so-called particle-relabelling symmetry. Rigorous description of how to reduce the dimensionality of a Hamiltonian system by making use of its symmetries is given by the Lie–Poisson reduction (Marsden and Ratiu 2013). In practice, reducing the dimensionality of the system will imply the degeneracy of the cosymplectic operator \({\mathscr {J}}\), which in turn will result in a degeneracy of the associated Poisson bracket. The Hamiltonian description of fluid dynamics equations in Eulerian coordinates is, therefore, called non-canonical and was first introduced by Morrison and Greene (1980). Again, for the state vector \({{\textbf {u}}}\), which lives in an infinite dimensional space (a Banach or Frechet space), its evolution will be described by:

$$\begin{aligned} \frac{\textrm{d} {{\textbf {u}}}}{\textrm{d}t}={\mathscr {J}}\frac{\delta {\mathscr {H}}}{\delta {{\textbf {u}}}} \end{aligned}$$
(7)

where \(\frac{\delta .}{\delta {{\textbf {u}}}}\) is to be interpreted as the Gateaux derivative in the functional space and the cosymplectic operator \({\mathscr {J}}\) will take different forms depending on the context. Associated with \({\mathscr {J}}\), one may define the Poisson bracket:

$$\begin{aligned} \{{\mathscr {F}},{\mathscr {G}}\}=\frac{\delta {\mathscr {F}}}{\delta {{\textbf {u}}}}{\mathscr {J}}\frac{\delta {\mathscr {G}}}{\delta {{\textbf {u}}}} \end{aligned}$$
(8)

The Poisson bracket above still satisfies the anti-symmetry and the Jacobi-identity properties. However, it fails to satisfy the non-degeneracy property, meaning that there are functions \({\mathscr {C}}\) whose gradient lies in the kernel of \({\mathscr {J}}\). Therefore, \(\{{\mathscr {F}},{\mathscr {C}}\}=0\) for any smooth functional \({\mathscr {F}}\). This automatically implies that \({\mathscr {C}}\) is an invariant of the system:

$$\begin{aligned} \frac{\textrm{d}{\mathscr {C}}({{\textbf {u}}})}{\textrm{d}t}=\{{\mathscr {H}},{\mathscr {C}}\}=0 \end{aligned}$$
(9)

Extensive reviews of the non-canonical formulation of fluid dynamics and plasmas are given by Salmon (1988), Shepherd (1990) and Morrison (1998).

2.2 Lagrangian background: the Euler–Poincare equations

Hamilton’s critical action principle states that the equations of motion can be obtained by finding the critical point of a Lagrangian functional defined on the phase space TM, \(L: TM \times \mathbb {R}\rightarrow \mathbb {R}\). In local coordinates \((q_1, \ldots , q_n, \dot{q}_1, \ldots , \dot{q}_n)\), the Euler–Lagrange equations are obtained as:

$$\begin{aligned} \delta L =\delta \int _{t_1}^{t_2}l(q,\dot{q},t)\textrm{d}t=0 \end{aligned}$$
(10)

The leading equations of motion are the Euler–Lagrange equations

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}t}\Bigg ( \frac{\partial L}{\partial \dot{q}} \Bigg ) =\frac{\partial L}{\partial q} \end{aligned}$$
(11)

The Lagrangian formulation can be shown to be equivalent to the Hamiltonian formulation given some regularity assumptions on the Lagrangian functional, which define the so-called hyper-regular Lagrangians (Holm et al. 2009).

Similar to the Hamiltonian formulation of fluid dynamics in Eulerian coordinates resulting from the Lie–Poisson reduction, in the LagrangianFootnote 1 description it is also possible to make use of the system’s symmetries to reduce its dimensionality; this is the Euler–Poincare reduction. In the general setting, the Euler–Poincare equation can be seen as the equation governing the geodesic in a Lie group \({\mathscr {G}}\). The Euler–Poincare equations can therefore be seen as generalisations of the Euler–Lagrange equations. For the Euler equations of fluid mechanics, \({\mathscr {G}}=Diff_{vol}(\Omega )\), the group of volume preserving diffeomorphisms on \(\Omega \subset {\mathbb {R}}^{2}\) or \(\Omega \subset {\mathbb {R}}^{3}\). In the magnetohydrodynamic context in which the magnetic field is not only advected by the velocity field but also feeds it back through the Lorentz force, the appropriate group-theoretic setting is described on semi-direct products , where \(Svect(\Omega )\) is the Lie algebra of divergence-free vector fields on \(\Omega \).

For a Lagrangian function l(ua) depending on the velocity variables u and the advected quantities a (such as the magnetic field), the Euler–Poincare equations are written as:

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}t}\left( \frac{\delta l}{\delta u} \right) =-ad^*_u\left( \frac{\delta l}{\delta u} \right) +\frac{\delta l}{\delta a} \diamond a \end{aligned}$$
(12)

together with the evolution equation for a which consists of the Lie transport of a by the velocity field u:

$$\begin{aligned} \frac{\partial a}{\partial t}+ {\mathscr {L}}_u a=0 \end{aligned}$$
(13)

In (12), the operator \(ad^*_u:\mathfrak {g}^*\rightarrow \mathfrak {g}^* \) is the dual of:

$$\begin{aligned} ad_u \eta =[u,\eta ] \end{aligned}$$
(14)

where \([.,.]:\mathfrak {g}\times \mathfrak {g}\rightarrow \mathfrak {g}\) is the Lie bracket defined on the Lie group \(\mathfrak {g}\). The Diamond operator \(\diamond \) in (12) is defined via:

$$\begin{aligned} \left\langle \frac{\delta l}{\delta a} \diamond a,\eta \right\rangle =-\left\langle \frac{\delta l}{\delta a} ,{\mathscr {L}}_{\eta }a\right\rangle , \end{aligned}$$
(15)

for any \(\eta \in \mathfrak {g}\).

3 The quasi-geostrophic MHD equations

The Quasi-geostrophic MHD equations were introduced as an approximation to the shallow-water MHD equations in the strong rotation limit (Zeitlin 2013), in a similar fashion to the usual derivation of the hydrodynamic quasi-geostrophic equations as a distinguished limit of the hydrodynamic shallow-water equations when the Rossby number goes to zero (Majda 2003). The quasi-geostrophic MHD equations can be written as:

$$\begin{aligned}{} & {} \frac{\partial q}{\partial t} + J(\psi , q)= J(A, j) \end{aligned}$$
(16)
$$\begin{aligned}{} & {} \frac{\partial A}{\partial t} + J(\psi , A)=0 \end{aligned}$$
(17)

where A is the magnetic field potential, \(j=\Delta A\) the magnetic current and \(\psi \) the streamfunction; q is the potential vorticity, given by

$$\begin{aligned} q=(\Delta -F)\psi +\beta y \end{aligned}$$
(18)

where \(\Delta \) is the Laplacian operator, F is the Rossby deformation radius squared, and the parameter \(\beta \) refers to the derivative of the planetary vorticity with latitude in the usual \(\beta \)-plane approximation. In (16)–(17), J is the usual Jacobian operator for any two differentiable functions \(f,g:\mathbb {R}^2 \rightarrow \mathbb {R}\):

$$\begin{aligned} J(f,g)=\frac{\partial f}{\partial x}\frac{\partial g}{\partial y}-\frac{\partial f}{\partial y}\frac{\partial g}{\partial x} \end{aligned}$$
(19)

Obviously, when A and j are identically zero, the system reduces to the usual quasi-geostrophic equations.

3.1 Lagrangian formulation: Euler–Poincaré equations

The quasi-geostrophic MHD equations presented above admit a Lagrangian formulation in terms of reduced variables due to the existence of particle relabelling symmetries. Thus, we write the reduced Lagrangian in terms of the velocity and magnetic fields, with the latter appearing in the equation as an advected quantity:

$$\begin{aligned} {\mathscr {L}}=\int {l}({{\textbf {u}}}, a)\textrm{d}x^{2} \end{aligned}$$
(20)

For the advected quantity a corresponding to the magnetic field \({{\textbf {b}}}\), the Lagrangian density l is given by:

$$\begin{aligned} l({{\textbf {u}}},{{\textbf {b}}})=\int \left\{ \frac{1}{2}D{{\textbf {u}}}(1-F \Delta ^{-1}){{\textbf {u}}}+ D{{\textbf { u}}}\cdot {{\textbf {R}}}-\psi (D-1)+\frac{1}{2}|{{\textbf {b}}}|^2 \right\} \textrm{d}t \end{aligned}$$
(21)

where the planetary vorticity is written as \(f=e_3 \cdot \nabla \times {{\textbf {R}}}\), where \({{\textbf {R}}}\) represents the linear velocity associated with the frame’s rotation, and D is the thickness of the fluid layer. In the shallow water model, D varies in space and time, while in the quasi-geostrophic model the height D is constant and can be used as a constraint (Holm and Zeitlin 1998).

Taking the variation in \({{{\textbf {u}}}}\), we obtain:

$$\begin{aligned} \frac{\delta l}{ \delta u}=D\left\{ {\textbf {u}}-\frac{F}{2}\Delta ^{-1}{} {\textbf {u}}+ {\textbf {R}}\right\} \end{aligned}$$
(22)

On the other hand, the variation in D yields

$$\begin{aligned} \frac{\delta l}{ \delta D}=\frac{1}{2}{{{\textbf { u}}}}(1-F \Delta ^{-1}){{{\textbf {u}}}}+ {{{\textbf {u}}}}\cdot {{{\textbf {R}}}}-\psi , \end{aligned}$$
(23)

while the variation in \(\psi \) results in

$$\begin{aligned} \frac{\delta l}{ \delta \psi }=(D-1) \end{aligned}$$
(24)

To form the dynamical equations, first we have to note that the variations in \({\textbf {b}}\) can be written as:

$$\begin{aligned} \delta {\textbf {b}}=-{{\mathscr {L}}}_{\eta }{} {\textbf {b}}=-\nabla \times (\eta \times {\textbf {b)}} \end{aligned}$$
(25)

where \(\eta =\delta {\textbf {u}}\) (see Appendix and the reference Holm et al. 1998). Therefore:

$$\begin{aligned} \begin{aligned} \delta \int \frac{1}{2}|{\textbf {b}} |^2 dx^2&=\int \frac{\delta l}{\delta {\textbf {b}}}\cdot \delta {\textbf {b}} dx^2=-\int \frac{\delta l}{\delta {\textbf {b}}}\cdot \nabla \times (\delta {\textbf {u}}\times {\textbf {b}}) dx^2\\&=\int \left[ \nabla \times \left( \frac{\delta l}{\delta {\textbf {b}}}\right) \times {\textbf {b}}\right] \cdot \delta {\textbf {u}} dx^2= \int ( {\textbf {j}}\times {\textbf {b}})\delta {\textbf {u}} dx^3 \end{aligned} \end{aligned}$$
(26)

We then impose the constraint \(D=1\) on (22) and (24) and, taking the curl of (22) gives the definition of the potential vorticity:

$$\begin{aligned} q=\nabla \times {\textbf {u}}\cdot \mathbf {e_3} - F\psi + f =\Delta \psi - F\psi + f \end{aligned}$$
(27)

Therefore, the Euler–Poincaré equation reads:

$$\begin{aligned} \frac{\partial q}{\partial t}+{\mathscr {L}}_{{\textbf {u}}}q= \frac{\partial q}{\partial t}+{\textbf {u}} \cdot \nabla q=A\Delta A \end{aligned}$$
(28)

together with the equation for the magnetic field potential transport:

$$\begin{aligned} \frac{\partial A}{\partial t}+{\mathscr {L}}_{{\textbf {u}}}A=\frac{\partial A}{\partial t}+{\textbf {u}} \cdot \nabla A=0 \end{aligned}$$
(29)

3.2 Hamiltonian formulation of the MHD-QG equations

The quasi-geostrophic MHD equations also admit a noncanonical hamiltonian formulation in Eulerian coordinates similar to the hamiltonian formulation of reduced MHD equations (Morrison and Hazeltine 1984). Consider the Hamiltonian

$$\begin{aligned} {{\mathscr {H}}}&=\frac{1}{2}\int \{|\nabla \psi |^2+F|\psi |^2+|\nabla A|^2\}\textrm{d}^2x\nonumber \\&=\frac{1}{2}\int \{ \omega (-\Delta ^{-1})\omega -F\psi |\Delta ^{-1}\omega |+ A \Delta A\}\textrm{d}^2x \end{aligned}$$
(30)

where \(\Delta ^{-1}\) is the right inverse of the Laplacian operator (i.e. its Green function). To write the equations of motion in Hamiltonian form, it is convenient to define \(\omega =q-F\psi -\beta y\). In this way, the evolution equations in the Hamiltonian form are written as:

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}t} \begin{bmatrix} q\\ A \end{bmatrix} ={\mathscr {J}} \begin{bmatrix} \frac{\delta {\mathscr {H}}}{\delta q}\\ \frac{\delta {\mathscr {H}}}{\delta A} \end{bmatrix} \end{aligned}$$
(31)

with the cosympletic operator \({\mathscr {J}}\) being given by

$$\begin{aligned} {{\mathscr {J}}}=- \begin{bmatrix} J(q,.)&{}&{}\quad J(A,.)\\ J(A,.)&{}&{}\quad 0 \end{bmatrix} \end{aligned}$$
(32)

Likewise, the expressions for the variational derivatives of the Hamiltonian are:

$$\begin{aligned} \frac{\delta {\mathscr {H}}}{\delta \psi }= & {} -\Delta \psi +F\psi \end{aligned}$$
(33)
$$\begin{aligned} \frac{\delta {\mathscr {H}}}{\delta q}= & {} \psi \end{aligned}$$
(34)
$$\begin{aligned} \frac{\delta {\mathscr {H}}}{\delta A}= & {} -j \end{aligned}$$
(35)

where the magnetic current is defined as \(j=\Delta A\) as previously mentioned. One can readily verify the equivalence between equations (1)–(2) and Eq. (5) upon inserting the expressions of the variational derivatives in (6). For any differentiable functional \({\mathscr {F}}\) of the state variables, its derivative can be written in terms of the corresponding Lie–Poisson bracket:

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}t} {\mathscr {F}}=\{{\mathscr {F}}, {\mathscr {H}}\} \end{aligned}$$
(36)

where the Lie–Poisson bracket is defined by:

$$\begin{aligned} \{{\mathscr {F}}, {\mathscr {G}}\}= \begin{bmatrix} \frac{\delta {\mathscr {F}}}{\delta q}&\,&\quad \frac{\delta {\mathscr {F}}}{\delta A} \end{bmatrix} {\mathscr {J}} \begin{bmatrix} \frac{\delta {\mathscr {G}}}{\delta q}\\ \frac{\delta {\mathscr {G}}}{\delta A} \end{bmatrix} \end{aligned}$$
(37)

By making use of Eqs. (32) and (33)–(35), the Lie–Poisson bracket may be explicitly written as:

$$\begin{aligned} \{{\mathscr {F}}, {\mathscr {G}}\}= & {} \frac{\delta {\mathscr {F}}}{\delta q}\left[ \nabla q \cdot \nabla ^{\perp }\left( \frac{\delta {\mathscr {G}}}{\delta q}\right) +\nabla A\cdot \nabla ^{\perp }\left( \frac{\delta {\mathscr {G}}}{\delta A}\right) \right] \nonumber \\{} & {} +\frac{\delta {\mathscr {F}}}{\delta A}\left[ \nabla A \cdot \nabla ^{\perp } \left( \frac{\delta {\mathscr {G}}}{\delta q}\right) \right] \end{aligned}$$
(38)

where the gradient is taken in the plane \(\mathbb {R}^2\), \(\nabla =(\partial _x,\partial _y)\), and we define the perpendicular gradient as \(\nabla ^\perp =(-\partial _y,\partial _x)\).

4 Invariants of the system

As discussed in Sect. 1, the conserved quantities of a non-canonical Hamiltonian system are of two kinds. The first one refers to the so-called Casimir invariants, whose dynamics are tied to Lagrangian particles and arise from Kelvin–Noether theorem (Holm et al. 2009; Cendra et al. 1998) as a result of particle relabelling symmetries. In other words, these quantities are due to the fact that the dynamics are unchanged by applying diffeomorphisms to the fluid domain that changes the particles’ initial position. Consequently, a Casimir function \({\mathscr {C}}\) of a non-canonical Hamiltonian system is associated with the degeneracy of the Poisson bracket, so that, for any differentiable functional \({\mathscr {F}}\), it satisfies \(\{{\mathscr {F}}, {\mathscr {C}} \}=0\). Hence, from Eq. (36), the quantity \({\mathscr {C}}\) is trivially conserved:

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}t} {\mathscr {C}}=\{{\mathscr {C}}, {\mathscr {H}}\}=0 \end{aligned}$$
(39)

For the quasi-geostrophic MHD system studied here, there are two classes of Casimir invariants. The first class is associated with the fact that magnetic field lines are dragged by the fluid motion (frozen flux property); this class is sometimes referred to as magnetic helicity. The second class is an appropriate combination of the potential vorticity and the potential magnetic field. In some texts, this Casimir functional is referred to as cross-helicity. The magnetic helicity associated with Eqs. (16)–(17) is given by

$$\begin{aligned} {\mathscr {C}}_M=\int L(A)\textrm{d}^2x \end{aligned}$$
(40)

where L is an arbitrary differentiable function. From Eq. (38), it is easy to see that \({\mathscr {C}}_M\) is conserved. In fact, considering \({\mathscr {G}}={\mathscr {C}}_M\) in (38), it follows that

$$\begin{aligned} \frac{\delta {\mathscr {G}}}{\delta q}=0; \quad \frac{\delta {\mathscr {G}}}{\delta A}=L'(A), \end{aligned}$$
(41)

and consequently all terms of the form

$$\begin{aligned} \nabla A \cdot \nabla ^{\perp } \Bigg (\frac{\delta {\mathscr {G}}}{\delta A}\Bigg ) \end{aligned}$$
(42)

will vanish.

On the other hand, the cross-helicity associated with system (16)–(17) is given by

$$\begin{aligned} {{\mathscr {C}}}_{c}=\int qG(A)\textrm{d}^{2}x \end{aligned}$$
(43)

Upon substitution of the variational derivatives

$$\begin{aligned} \frac{\delta {\mathscr {C}}_c}{\delta q}=G(A); \quad \frac{{\mathscr {C}}_c}{\delta A}=qG'(A) \end{aligned}$$
(44)

into the expression of the Poisson bracket (38), it is possible to verify that \(\frac{\textrm{d}{\mathscr {C}}_c}{\textrm{d}t} = 0\), with G indicating again an arbitrary differentiable function. Therefore, different choices of F and G provide an infinite number of invariants, which however will not imply, in general, the integrability of the Eq. (Shepherd 1990).

Apart from the Casimir invariants, the other class of conserved quantities of a hamiltonian system refers to the momentum invariants, which can be found by taking variations of the Hamiltonian, with infinitesimal variations restricted to the symmetry direction of the Hamiltonian. More precisely, if \({\mathscr {G}}\) is a Lie group under which the system is invariant, variations should be taken with respect to the associated Lie algebra. In our case, we are primarily interested in the invariance of the system with respect to translations in the zonal direction, since most basic states of interest are zonally symmetric. Suppose that for all \(x, x',y, t \in {\mathbb {R}}\) we have:

$$\begin{aligned} {\mathscr {H}}(u(x,y,t),t)={\mathscr {H}}(u(x',y,t),t), \end{aligned}$$
(45)

for \(u=(q,A)\). Then, if we define

$$\begin{aligned} \begin{aligned} \delta _x {\mathscr {H}}= {\mathscr {H}}(u(x+\epsilon ,y,t),t)-{\mathscr {H}}(u(x,y,t),t), \end{aligned} \end{aligned}$$
(46)

we have

$$\begin{aligned} \begin{aligned} \delta _x {\mathscr {H}}= \Bigg \langle \frac{\delta {\mathscr {H}}}{\delta u}, \frac{\partial u}{\partial x} \Bigg \rangle +{\mathscr {O}}(\epsilon ^2)=0 \end{aligned} \end{aligned}$$
(47)

Now, the following theorem taken from Shepherd (1990) provides a way to find the conserved quantities associated with zonal symmetries of the Hamiltonian (other types of symmetries such as translations in the y direction or rotations are completely analogous).

Theorem 1

(Shepherd 1990) Suppose that the Hamiltonian \({\mathscr {H}}\) is symmetric under translations in the x direction and that there exists a functional \(\mathscr {M}\) that solves the equation

$$\begin{aligned} {{\mathscr {J}}}\left( \frac{\delta M}{\delta u} \right) =-\frac{\partial u}{\partial x}. \end{aligned}$$
(48)

Then, M is conserved by the dynamics:

$$\begin{aligned} \frac{\textrm{d} \mathscr {M}}{\textrm{d}t}=0. \end{aligned}$$
(49)

The proof of this theorem results from the straightforward calculation:

$$\begin{aligned} \frac{\textrm{d} {\mathscr {M}}}{\textrm{d}t}=[{\mathscr {M}},{\mathscr {H}}]=\left\langle J\left( \frac{\delta {\mathscr {M}}}{\delta u} \right) ,\frac{\delta {\mathscr {H}}}{\delta u} \right\rangle =-\left\langle \frac{\delta {\mathscr {H}}}{\delta u}, \frac{\partial u}{\partial x} \right\rangle =0 \end{aligned}$$
(50)

At this point, we can derive the expression of the conserved quantity of the quasi-geostrophic MHD dynamics for a zonally symmetric Hamiltonian. The expression for the zonal momentum \(\mathscr {M}\) is such that, by Noether’s theorem, it solves:

$$\begin{aligned} {\mathscr {J}} \begin{bmatrix} \frac{\delta {\mathscr {M}}}{\delta q}\\ \frac{\delta {\mathscr {M}}}{\delta A} \end{bmatrix} = \begin{bmatrix} \frac{\partial q}{\partial x}\\ \frac{\partial A}{\partial x} \end{bmatrix}, \end{aligned}$$
(51)

which results in the system:

$$\begin{aligned} J \left( A,\frac{\delta {\mathscr {M}}}{\delta q}\right) =-\frac{\partial A}{\partial x}, \end{aligned}$$
(52)

or, equivalently,

$$\begin{aligned} \frac{\partial A}{\partial x}\frac{\partial }{\partial y}\left( \frac{\delta {\mathscr {M}}}{\delta q}\right) -\frac{\partial A}{\partial y}\frac{\partial }{\partial x}\left( \frac{\delta {\mathscr {M}}}{\delta q}\right) =-\frac{\partial A}{\partial x}, \end{aligned}$$
(53)

From the equation above, we get

$$\begin{aligned} \frac{\delta {\mathscr {M}}}{\delta q}=-y \end{aligned}$$
(54)

Inserting (54) into the first line of system (51), we obtain:

$$\begin{aligned} J(q,-y)+J \left( A,\frac{\delta {\mathscr {M}}}{\delta A}\right) =-\frac{\partial q}{\partial x}\implies J \left( A,\frac{\delta {\mathscr {M}}}{\delta A}\right) =0, \end{aligned}$$
(55)

which means that the gradients of \(\frac{\delta {\mathscr {M}}}{\delta A}\) and A are collinear; this condition is satisfied provided

$$\begin{aligned} \frac{\delta {\mathscr {M}}}{\delta A}=f(A), \end{aligned}$$
(56)

for an arbitrary differentiable function f. Since the general expression of the variation of \({\mathscr {M}}\) with respect to the variables q and A is given by

$$\begin{aligned} \delta {\mathscr {M}}=\int \left\{ \frac{\delta {\mathscr {M}}}{\delta q}\delta q + \frac{\delta {\mathscr {M}}}{\delta A}\delta A \right\} \textrm{d}x\textrm{d}y, \end{aligned}$$
(57)

we conclude that the expression for the zonal momentum associated with the QG-MHD dynamics is given by

$$\begin{aligned} {\mathscr {M}}=\int -yq +H(A) \textrm{d}x\textrm{d}y, \end{aligned}$$
(58)

for H such that \(H'=f\).

5 Stability analysis of stationary flows

As discussed in Sect. 1, it is important in the stellar and planetary MHD flows to establish the stability conditions associated with background states characterised by zonal flows and toroidal magnetic fields.

5.1 Equilibria

Here we wish to establish the stability of a class of equilibria that may be of relevance to astrophysical and geophysical applications, in particular equilibria in the form of zonal flows that arise in this context.

First note that a particular \((\psi _e,\,A_e)\) state constitutes an equilibrium of the Quasi-geostrophic MHD equations if

$$\begin{aligned} J(\psi _e, q_e)+ J(A_e, j_e)= & {} 0 \end{aligned}$$
(59)
$$\begin{aligned} J(\psi _e, A_e)= & {} 0 \end{aligned}$$
(60)

The equations above imply that, at an equilibrium state, \(\nabla \psi _e\) is parallel to \(\nabla A_e\). In order for this condition to be satisfied, it suffices that \(\psi _e=\Psi (A)\) for some differentiable function \(\Psi \). From the general expression of a Casimir invariant,

$$\begin{aligned} {{\mathscr {E}}}={{\mathscr {H}}}+{{\mathscr {C}}}, \end{aligned}$$
(61)

if we denote our variables in vector notation by \({{\textbf {u}}}=(q,A)\), in an equilibrium configuration the variational derivative of the pseudo-energy-momentum must be zero:

$$\begin{aligned} \frac{\delta {\mathscr {E}}}{\delta {{\textbf {u}}}}\bigg |_{\overline{{\textbf {u}}}}=\bigg (\frac{\delta {\mathscr {E}}}{\delta q},\frac{\delta {\mathscr {E}}}{\delta A}\bigg )\bigg |_{(\overline{q},\overline{A})} =0 \end{aligned}$$
(62)

Calculating the first component of the variational derivative, we obtain:

$$\begin{aligned} \frac{\delta {{\mathscr {E}}}}{\delta q}\bigg |_{\overline{q}}=\bigg (\frac{\delta {{\mathscr {H}}}}{\delta q}+\frac{\delta {{\mathscr {C}}}}{\delta q}{\delta q}\bigg )\bigg |_{\overline{q}}=\overline{\psi }+G(\overline{A})=0; \end{aligned}$$
(63)

while the variational derivative with respect to the magnetic potential gives:

$$\begin{aligned} \frac{\delta {\mathscr {E}}}{\delta A}\bigg |_{\overline{A}}=\bigg (\frac{\delta {\mathscr {H}}}{\delta A}+\frac{\delta {\mathscr {C}}}{\delta A}\bigg )\bigg |_{\overline{A}}=\overline{j}+\overline{q}G'(\overline{A})+ L'(\overline{A})=0 \end{aligned}$$
(64)

By applying the operator \(J(\overline{A},.)\) in both equations we obtain some constraints for the equilibrium states. From the first equation,

$$\begin{aligned} J(\overline{A},\overline{\psi }-G(\overline{A}))=0 \end{aligned}$$
(65)

This condition is satisfied if \(\nabla \overline{A}\) is colinear with \(\nabla \overline{\psi }\), for which a sufficient condition is \(\overline{\psi }=\Psi (\overline{A})\).

From the second component, we get:

$$\begin{aligned} J(\overline{A},\overline{j}+\overline{q}G'(\overline{A}))=0, \end{aligned}$$
(66)

so that \(\nabla \overline{A}\) and \(\nabla (\overline{j}+\overline{q}G'(\overline{A}))\) are collinear. Such condition is satisfied if \(\overline{j}+\overline{q}G'(\overline{A})\) is a function of \(\overline{A}\), that is, \(\overline{j}+\overline{q}G'(\overline{A})=\Phi (\overline{A})\), which is verified by Eq. (64). We find from (64) that \(\Phi (\overline{A})= L'(\overline{A})\).

5.2 Formal stability

We say that an equilibrium \(\overline{\textbf{u}}\) of the equations of motion is formally stable when the second variation of the pseudo energy/momentum associated with the disturbance around this equilibrium state is positive definite, viz. \(v^TD^2 {\mathscr {E}}v>0, \forall v \ne 0\). The formal stability does not imply a nonlinear stability, but it means that the dynamics linearized around the equilibrium is stable under infinitesimal perturbations. Therefore, for a formally stable equilibrium, if there is an instability, this cannot be a normal mode instability. See Marsden and Hughes (1994) for an example of a formally stable system that is non-linearly unstable. Therefore, to establish the formal stability it suffices to calculate the second variation of the pseudo energy/momentum around the equilibrium solution,

$$\begin{aligned} \delta ^2{\mathscr {E}}(\overline{\omega }, \overline{A})(\delta \omega , \delta A)(\overline{\omega }, \overline{A})(\delta \omega , \delta A) =\delta ^2{\mathscr {H}}+\delta ^2{\mathscr {C}}, \end{aligned}$$
(67)

and require it to be positive definite,

$$\begin{aligned} \delta ^2{\mathscr {E}}(\overline{\omega }, \overline{A}) \ge 0; \forall \delta A, \delta \omega \end{aligned}$$
(68)

The second variation of the Hamiltonian of the quasi-geostrophic MHD equations is:

$$\begin{aligned} \delta ^{2}{{\mathscr {H}}}=\int |\nabla \delta \psi |^2+D|\delta \psi |^2 + |\nabla \delta A|^{2} \textrm{d}x^{2}, \end{aligned}$$
(69)

while the second variation of the Casimir functional, \(\delta ^{2}{\mathscr {C}}\), is given by:

$$\begin{aligned} \delta ^{2}{{\mathscr {C}}}=\int \big (L``(A) +\overline{q}G''(A)\big ) (\delta A)^2+G'(A)\delta q \delta A \textrm{d}x^2 \end{aligned}$$
(70)

Thus, combining (69) and (70) and completing squares, we obtain:

$$\begin{aligned} \begin{aligned} \delta ^2{{\mathscr {E}}}(\overline{\omega }, \overline{A})&=\int |\nabla \delta \psi -\nabla (L'(A)\delta A)|^2 +(1-L'( \overline{A} )^2)|\delta b|^2\\&\quad +(\overline{q}L''( \overline{A} ) +G''( \overline{A} )+L'( \overline{A} )\Delta L'( \overline{A} ))(\delta A)^2 \end{aligned} \end{aligned}$$
(71)

To guarantee that \(\delta ^2{\mathscr {E}}(\overline{\omega }, \overline{A})\) is positive for all perturbations \(\delta \psi \) and \(\delta A\), it suffices to impose that \(L'( \overline{A} )^2\le 1 \) and \(G''( \overline{A} )+L'( \overline{A} )\Delta L'( \overline{A} )>0\).

Note that formal stability refers to the stability of the dynamics under the quadratic part of the Hamiltonian, which corresponds to the linearized dynamics around the equilibrium state.

5.3 Nonlinear stability

Recall that an equilibrium \(\overline{\textbf{u}}\) of a Hamiltonian system is stable in the Lyapunov sense if, for any \(\epsilon >0\), one can find a \(\delta >0\) such that, if one starts the system’s dynamics in a ball of radius \(\delta \) around the equilibrium, \(u_0 \in B_{\delta }(\overline{u})\), the system will never leave the ball of radius \(\epsilon \) around the equilibrium, \(u(t) \in B_{\epsilon }(\overline{u})\), \(\forall t>0\). The energy-Casimir method was proposed by Arnold (1966) as a method for proving the Lyapunov stability of fluid systems admitting extra conservation laws other than the Hamiltonian, such as the Casimir functionals. The process consists of combining the conserved quantities of the system to find a bounded norm having a positive definite quadratic form. If such a quadratic form is found, one can show that the equilibrium is stable for sufficiently small (but not infinitesimal) perturbations.

To prove the nonlinear stability of certain steady state solutions of the quasi-geostrophic MHD equations, we make use of the following theorem:

Theorem 2

(Holm et al. 1985; Majda and Wang 2006) Let \(u(t)=\overline{u}+\delta u(t)\) be a solution of the Hamiltonian equations of motion (7) with Hamiltonian \({\mathscr {H}}:B\rightarrow \mathbb {R}\), Casimir function \({\mathscr {C}}:B\rightarrow \mathbb {R}\) and \({\mathscr {E}}={\mathscr {H}}+{\mathscr {C}}\) satisfying \(D {\mathscr {E}} (\overline{u})=0\), where B is a Banach space with norm defined by a positive definite bilinear form , . Additionally, suppose that \(||u(t) ||=||u(0) ||, \forall t\). Then, u is nonlinearly stable if \(\exists K>0\), such that

$$\begin{aligned} ||\delta u ||^2 \le {\mathscr {E}} ( u (0) )- {\mathscr {E}} (\overline{u} ) \le K ||\delta u ||^2 \end{aligned}$$
(72)

Proof

First, note that \({\mathscr {E}}\) is continuous in the norm \(||\cdot ||\), since it is Holder continuous by the second inequality in (72).

Given an equilibrium \(\overline{u}\) and \(\epsilon >0\), by the continuity of \({\mathscr {H}}_C\) we can choose \(\delta >0\) and u(0) close enough to \(\overline{u}\) such that if \(||u(t)-\overline{u} ||^2<||u(t)-\overline{u} ||< \delta \) then \(|{\mathscr {E}}(0) - {\mathscr {E}}(\overline{u}) |< \epsilon \); but since \({\mathscr {E}}(u(t)) = {\mathscr {E}}(u(0)), \forall t \), we conclude that u(t) never leaves the ball of radius \(\epsilon \) around \(\overline{u}\). \(\square \)

The strategy to prove the nonlinear stability of any equilibrium state of a non-canonical Hamiltonian system is to define a positive definite bilinear form inspired by the expression of the second variation of \(\delta ^2{\mathscr {E}}(\overline{q},\overline{A})\) such that:

(73)

in a vicinity of \(\overline{u}\). Now, note that we can approximate the left-hand side of this inequality by the second variation of \({\mathscr {E}}\), namely

$$\begin{aligned} {{\mathscr {E}}}(\overline{u}+\delta u)-{\mathscr {E}}(\overline{u})-D{\mathscr {E}}(\overline{u})\delta u=\delta ^2{\mathscr {E}}(\overline{u})(\delta u)^2 + {\mathscr {O}}(\delta u^3), \end{aligned}$$
(74)

to define

$$\begin{aligned} \delta ^2{\mathscr {E}}(\overline{u})(\delta u)^2= \delta ^2{\mathscr {H}}(\overline{u})(\delta u)^2+\delta ^2{\mathscr {C}}(\overline{u})(\delta u)^2 \end{aligned}$$
(75)

Since the second variation of the Hamiltonian is already quadratic, we just need to find bounds on the second variation of the Casimir function. In order to do so, let us consider real constants \(\kappa , \lambda \) and \(\mu \) such that

$$\begin{aligned} \kappa \le G'(A)\le \tilde{\kappa };\quad \lambda \le 2L''(A)\le \tilde{\lambda } \quad \mu \le 2G''(A) \le \tilde{\mu } \end{aligned}$$
(76)

Then, define

(77)

so that we have:

(78)

Now, defining

(79)
(80)

it follows that the system is stable under this norm provided \(\kappa <1\) and \(\lambda +\overline{q}\mu >0\).

In order to interpret the stability conditions let us go back to the physical meaning of the functions G and L. For a given stationary state \((\overline{\psi },\overline{A}, \overline{q},\overline{j})\), G provides a relationship between \(\overline{\psi }\) and \(\overline{A}\), viz.

$$\begin{aligned} \overline{\psi }=G'(\overline{A}), \end{aligned}$$
(81)

so that

$$\begin{aligned} \overline{{\textbf {u}}}=G''(\overline{A})\overline{{\textbf {b}}} \end{aligned}$$
(82)

Therefore, G provides a proportionality factor between magnetic fields and flows, and stream functions with magnetic potentials. This could have implications for the stability of toroidal fields in the solar interior. As demonstrated numerically in Dikpati et al. (2021), thin and concentrated latitudinal bands with strong magnetic fields seems to be more favourable for the development of instabilities, since fields with slow latitudinal variation will satisfy more easily (76). Equation (64) says that \(\overline{j}+\overline{q}G'(\overline{A})=L'(\overline{A})\). Since q depends on \(\beta \) the second inequality in (76) suggests a latitudinal dependence of the stability properties, which is also found in numerical simulations in ref Dikpati et al. (2021).

5.4 Accessible variations and the negative energy principle

An alternative approach to study the stability of fluid and plasma systems was proposed by Morrison and Pfirsch (1989) and further explored in Morrison (1998) and Kaltsas et al. (2020); this approach is referred to as dynamical accessibility. The idea of the method is to begin with a general equilibrium state of the Hamiltonian equations and to use the structure of the non-canonical brackets to perturb the system only on directions tangent to the symplectic leaves determined by the Casimirs. By doing so, one gets more flexibility in the choice of equilibria, but on the other hand this type of analysis has difficulties in extending to the general nonlinear stability analysis (Holm et al. 1985) (see Sect. 5.3). To obtain the expression for dynamically accessible variations, we make use of the generation function (Morrison 1998):

$$\begin{aligned} {\mathscr {W}}=\int \big [ \chi q+ \alpha A \big ] \textrm{d}^2x \end{aligned}$$
(83)

Then, for a state variable \({\textbf {v}}=(q,A)\), we define

$$\begin{aligned} \delta v_{da}=\{{\textbf {v}}, {{\mathscr {W}}} \}, \end{aligned}$$
(84)

from where we obtain the following expressions for the variations:

(85)
(86)

In the equations above, we use the notation

$$\begin{aligned} {\mathscr {F}}(q)=\int q_i(x')\delta (x-x')\textrm{d}^2x'; \quad {{\mathscr {F}}}(A)=\int A(x')\delta (x-x')\textrm{d}^2x', \end{aligned}$$
(87)

with \(\delta (x-x')\) representing the Dirac delta distribution. Let us show that dynamically accessible variations yield automatically \(\delta {\mathscr {C}}_{M}^{da}=\delta {\mathscr {C}}_{c}^{da}=0\). In what follows we will repeatedly use the integration by parts formula

$$\begin{aligned} \int f J(g,h)\textrm{d}x^2=-\int J(f,g)h \textrm{d}x^2 \end{aligned}$$
(88)

for any differentiable functions \(f,g,h:\mathbb {R}^2 \rightarrow \mathbb {R}\). First, consider the expression of accessible variations \(\delta {\mathscr {C}}_{M}^{da}\)

(89)

which holds for an arbitrary variation of \(\chi \). For \(\delta {\mathscr {C}}_{c}^{da}\), it follows

(90)

Inserting the expressions of the variations \(\delta A^{da}\) and \(\delta q^{da}\) given by (86) and (85), respectively, we obtain:

(91)

Integrating by parts, it follows that

(92)

The equation above also holds for arbitrary variations \(\alpha _i\) and \(\chi _i\). We may also calculate the dynamically accessible variation of the Hamiltonian function \(\delta {\mathscr {H}}^{da}\):

(93)

For any steady-state solution of the dynamical equations represented by \((\overline{q},\overline{A})\), it follows that \(J(\overline{\psi },\overline{A})=0\) and \(J(\overline{\psi },\overline{q})+J(\overline{A},\overline{j})=0\); hence, integrating by parts, we conclude that \( \delta {\mathscr {H}}^{da}(\overline{q},\overline{A})=0\) for any perturbations \(\alpha ,\chi \).

Let us now calculate the second variation of the Hamiltonian function under dynamically accessible variations:

(94)

Now, we need to derive expressions for the second variations of both the potential vorticity and the magnetic potential:

$$\begin{aligned} \delta ^{2} q^{da}= & {} \{\{{\mathscr {F}}(q),{\mathscr {W}}\},{\mathscr {W}}\}=\{\delta q_1^{da},{\mathscr {W}}\}\nonumber \\= & {} -\big [J(\chi ,J(q,\chi ))+J(\chi ,J(A,\alpha ))+J(\alpha ,J(A,\chi ))\big ]\nonumber \\= & {} -[\nabla \chi .\nabla ^{\perp }\big (\nabla q.\nabla ^{\perp }\chi \big )+ \nabla \alpha .\nabla ^{\perp }\big (\nabla A.\nabla ^{\perp }\chi \big )+ \nabla \chi .\nabla ^{\perp }\big (\nabla A.\nabla ^{\perp }\alpha \big ) ] \end{aligned}$$
(95)
$$\begin{aligned} \delta ^2 A^{da}= & {} \{\{{\mathscr {F}}(A),{\mathscr {W}}\},{\mathscr {W}}\} =\{\delta q_1^{da},{\mathscr {W}}\}= -J(\chi ,J(A,\chi ))\nonumber \\= & {} -[\nabla \chi .\nabla ^{\perp }\big (\nabla A.\nabla ^{\perp }\chi \big ) ] \end{aligned}$$
(96)

Considering a simple steady state \(\overline{A}(y)=B_0y\) and \(\overline{q}(y)=Q_0y=(\Omega ^{'}_0+\beta )y\), we may further decompose the perturbations in a Fourier basis to diagonalise the bilinear form, viz.

$$\begin{aligned} \chi =\sum _{{\textbf {k}}}\delta \hat{ q}_{{\textbf {k}}}e^{i{\textbf {k}}.{\textbf {x}}};\quad \alpha =\sum _{{\textbf {k}}}\delta \hat{ A}_{{\textbf {k}}}e^{i{\textbf {k}}.{\textbf {x}}} \end{aligned}$$
(97)

This Fourier expansion results in

$$\begin{aligned} \delta ^2 \hat{{\mathscr {H}}}&=\sum _{\textbf {k}}\Bigg (B_0+\frac{Q_0}{|{\textbf {k}}|^2} \Bigg )k_x(\delta \hat{q}_{{\textbf {k}}})^2+B_0|{\textbf {k}}|^2k_x \delta \hat{q}_{{\textbf {k}}}\delta \hat{A}_{{\textbf {k}}}\nonumber \\&\quad =\sum _{\textbf {k}}\Bigg [\Bigg (\sqrt{\omega _R+\omega _a}\delta \hat{q}_{{\textbf {k}}}+\frac{\omega _A|{\textbf {k}}|^2}{\sqrt{\omega _R+\omega _a}}\delta \hat{A}_{{\textbf {k}}}\Bigg )^2-\Bigg (\frac{\omega _A|{\textbf {k}}|^2}{\sqrt{\omega _R+\omega _a}}\delta \hat{A}_{{\textbf {k}}}\Bigg )^2\Bigg ] \end{aligned}$$
(98)

where \(\omega _A=B_0k_x\) and \(\omega _R=(V''(y)+\beta )k_x/|{\textbf {k}}|^2\) refer to Alfvén and Rossby wave frequencies, respectively (see Raphaldini and Raupp 2015). Then, the last term in (98) indicates that this system is formally stable under accessible variations, for instance, if \(\omega _A+\omega _R\ge 0\). In general, however, this quadratic form may be indefinite and there might exist modes for which \(\delta ^2 {\hat{{\mathscr {H}}}}>0\) and other modes for which \(\delta ^2 {\hat{{\mathscr {H}}}}<0\). In this case, the existence of “negative energy modes” will imply instability (Kueny and Morrison 1995; Marsden and Ratiu 2013; Morrison and Pfirsch 1989; Morrison and Kotschenreuther 1990).

In this example, we have chosen a simple linear profile of \(\overline{q}(y)\) and \(\overline{A}(y)\) such that the quadratic form would take a simple diagonalizable representation in terms of Fourier modes. For more general basic sates, the analysis can be more intricate.

6 Final remarks

Here we have introduced the Lagrangian (variational) and Hamiltonian formulations of the quasi-geostrophic MHD equations. In this formulation, we found the invariants of the system, which are of two kinds: the Casimirs and momenta. The Casimirs are associated with the particle-relabelling symmetry via Noether’s theorem and correspond to the helicities (magnetic and cross helicities). The zonal momentum found here is associated with the translational symmetry in the zonal direction, and is the most relevant one due to typical zonal jet structure of the flows in stars, generally referred to as the differential rotation profile (Thomas and Weiss 2012). The study of the stability of equilibrium states in these systems is of great importance for understanding the dynamics of the Sun. In particular, the instability type that arises in Sect. 5.4 might contribute to the growth of magnetized Rossby waves as described in Dikpati et al. (2018).