1. Introduction
The convective motion of electrically conducting fluids subject to an external magnetic field, known as magnetoconvection, occurs widely in natural systems and industrial processes. Examples include thermal convection in the outer core of the Earth and solar convection (see, e.g. Proctor & Weiss Reference Proctor and Weiss1982), as well as convection in liquid metal batteries (see, e.g. Kelley & Weier Reference Kelley and Weier2018) and the blanket of the nuclear fusion reactor (Salavy et al. Reference Salavy, Boccaccini, Lässer, Meyder, Neuberger, Poitevin, Rampal, Rigal, Zmitko and Aiello2007). The Rayleigh–Bénard convection (RBC) under an imposed external magnetic field is a classical model system for studying magnetoconvection. In RBC (Ahlers, Grossmann & Lohse Reference Ahlers, Grossmann and Lohse2009; Lohse & Xia Reference Lohse and Xia2010; Chillà & Schumacher Reference Chillà and Schumacher2012; Xia Reference Xia2013; Xia et al. Reference Xia, Huang, Xie and Zhang2023; Lohse & Shishkina Reference Lohse and Shishkina2024), a fluid layer is heated from below and cooled from above, with a constant temperature difference
$\Delta T$
. This system is governed by two dimensionless parameters, namely, the Rayleigh number
$Ra=\alpha g \Delta T H^3 / (\nu \kappa )$
and the Prandtl number
$\textit{Pr}=\nu / \kappa$
. Here,
$\alpha$
is the thermal expansion coefficient,
$g$
is the gravitational acceleration constant,
$H$
is the height of the system,
$\nu$
is the kinematic viscosity and
$\kappa$
is the thermal diffusivity. In a finite-sized system, the aspect ratio
$\varGamma = D/H$
(where
$D$
is the lateral dimension of the system) is introduced to characterise the extent of spatial confinement. To study magnetoconvection, an external magnetic field of strength
$B$
is applied. The strength of the magnetic field is characterised by the Hartmann number
$\textit{Ha}=\textit{BH}\sqrt {{\sigma }/{\rho \nu } }$
, where
$\sigma$
and
$\rho$
are the electric conductivity and density of the fluid, respectively.
The direction of the magnetic field plays a vital role in magnetoconvection. In the case of a vertical magnetic field, early studies mainly focus on determining the critical Rayleigh number
$Ra_c$
for the onset of convection. Using linear stability analysis (LSA), Chandrasekhar (Reference Chandrasekhar1952) showed that the
$Ra_c$
in a horizontally infinite fluid layer with free slip top and bottom boundary conditions follows (1.1), i.e.
where
$Q=\textit{Ha}^2$
is the Chandrasekhar number and
$a$
is the wavenumber. When
$\textit{Ha}\gg 1$
,(1.1) can be reduced to
and
asymptotically. The above-mentioned relation suggests that the Lorentz force introduced by the magnetic field acts as a stabilising force, significantly delaying the onset of convection.
In any lab experiments, sidewalls are always unavoidable. To minimise the influence of sidewalls, early studies mainly focused on a regime with
$\varGamma \geqslant 1$
, where the effect of spatial confinement from sidewalls is weak. For example, experimental studies by Nakagawa (Reference Nakagawa1955) in convection cells with the aspect ratio in the range of
$2.4\leqslant \varGamma \leqslant 4.8$
, Jirlow (Reference Jirlow1956) with
$\varGamma =20$
and Cioni, Chaumat & Sommeria (Reference Cioni, Chaumat and Sommeria2000) with
$\varGamma =1$
all confirmed, to some extent, the prediction on
$Ra_c$
with sufficiently large
$\textit{Ha}$
, cf. (1.2), although the presence of electrically insulating sidewalls and the resulting wall modes may influence the results. In a very recent study by Bader & Zhu (Reference Bader and Zhu2023), the wavelength
$a$
, cf. (1.3), is also validated through two-dimensional direct numerical simulation (DNS) in cells with
$2.25\leqslant \varGamma \leqslant 11$
. These studies suggest that the effect of spatial confinement in the regime with
$\varGamma \geqslant 1$
on the onset of bulk convection in a strong magnetic field is very small, if it exists. However, there is no established relation on the condition under which the effects of finite
$\varGamma$
can be ignored in finite-sized magnetoconvection systems.
When the Rayleigh number is larger than
$Ra_c$
, the studies mainly focus on determining the dependence of heat transport efficiency, characterised by the Nusselt number
$\textit{Nu}$
, on the supercritical Rayleigh number
$Ra/\textit{Ha}^{2}$
of the system. Table 1 summarises results reported in the literature. It can be seen that, depending on the parameter regime, different scaling exponents ranging from
$1/2$
to
$1$
are reported (Cioni et al. Reference Cioni, Chaumat and Sommeria2000; Aurnou & Olson Reference Aurnou and Olson2001; Burr & Müller Reference Burr and Müller2001; Yu, Zhang & Ni Reference Yu, Zhang and Ni2018; Yan et al. Reference Yan, Calkins, Maffei, Julien, Tobias and Marti2019). It should be noted that the
$Ra$
range and
$\textit{Ha}$
range in these studies are also limited. This may be due to the difficulty in achieving both a strong magnetic field and a large working space simultaneously in experiments, or the demanding computing power required to simulate low
$\textit{Pr}$
turbulent magnetoconvection. Two exceptions are the DNS studies conducted at
$\textit{Pr} = 8$
by Lim et al. (Reference Lim, Chong, Ding and Xia2019) and at
$\textit{Pr} = 1$
by Yan et al. (Reference Yan, Calkins, Maffei, Julien, Tobias and Marti2019), where less numerical effort was required. More importantly, these studies were carried out in cells with different geometries and aspect ratios
$\varGamma$
. Thus, the reported difference in the heat transport scaling exponents highlighted the important role played by the geometry and spatial confinement of the convection cell in magnetoconvection above the onset. A clear understanding of these effects in magnetoconvection remains to be explored.
Summary of parameter range of magnetoconvection with a vertical magnetic field. Here,
$Ra$
,
$\textit{Pr}$
and
$\textit{Ha}$
are the Rayleigh, Prandtl and Hartmann numbers, respectively. The scaling exponent
$\beta$
is obtained from the relation
$\textit{Nu} \sim (Ra/\textit{Ha}^{2})^{\beta }$
, if available in the referenced work.
$\varGamma$
is the aspect ratio. For rectangular cells with length
$L$
, width
$W$
and height
$H$
,
$\varGamma _x=L/H$
and
$\varGamma _y=W/H$
. For cylindrical cells,
$\varGamma =D/H$
with
$D$
being the diameter of the cell. The references are (
$a$
) Cioni et al. (Reference Cioni, Chaumat and Sommeria2000); (
$b$
) Aurnou & Olson (Reference Aurnou and Olson2001); (
$c$
) Burr & Müller (Reference Burr and Müller2001); (
$d$
) Yu et al. (Reference Yu, Zhang and Ni2018); (
$e$
) Liu et al. (Reference Liu, Krasnov and Schumacher2018); (
$f$
) Lim et al. (Reference Lim, Chong, Ding and Xia2019); (
$g$
) Yan et al. (Reference Yan, Calkins, Maffei, Julien, Tobias and Marti2019); (
$h$
) Zürner et al. (Reference Zürner, Schindler, Vogt, Eckert and Schumacher2020); (
$i$
) Akhmedagaev et al. (Reference Akhmedagaev, Zikanov, Krasnov and Schumacher2020); (
$j$
) Grannan et al. (Reference Grannan, Cheng, Aggarwal, Hawkins, Xu, Horn, Sánchez-Álvarez and Aurnou2022); (
$k$
) Xu et al. (Reference Xu, Horn and Aurnou2023); (
$l$
) Teimurazov et al. (Reference Teimurazov, McCormack, Linkmann and Shishkina2024).

To extend the supercritical Rayleigh number
$Ra/\textit{Ha}^{2}$
, it is always desirable to reach higher
$Ra$
by increasing
$H$
while keeping the horizontal length scale of the convection cell fixed, i.e. in cells with
$\varGamma \ll 1$
. What the effects of the combined stabilising forces due to both geometrical confinement and the vertical magnetic field are remains unclear. In addition, it is also of interest to determine how large
$\varGamma$
should be so that the system can be treated as if there were no boundaries, i.e. when the system reaches the so-called
$\varGamma$
-independent limit.
Regarding the understanding of the effect of the spatial confinement in classical RBC near the onset of convection and in the turbulent state, much progress has been achieved. For the onset of convection with
$\varGamma \lt 1$
, Shishkina (Reference Shishkina2021) theoretically showed that
$Ra_c$
depends on the aspect ratio of the convection cell. For a cylindrical cell,
$Ra_{c,\varGamma }=(2\pi )^4(1+1.49/\varGamma ^2)(1+0.34/\varGamma ^2)$
, which has been confirmed by experimental measurements by Zhang & Xia (Reference Zhang and Xia2023) and Ren et al. (Reference Ren, Tao, Xia and Xie2024a). The heat transport just above the onset of convection is found to be
$\textit{Nu}-1=0.018(1+0.34/\varGamma ^2)(Ra/Ra_{c,\varGamma }-1)$
(Ren et al. Reference Ren, Tao, Zhang, Xia and Xie2024b). In the turbulent state, the length scale
$\ell$
of the flow is found to be
$\ell = H/(1+1.49\varGamma ^{-2})^{1/[3(1-\alpha )]}$
, with
$\alpha$
being the scaling exponent between
$\textit{Nu}$
and
$Ra$
in the case of
$\varGamma \gg 1$
(Ahlers et al. Reference Ahlers2022; Ren et al. Reference Ren, Tao, Zhang, Xia and Xie2024b). The transitional Rayleigh number to the ultimate regime
$Ra_t$
predicted by Kraichnan (Reference Kraichnan1962) is also found to depend on
$\varGamma$
with
$Ra_t\sim \varGamma ^{-3}$
(Roche et al. Reference Roche, Gauthier, Kaiser and Salort2010; Ahlers et al. Reference Ahlers2022). In the classical regime of turbulent RBC with
$\varGamma \geqslant 1$
, it has been shown that while the heat transport will become independent of
$\varGamma$
when
$\varGamma \gt 4$
, the temperature and velocity variance of the flow requires much larger
$\varGamma$
to reach a
$\varGamma$
-independent state (Pandey, Scheel & Schumacher Reference Pandey, Scheel and Schumacher2018; Stevens et al. Reference Stevens, Blass, Zhu, Verzicco and Lohse2018, Reference Stevens, Hartmann, Verzicco and Lohse2024). These previous studies, although focused on spatial confinement in classical RBC without a magnetic field, provide a solid background and starting point for extending the investigation to magnetoconvection.
Compared with the large body of studies on the effect of vertical magnetic field (Chandrasekhar Reference Chandrasekhar1952; Nakagawa Reference Nakagawa1955; Jirlow Reference Jirlow1956; Cioni et al. Reference Cioni, Chaumat and Sommeria2000; Aurnou & Olson Reference Aurnou and Olson2001; Burr & Müller Reference Burr and Müller2001; Liu, Krasnov & Schumacher Reference Liu, Krasnov and Schumacher2018; Yu et al. Reference Yu, Zhang and Ni2018; Lim et al. Reference Lim, Chong, Ding and Xia2019; Yan et al. Reference Yan, Calkins, Maffei, Julien, Tobias and Marti2019; Akhmedagaev et al. Reference Akhmedagaev, Zikanov, Krasnov and Schumacher2020; Zürner et al. Reference Zürner, Schindler, Vogt, Eckert and Schumacher2020; Grannan et al. Reference Grannan, Cheng, Aggarwal, Hawkins, Xu, Horn, Sánchez-Álvarez and Aurnou2022; Bader & Zhu Reference Bader and Zhu2023; Xu, Horn & Aurnou Reference Xu, Horn and Aurnou2023; Teimurazov et al. Reference Teimurazov, McCormack, Linkmann and Shishkina2024), the studies on the effects of spatial confinement on magnetoconvection with horizontal magnetic field is very limited. The experimental studies mainly focus on the dynamics of the large-scale flow structures beyond the onset of convection in a rectangular cell with
$\varGamma =5$
, such as its roll structure (Yanagisawa et al. Reference Yanagisawa, Hamano, Miyagoshi, Yamagishi, Tasaka and Takeda2013), flow reversal (Tasaka et al. Reference Tasaka, Igaki, Yanagisawa, Vogt, Zuerner and Eckert2016), flow structure transition from two dimension to three dimension (Vogt et al. Reference Vogt, Ishimi, Yanagisawa, Tasaka, Sakuraba and Eckert2018) and the dynamics of the flow, i.e. transition from steady flow to oscillatory convection (Yang, Vogt & Eckert Reference Yang, Vogt and Eckert2021). The above discoveries in the
$\varGamma =5$
cell were also validated by a DNS study very recently (Chen et al. Reference Chen, Wang and Ni2024a). In a cuboid cell with
$\varGamma =0.5$
, the flow morphology evolution with the presence of a horizontal magnetic field in the
$\textit{Ha}{-}Ra$
phase space was outlined, and a connection between the internal flow structure and the global heat transport efficiency was also established (Chen et al. Reference Chen, Yang and Ni2024b). The experimental difficulty in achieving both a large working space and a strong magnetic field at the same time to study magnetoconvection can be partially overcome by studying the problem using the LSA, which also serves as one of the motivations for the present study.
As both mechanisms oppose instability: the drag imposed by spatial confinement delays the onset of convection, and the Lorentz force generated by the magnetic field provides an additional stabilising effect. Therefore, we aim to understand how the geometrical confinement and the magnetic field interact with each other. More specifically, which factor plays a more important role in the magnetoconvection?
In this paper, using LSA with DNS validation, we study the onset of bulk convection in finite-sized two-dimensional (2-D) RBC under the action of a steady magnetic field in different directions. The reason for choosing a 2-D system is due to the fact that they are mathematically more feasible and computationally more efficient. Meanwhile, they can also provide valuable insights into certain aspects of the flow, such as its length scale and scaling behaviours. For example, 2-D geometry was used to study the oscillatory and steady magnetoconvection by Knobloch, Weiss & Da Costa (Reference Knobloch, Weiss and Da Costa1981); it is also used by Aggarwal, Aurnou & Horn (Reference Aggarwal, Aurnou and Horn2022) to explore the damping of large-scale jets on Jupiter and by Bader & Zhu (Reference Bader and Zhu2023) to examine the length scales in magnetoconvection with a strong vertical magnetic field. One may also note that the classical LSA of magnetoconvection carried out by Chandrasekhar (Reference Chandrasekhar1952) can also be directly applied to a 2-D model of magnetoconvection. Although a 2-D system lacks three-dimensional flow features (e.g. wall modes) and it is not possible to conduct a 2-D experiment for validation, the present results are also expected to apply to three-dimensional (3-D) cases. For instance, in confined 3-D systems with electrically conducting sidewalls that suppress wall modes under a vertical magnetic field, the physical picture of the competition between spatial confinement and magnetic effects is expected to be similar to that revealed in the present study.
We will show that the direction of the magnetic field plays a vital role in magnetoconvection. In the case where the magnetic field is in the horizontal direction perpendicular to the 2-D system plane, i.e. in the
$y$
-direction as shown in figure 1, the magnetic field does not affect the flow due to zero Lorentz force in the system. In the case of a vertical (
$z$
-direction) or horizontal (
$x$
-direction) magnetic field,
$Ra_c$
is delayed due to the stabilising Lorentz force. The magnetic field also modifies the length scale. For a vertical magnetic field,
$\ell$
decreases with increasing
$\textit{Ha}_z$
, following
$\ell =2^{1/6}\pi ^{1/3}\textit{Ha}^{-1/3}$
. For a horizontal magnetic field, when
$\varGamma \lt 0.62\textit{Ha}_x^{0.47}$
, the flow is a single-roll structure with
$\ell$
being the width of the domain. We also outlined phase diagrams showing the dominating factors determining
$Ra_c$
. When
$\varGamma \leqslant 0.83\textit{Ha}_z^{-0.5}$
for vertical and
$\varGamma \leqslant 0.66\textit{Ha}_x^{-1.01}$
for horizontal magnetic field,
$Ra_c$
is mainly determined by the geometrical confinement with
$Ra_c=502\varGamma ^{-4.0}$
. When
$\varGamma \geqslant 2^{1/6}\pi ^{1/3}\textit{Ha}_z^{-1/3}$
for vertical and
$\varGamma \geqslant 5$
for the horizontal magnetic field,
$Ra_c$
is mainly determined by the magnetic field with
$Ra_c=\pi ^2\textit{Ha}^2$
. In the intermediate regime, both the magnetic field and spatial confinement determine
$Ra_c$
, and a horizontal magnetic field is found to suppress convection more than a vertical magnetic field. In addition, under a horizontal magnetic field, there exists a subregime within the intermediate regime characterised by
$Ra_c = 9.9\,\varGamma ^{-2.0} \textit{Ha}_x^2$
, which is absent in the case of a vertical magnetic field.
Schematics of the two-dimensional magnetoconvection system under consideration. The gravity is pointing in the -
$z$
-direction. The bottom boundary is held at a temperature
$\Delta T$
higher than the top boundary which is kept at constant temperature
$T$
. The two sidewalls are adiabatic. All the walls satisfy the no-slip and no-penetration velocity boundary condition. The magnetic field can be in either
$x$
-,
$y$
- or
$z$
-direction. The aspect ratio of the domain is defined as
$\varGamma =D/H$
with
$D$
and
$H$
being the width and height of the domain, respectively.

The remainder of this paper is organised as follows. We first introduce the physical model considered in § 2.1. Then, we present the details of the LSA method for the present 2-D systems under the action of a magnetic field in either the
$x$
- or the
$z$
-direction in § 2.2, and the validation of the LSA method in § 2.3. Section 3 presents our main findings, which are divided into three subsections. The effects of a magnetic field in the
$y$
-direction, the
$z$
-direction and the
$x$
-direction are discussed in §§ 3.1, 3.2 and 3.3, respectively. In each of §§ 3.2 and 3.3, we first discuss the dependence of
$Ra_c$
on
$\varGamma$
and
$\textit{Ha}$
, and obtain a phase diagram for the dominating factors that determine
$Ra_c$
. We then discuss the flow pattern for the onset of convection and its related length scale
$\ell$
. In § 4, we summarise the findings. In addition, we provide the accuracy validation of the LSA method and details of the DNS in Appendices A and B, respectively.
2. Physical model and numerical method
2.1. Model system
We consider a 2-D Rayleigh–Bénard convection system subjected to an external magnetic field. The fluid is heated from below and cooled from above with the uniform gravitational field acting in the -
$z$
-direction. A sketch of the geometry of the system and the coordinate system is shown in figure 1. The temperature difference across the fluid layer is denoted as
$\Delta T$
. The aspect ratio
$\varGamma =D/H$
characterises the effects of spatial confinement with
$D$
being its horizontal dimension and
$H$
the height of the cell. A uniform magnetic field
$\boldsymbol{B}=B\hat {\boldsymbol{e}}_{\boldsymbol{b}}$
is applied to the system, where
$\hat {\boldsymbol{e}}_{\boldsymbol{b}}=\hat {\boldsymbol{e}}_{\boldsymbol{x,y,z}}$
is the unit vector parallel to
$\boldsymbol{B}$
.
The present study focuses on liquid-metal magnetoconvection. The governing equations of the system under the Oberbeck–Boussinesq approximation (Oberbeck Reference Oberbeck1879; Boussinesq Reference Boussinesq1903) and the low magnetic Reynolds number
$Rm$
quasi-static approximation (Moreau Reference Moreau1990) are
where
$\boldsymbol{u}$
,
$p$
and
$T$
represent the velocity, pressure and temperature fields. The
$\hat {\boldsymbol{e}}_{\boldsymbol{z}}$
is the unit vector in the vertical direction. The
$\phi$
and
$\boldsymbol{J}$
represent the electric potential and the electrical current density, respectively. Most laboratory studies of magnetoconvection use liquid metals as the working fluid, whose typical magnetic Prandtl numbers are
$O(10^{-5})$
or smaller, such as gallium–indium–tin (GaInSn) with
$Pm = 1.27\times 10^{-6}$
at
$35\,^\circ {\textrm C}$
(Zürner et al. Reference Zürner, Schindler, Vogt, Eckert and Schumacher2020; Chen et al. Reference Chen, Yang and Ni2024b; Ren et al. Reference Ren, Tao, Xia and Xie2024a). In these cases, the low-
$Rm$
quasi-static approximation is valid, and the magnetic field
$\boldsymbol{B}$
does not vary with time; therefore, the induction equation does not need to be included in the governing equations. Combining (2.4) and (2.5), one obtains a Poisson equation for
$\phi$
, namely,
Equations (2.1)–(2.5) have been made dimensionless with respect to the cell height
$H$
, the imposed temperature difference
$\Delta T$
, the magnitude of the imposed magnetic field
$B$
, the vertical diffusion time scale
$H^2/\kappa$
and the velocity scale
$\kappa /H$
.
The no-penetration and no-slip conditions are applied for the velocity field on all the boundaries. The isothermal conditions are applied on the top and bottom boundaries, and adiabatic boundary conditions are applied at the left and right walls. In addition, insulating boundary conditions are imposed on all boundaries, namely
The momentum equation (cf. (2.2)) can be further simplified if the imposed magnetic field is in the
$x$
-direction or the
$z$
-direction. For example, if
$\hat {\boldsymbol{e}}_{\boldsymbol{b}}=\hat {\boldsymbol{e}}_{\boldsymbol{z}}$
, the vector
$\boldsymbol{u} \times \hat {\boldsymbol{e}}_{\boldsymbol{b}}=\boldsymbol{u} \times \hat {\boldsymbol{e}}_{\boldsymbol{z}}$
will be in the
$y$
-direction. Combining the 2-D assumption, i.e. no variation in negative
$y$
-direction, and the boundary conditions of
$\phi$
, it is straightforward to see from (2.6) that the electric potential field
$\phi$
is a constant. Thus, (2.4) will be reduced to
$\boldsymbol{J}=(\boldsymbol{u} \times \hat {\boldsymbol{e}}_{\boldsymbol{z}})$
. If one substitutes this expression for
$\boldsymbol{J}$
into (2.2),
where
$u$
is the
$x$
-direction component of
$\boldsymbol{u}$
and
$\textit{Ha}_z$
represents the Hartmann number based on the vertical magnetic field. Therefore, the governing equations to be analysed here for the vertical magnetic field are (2.1), (2.8) and (2.3). Similarly, for the horizontal magnetic field in the
$x$
-direction, the (2.2) can be simplified to
where
$w$
is the
$z$
component of
$\boldsymbol{u}$
and
$\textit{Ha}_x$
represents the Hartmann number based on the horizontal magnetic field. The governing equations to be analysed here for the horizontal magnetic field are (2.1), (2.9) and (2.3).
2.2. Linear stability analysis method
We consider the onset of stationary bulk convection. It has been shown by Chandrasekhar (Reference Chandrasekhar1952) that when the thermal diffusivity
$\kappa$
of the fluid is smaller than the magnetic diffusivity
$\eta$
, the instability sets in as stationary convection, i.e. the exchange of stability is valid. This is the case for most laboratory studies on magnetoconvection (Zürner et al. Reference Zürner, Schindler, Vogt, Eckert and Schumacher2020; Chen et al. Reference Chen, Yang and Ni2024b; Ren et al. Reference Ren, Tao, Xia and Xie2024a), where the liquid metal alloy GaInSn was used with its
$\kappa =1.08\times 10^{-5} \textrm {m}^2\,\textrm {s}^{- 1}$
and
$\eta =2.49\times 10^{-1} \textrm {m}^2\,\textrm {s}^{- 1}$
, corresponding to a Prandtl number
$\textit{Pr} = 0.029$
and a magnetic Prandtl number
$Pm = 1.27\times 10^{-6}$
.
The base state of the flow is given by zero velocity and a linear temperature distribution from the bottom boundary to the top boundary. Substituting this base state into the governing equations derived in § 2.1, and eliminating the quadratic and time-dependent terms, the linearised governing equations are obtained. For a vertical magnetic field, these equations are
Note that, for convenience, the symbols
$\boldsymbol{u}$
and
$T$
in (2.10)–(2.12) are the velocity fluctuation from zero and the temperature deviation from the linear profile. They share the same meaning in the remainder of the paper.
In the case where the magnetic field is in the
$x$
-direction, one needs to replace (2.10) with the following equation:
To include the effects of aspect ratio
$\varGamma$
, two length scales, i.e.
$D$
and
$H$
, are used to non-dimensionalise the independent variables
$x$
and
$z$
, respectively. This rescaling introduces
$\varGamma$
into the differential operators, while keeping the governing equations unchanged. For example, the Laplacian
${\nabla }^2$
is given by
From previous studies (Shishkina Reference Shishkina2021; Zhang & Xia Reference Zhang and Xia2023; Ren et al. Reference Ren, Tao, Xia and Xie2024a), it is known that the bulk onset of instability manifests as one vertical roll and an unknown number of horizontal rolls. Combining with the boundary conditions, the approximating series for temperature can be written as
\begin{equation} T\cong \sum _{m = 1}^{M} \sum _{n = 1}^{N}H_{\kern-1pt\textit{mn}}T_{\kern-1pt\textit{mn}}, \end{equation}
where
$H_{\kern-1pt\textit{mn}}$
are the coefficients corresponding to the basis functions
$T_{\kern-1pt\textit{mn}}$
. The indices
$m$
and
$n$
are mode numbers in the
$x$
- and
$z$
-directions, while
$M$
and
$N$
are the total numbers of trial functions in the
$x$
- and
$z$
- directions. When an odd number of rolls is arranged in the
$x$
-direction,
when an even number of rolls is arranged in the
$x$
-direction,
For a 2-D solenoid flow, a stream function
$\psi$
can be defined, which is convenient to determine a series of solenoid fields that can be used to approximate the velocity field. We choose
\begin{equation} \boldsymbol{u}\cong \sum _{m = 1}^{M} \sum _{n = 1}^{N}A_{\textit{mn}}\boldsymbol{U}_{\kern-1pt\textit{mn}}=\sum _{m = 1}^{M} \sum _{n = 1}^{N}A_{\kern-1pt\textit{mn}}\left(\frac {\partial \psi _{\kern-1pt\textit{mn}}}{\partial z}\hat {\boldsymbol{e}}_{\boldsymbol{x}}-\frac {1}{\varGamma }\frac {\partial \psi _{\kern-1pt\textit{mn}}}{\partial x}\hat {\boldsymbol{e}}_{\boldsymbol{z}}\right), \end{equation}
where
$A_{\kern-1pt\textit{mn}}$
are the coefficients corresponding to the basis functions
$\boldsymbol{U}_{\kern-1pt\textit{mn}}$
. The boundary conditions of the stream function
$\psi _{\kern-1pt\textit{mn}}$
can be derived from the no-slip and no-penetration velocity boundary conditions, i.e.
By considering the parity (odd–even nature), the stream function
$\psi _{\kern-1pt\textit{mn}}$
is chosen such that when an odd number of rolls are arranged in the
$x$
-direction,
$\psi _{\kern-1pt\textit{mn}}$
is given by
\begin{equation} \psi _{\kern-1pt\textit{mn}}=C_m(x)C_n(z)=\left ( \frac {\cosh {\lambda _m x}}{\cosh {\frac {1}{2}\lambda _m}}-\frac {\cos {\lambda _m x}}{\cos {\frac {1}{2}\lambda _m}} \right ) \left ( \frac {\cosh {\lambda _n z}}{\cosh {\frac {1}{2}\lambda _n}}-\frac {\cos {\lambda _n z}}{\cos {\frac {1}{2}\lambda _n}} \right ) , \end{equation}
where
$C_m(x)$
and
$C_n(z)$
are the even beam function (Reid & Harris Reference Reid and Harris1958) in the
$x$
-direction and
$z$
-direction, respectively. When an even number of rolls are arranged in the
$x$
-direction,
$\psi _{\kern-1pt\textit{mn}}$
is given by
\begin{equation} \psi _{\kern-1pt\textit{mn}}=D_m(x)C_n(z)=\left ( \frac {\sinh {\lambda _m x}}{\sinh {\frac {1}{2}\lambda _m}}-\frac {\sin {\lambda _m x}}{\sin {\frac {1}{2}\lambda _m}} \right ) \left ( \frac {\cosh {\lambda _n z}}{\cosh {\frac {1}{2}\lambda _n}}-\frac {\cos {\lambda _n z}}{\cos {\frac {1}{2}\lambda _n}} \right ) , \end{equation}
where
$D_m(x)$
is odd beam function in the
$x$
-direction.
For the even beam function,
$\lambda _m$
is the root of
which is obtained from the no-slip velocity boundary conditions (cf. (2.19) and (2.20)). Similarly,
$\lambda _n$
also satisfies (2.23).
For the odd beam function,
$\lambda _m$
is the root of
Similarly,
$\lambda _n$
also satisfies (2.24).
Then, the Galerkin method (Buell & Catton Reference Buell and Catton1983; Yu et al. Reference Yu, Goldfaden, Flagstad and Scheel2017) is applied to reduce the analysis to an eigenvalue problem. When the magnetic field is imposed in the
$z$
-direction, after inserting (2.15) and (2.18) into (2.10) and (2.11), the Galerkin method yields
$2M\times N$
equations to solve for
$2MN$
coefficients (
$H_{\kern-1pt\textit{mn}}$
,
$A_{\kern-1pt\textit{mn}}$
)
\begin{equation} \left ( \begin{matrix} \bar { \bar {M}}_{11} & \bar { \bar {M}}_{12} \\ Ra\bar { \bar {M}}_{21} & \bar { \bar {M}}_{22} \end{matrix} \right ) \left ( \begin{matrix} \bar {H} \\ \bar {A} \end{matrix} \right ) =0. \end{equation}
Here, a double overbar denotes a matrix and a single overbar denotes a vector. The matrices are given by
and
When the magnetic field is in the
$x$
-direction, we need to replace (2.27) by
The vector
$\bar {H}$
can be eliminated from (2.25) to reduce the problem to standard eigenvalue form
\begin{equation} \left ( \bar { \bar {M}}_{22}^{-1} \bar { \bar {M}}_{21} \bar { \bar {M}}_{11}^{-1} \bar { \bar {M}}_{12} - \frac {\bar { \bar {I}}}{Ra} \right )\bar {A}=0. \end{equation}
Then, a series of
$Ra$
can be solved, with the minimum
$Ra$
being the critical Rayleigh number
$Ra_c$
, and the corresponding onset pattern can be determined.
A sufficient number of trial functions, up to
$M=N=60$
, was used to ensure the accuracy of the determined
$Ra_c$
in this paper. The details of the accuracy validation on the order of the trial functions of the LSA can be found in Appendix A.
2.3. Validation of the LSA method
We validate the LSA method in this subsection. To do so, we solve the LSA problem with no magnetic field, i.e.
$\textit{Ha}=0$
, and compare the calculated
$Ra_c$
with those published by Ahlers et al. (Reference Ahlers2022). In addition, we carried out a DNS study of the full governing equation near the onset of convection. Following a method proposed by Ren et al. (Reference Ren, Tao, Xia and Xie2024a), we obtained
$Ra_c$
versus
$\varGamma$
based on the heat transport data. The details of the DNS can be found in Appendix B.
Figure 2(
$a$
) plots the
$Ra_c$
obtained from present LSA as a function of
$\varGamma$
for the odd number of rolls and even number of rolls in the
$x$
-direction separately. Each curve (see also figures 2b, 3, 4a, b, 6, 9a, b, 10, 11a, b and 12a) consists of several hundred logarithmically evenly spaced points for smoothness. For
$\varGamma \lt 1$
, it is the odd number of rolls (one roll in this case) that first become unstable. When
$\varGamma \gtrsim 1$
, the two curves cross each other alternatively, suggesting that the number of rolls in the
$x$
-direction for the onset of convection increases with
$\varGamma$
. An example of the transition from a one-roll structure to a two-roll structure in the vicinity of
$\varGamma =1.63$
obtained from the DNS study is shown as an inset. For a given
$\varGamma$
, the minimum value of the two curves corresponds to the critical Rayleigh number
$Ra_c$
, which is plotted in figure 2(b) as a function of
$\varGamma$
. It can be seen that
$Ra_c$
obtained from the present LSA, DNS and that published by Ahlers et al. (Reference Ahlers2022) all collapse on top of each other. In addition, when
$\varGamma \leqslant 1/10$
, the data can be fitted by
$Ra_c = 502\varGamma ^{-4.0}$
as indicated by the black dashed line. The scaling exponent of
$-4.0$
is in good agreement with the theoretical prediction (Shishkina Reference Shishkina2021) and experimental observations (Zhang & Xia Reference Zhang and Xia2023; Ren et al. Reference Ren, Tao, Xia and Xie2024a). The results thus validated the LSA method used in the present study.
(
$a$
) Critical Rayleigh number for onset of convection
$Ra_c$
versus
$\varGamma$
with no magnetic field for flow patterns with odd numbers of rolls in the
$x$
-direction and those with even numbers of rolls in the
$x$
-direction. The inset shows the transition from a one-roll pattern to a double-roll pattern with increasing
$\varGamma$
. (b)
$Ra_c$
versus
$\varGamma$
. The black dashed line marks
$Ra_c \sim \varGamma ^{-4.0}$
fitted to the data with
$\varGamma \leqslant 1/10$
. The horizontal dash-dotted line marks
$Ra_c=1708$
with periodic boundary conditions in the
$x$
-direction. The blue dashed line is the LSA result from Ahlers et al. (Reference Ahlers2022).

3. Results and discussions
In the following, we will discuss the effects of magnetic field strength on the onset of convection with geometrical confinement. The direction of the magnetic field will be considered separately in §§ 3.1, 3.2 and 3.3 for the
$y$
-direction,
$z$
-direction and
$x$
-direction, respectively. For each direction, we first obtain the dependence of
$Ra_c$
on
$\varGamma$
and
$\textit{Ha}$
, and then study the onset pattern and the corresponding length scale
$\ell$
.
3.1. Case with
$\boldsymbol{B}=B\hat {\boldsymbol{e}}_{\kern-1pt\boldsymbol{y}}$
In the case when the imposed magnetic field is in the
$y$
-direction, i.e.
$\boldsymbol{B}=B\hat {\boldsymbol{e}}_{\kern-1pt\boldsymbol{y}}$
, (2.6) will be
where
$\psi$
is the stream function. Note that the boundary conditions for
$\psi$
and
$\phi$
are the same. We then obtain
where
$C$
is an arbitrary constant.
Now, let us substitute (3.2) into (2.4), so we will have
which results in a zero Lorentz force in (2.2). Thus, the magnetic field in the
$y$
-direction, i.e. a direction parallel to the roll axis, does not affect 2-D RBC. This result may explain the experimental and numerical observations that the axes of the roll structures in rectangular convection cells are always found to be parallel or antiparallel to the direction of the applied horizontal magnetic field (Yanagisawa et al. Reference Yanagisawa, Yamagishi, Hamano, Tasaka, Yoshida, Yano and Takeda2010; Chen et al. Reference Chen, Wang and Ni2024a). Note Chandrasekhar (Reference Chandrasekhar1952) also showed that for 3-D systems with periodic boundary conditions in the
$x$
- and
$y$
-directions, the horizontal magnetic field is also found not to affect the onset of convection rolls with axes parallel or anti-parallel to the direction of the magnetic field.
3.2. Case with
$\boldsymbol{B}=B\hat {\boldsymbol{e}}_{\boldsymbol{z}}$
3.2.1. Onset Rayleigh number
$Ra_c$
We now study how a vertical (
$z$
-direction) magnetic field affects the onset of convection in confined 2-D magnetoconvection. The strength of the magnetic field is characterised by
$\textit{Ha}_z=\textit{BH}\sqrt { {\sigma }/{\rho \nu }}$
. Figure 3 plots the critical Rayleigh number
$Ra_c$
for the onset of convection as a function of
$\varGamma$
for different
${Ha_z}$
. The
$Ra_c$
versus
$\varGamma$
obtained from DNS at
$\textit{Ha}_z=100$
and
$\textit{Ha}_z=1000$
are also plotted as circles in the figure. The LSA and DNS results show good agreement. When
$\textit{Ha}_z=0$
, the results replicate those shown in figure 2, i.e. a
$Ra_c=502\varGamma ^{-4.0}$
(the dashed line) when
$\varGamma \lt 1/10$
and
$Ra_c$
approaches 1708 (the horizontal dash-dotted line) with increasing
$\varGamma$
.
Critical Rayleigh number for the onset of convection
$Ra_c$
versus
$\varGamma$
for different
$\textit{Ha}_z$
. The solid lines represent the LSA results, and the circles denote the DNS results at
$\textit{Ha}_z = 100$
and
$1000$
. The horizontal dash-dotted line marks
$Ra_c=1708$
. For the meaning of the dashed line and the dash-dot-dotted line, see the main text.

With the presence of a magnetic field, on the one hand,
$Ra_c$
increases with
$\textit{Ha}_z$
for fixed
$\varGamma$
, suggesting that the vertical magnetic field delays the onset of convection, e.g. for the case with
$\varGamma =1$
,
$Ra_c=2.59\times 10^3( \textit{Ha}_z=0)$
, and it increases to
$9.11\times 10^7$
at
$\textit{Ha}_z=3000$
. Moreover, the suppression of convection by the magnetic field is very sensitive to
$\textit{Ha}_z$
, i.e.
$Ra_c$
is almost doubled when
$\textit{Ha}_z$
is increased from 0 to 10. However, in the turbulent state, it is found that a threshold of
$\textit{Ha}_z=50$
at
$Ra=10^7$
is needed for the heat transport of the system to be suppressed by the magnetic field (Lim et al. Reference Lim, Chong, Ding and Xia2019). On the other hand, for fixed
$\textit{Ha}_z$
,
$Ra_c$
first decreases with
$\varGamma$
and then becomes
$\varGamma $
-independent for sufficiently large values of
$\varGamma$
. The tiny discontinuities seen in curves with
$\textit{Ha}_z\leqslant 30$
are due to the transition of the flow topology from the odd roll structure to the even roll structure as discussed in § 2.3.
In the small
$\varGamma$
limit, the curves for different
$\textit{Ha}_z$
collapse on top of each other and overlap with the
$Ra_c=502\varGamma ^{-4.0}$
scaling without a magnetic field. The transitional value of aspect ratio
$\varGamma_{c_1}$
to the
$\varGamma ^{-4}$
scaling without a magnetic field depends strongly on
$\textit{Ha}_z$
. To determine the relation between
$\varGamma _{c_1}$
and
$\textit{Ha}_z$
, we locate the data point where the
$Ra_c(\textit{Ha}_z)$
curves for different
$\textit{Ha}_z$
approach the
$\textit{Ha}_z=0$
curve with
$0.99Ra_c(\textit{Ha}_z)=Ra_c(\textit{Ha}_z=0)$
. These data are denoted as
$\varGamma _{c_1}$
and shown as squares in figures 3 and 7. From figure 7, it can be seen that these data can be fitted by a power law, i.e.
$\varGamma _{c_1}=0.83\textit{Ha}_z^{-0.50}$
. Thus, for a given
$\textit{Ha}_z$
, if
$\varGamma \lt \varGamma _{c_1}$
, the onset of convection is determined by the spatial confinement with
$Ra_c=502\varGamma ^{-4.0}$
. Note that the scaling exponent varies in the range from −0.51 to −0.50 when the above threshold varies in the range of 0.95–0.99. Thus, it is insensitive to the value of this threshold chosen.
In the large
$\varGamma$
limit, one observes that once
$\varGamma$
is larger than an
$\textit{Ha}_z$
-dependent threshold
$\varGamma _{c_2}$
,
$Ra_c$
becomes almost independent of
$\varGamma$
, namely,
$Ra_c \sim \varGamma ^0$
with its prefactor increasing with
$\textit{Ha}_z$
. This observation suggests that for large
$\varGamma$
,
$Ra_c$
depends solely on
$\textit{Ha}_z$
. To determine the dependence of
$\varGamma _{c_2}$
on
$\textit{Ha}_z$
, we compare
$Ra_c$
obtained from the present study with geometrical confinement and that in periodic boundary conditions in the horizontal directions, where the effect of spatial confinement is absent. Following Chandrasekhar (Reference Chandrasekhar1952), the marginal stability curve for the onset of convection in a periodic horizontal boundary condition system is given by solving
\begin{align} Ra &=\frac {\big(\pi ^2+a^2\big) \big[\big(\pi ^2+a^2\big)^2+\pi ^2\textit{Ha}^2 \big] }{a^2\left [1-4\pi ^2\delta \left (q_1^2-q_2^2\right )\kern-1pt/\kern-1pt\left (\pi ^2+q_1^2\right )\kern-1pt/\kern-1pt\left (\pi ^2+q_2^2\right ) \right ] }, \end{align}
Figure 4(a) shows the marginal stability curve as a function of wavelength
$a$
for different
$\textit{Ha}_z$
in the periodic setting. Considering the relation between
$a$
and the aspect ratio of a single-roll structure
$\varGamma _r$
, i.e.
$a=\pi /\varGamma _r$
, we can convert the curves in figure 4(a) into a plot of
$Ra$
versus
$\varGamma _r$
. Note,
$\varGamma _r$
is the aspect ratio of the convection roll that forms without the influence of the geometrical confinement. The critical Rayleigh number
$Ra_c$
and the aspect ratio of the roll structure
$\varGamma _r$
for different
$\textit{Ha}_z$
are given by locating the minimum point of the curves, i.e. the circles in figure 4(b). The so-determined
$Ra_c$
versus
$\varGamma _r$
is plotted as triangles in figure 3. When the aspect ratio of the convection cell
$\varGamma$
is larger than that of the roll structure
$\varGamma _r$
, one then expects that the confinement effect is weak. In this case, the onset of convection is mainly determined by the magnetic field. Otherwise, when
$\varGamma \lt \varGamma _r$
, one would expect the confinement induced by the convection cell will alter the structure of the flow. The critical condition is given by
$\varGamma =\varGamma _r$
. The corresponding
$\varGamma _r$
versus
$\textit{Ha}_z$
is also plotted as triangles in figure 7. To establish an analytical relation between
$Ra_c$
and
$\varGamma _r$
, we consider the asymptotic relations between
$Ra_c$
,
$a$
and
$\textit{Ha}$
, i.e. (1.2) and (1.3). After replacing
$\textit{Ha}$
in (1.2) with
$a$
and considering
$a=\pi /\varGamma _r$
, we obtain an asymptotic relation between
$Ra_c$
and
$\varGamma _r$
, i.e.
$Ra_c = 2\pi ^4\varGamma _r^{-6}$
. Then, the critical condition is given by replacing
$\varGamma _r$
with
$\varGamma$
, i.e.
The above-mentioned relation is plotted as a dash-dot-dotted line in figure 3. It is seen that for
$\textit{Ha}_z \gt 100$
, the
$Ra_c$
obtained from the present LSA, from Chandrasekhar (Reference Chandrasekhar1952) with horizontally periodic and top/bottom no-slip boundaries, and from the asymptotic relation given by (3.7) agree with each other. When
$\varGamma$
is larger than that depicted by the dashed line, the aspect ratio of the cell
$\varGamma$
will be larger than that of a single circulation roll, suggesting that the effects of spatial confinement on the onset of convection can be ignored. Note that combining (3.7) and (1.3), one obtains a relation between the critical aspect ratio
$\varGamma _{c_2}$
of the cell and
$\textit{Ha}_z$
, i.e.
This relation is plotted as a black solid line in figure 7. It can be seen that even for
$\textit{Ha}_z \lt 100$
, it agrees well with those obtained in the horizontally periodic layer with top/bottom no-slip boundaries, denoted by triangles. This observation indicates that, although the asymptotic relation derived from the horizontally periodic layer with top/bottom free-slip boundaries underestimates the onset
$Ra_c$
when
$\textit{Ha}_z \lt 100$
for the no-slip case, as shown in figure 3, it can still provide a good estimate of the most unstable mode.
(a) Marginal stability curve in a convection cell with periodic horizontal boundary conditions for different
$\textit{Ha}_z$
obtained from Chandrasekhar (Reference Chandrasekhar1952). Here,
$a$
is the wavelength. (b) Lines are the same as those in panel (a) with the horizontal axis changed from
$a$
to the aspect ratio of a single-roll structure
$\varGamma_r$
using
$a=\pi/\varGamma_r$
, and the circles represent the
$Ra_c$
(minimum value of the curve for a given
$\textit{Ha}_z$
) and corresponding
$\varGamma _r$
.

To gain a better understanding of why the
$Ra_c$
will become independent of
$\varGamma$
, we study the flow pattern at the onset of convection obtained from LSA at
$\textit{Ha}_z=300$
and various
$\varGamma$
. The results are shown in figure 5. The lines with arrows in the figure represent the streamlines and the colour represents the normalised kinetic energy of the flow, i.e.
$E(x,z)/\max (E(x,z))$
with
$E(x,z)=u^2(x,z)+w^2(x,z)$
. The critical aspect ratio that separates the region where spatial confinement plays a role in determining
$Ra_c$
and the region where
$Ra_c$
is determined mainly by the magnetic field strength can be obtained from (3.8), i.e.
$\varGamma _r=0.2456\approx 1/4$
for
$\textit{Ha}_z=300$
. Figure 5(a) shows the flow pattern in a cell with
$\varGamma =1/5$
, which is smaller than
$\varGamma _r$
. One observes a single elongated vertical convection cell. When
$\varGamma =2\times \varGamma _r=1/2$
, one would expect two rolls aligned horizontally. This is indeed the case as shown in figure 5(b). Thus, the effects of sidewall confinement in this case will become very weak. When
$\varGamma =1$
, we observe four horizontally aligned roll structures (see figure 5c). In this case,
$Ra_c$
will be mainly determined by the magnetic field strength. The above-mentioned observation holds for all
$\textit{Ha}_z$
studied in the present paper. It suggests that the horizontal length scale
$\ell$
of the flow will become smaller with increasing
$\textit{Ha}_z$
. Once
$\ell$
is smaller than the width
$D$
of the convection cell, the effect of the spatial confinement on
$Ra_c$
will be largely reduced. A stronger
$\textit{Ha}_z$
results in a smaller
$\ell$
compared with the cell width
$D$
. In this case, one would expect that the
$Ra_c$
will be solely determined by the strength of the magnetic field. For a detailed discussion on the horizontal length scale
$\ell$
, we refer to § 3.2.2.
Flow pattern at the onset of convection for
$\textit{Ha}_z=300$
in a cell with (a)
$\varGamma =1/5$
and the number of rolls being
$n=1$
; (b)
$\varGamma =1/2$
and
$n=2$
; (c)
$\varGamma =1$
and
$n=4$
. The lines with arrows represent the streamlines. The colour represents the normalised kinetic energy of the flow, i.e.
$E(x,z)/\kern-1pt\max (E(x,z))$
with
$E(x,z)=u^2(x,z)+w^2(x,z)$
. Note that the flow patterns shown in the remainder of the paper all follow the same style.

For a fixed value of the aspect ratio
$\varGamma$
, what is the relation between
$Ra_c$
and
$\textit{Ha}_z$
? Figure 6 shows the dependence of
$Ra_c$
on
$\textit{Ha}_z$
for five values of
$\varGamma$
. The
$\textit{Ha}_z$
varies in the range from
$10^{-1}$
, where there is no effect of the magnetic field on
$Ra_c$
, to
$10^5$
, where one would expect a very strong suppression effect. For a given
$\varGamma$
, it can be seen that
$Ra_c$
first remains a constant in the small
$\textit{Ha}_z$
region. This corresponds to the region where
$Ra_c$
is solely determined by
$\varGamma$
. Note this constant decreases with
$\varGamma$
. The
$Ra_c$
then increases with
$\textit{Ha}_z$
beyond a
$\varGamma $
-dependent threshold
$\textit{Ha}_z$
. For large enough
$\textit{Ha}_z$
, the
$Ra_c$
for different
$\varGamma$
collapse on top of each other and with the asymptotic relation, i.e.
$Ra_c=\pi ^2\textit{Ha}_z^2$
, suggesting that the effect of geometrical confinement becomes negligible and
$Ra_c$
is solely determined by
$\textit{Ha}_z$
.
$Ra_c$
versus
$\textit{Ha}_z$
for different
$\varGamma$
. The dashed line represents the asymptotic relation, cf. (1.2). The horizontal dash-dotted line marks
$Ra_c=1708$
.

We are now in a position to draw a phase diagram of the dominant factors that determine
$Ra_c$
. The result is shown in figure 7 in the
$\varGamma {-}\textit{Ha}_z$
parameter space. On the one hand, when
$\varGamma$
is smaller than the red line, i.e.
$\varGamma =0.83\textit{Ha}_z^{-0.5}$
,
$Ra_c$
is independent of
$\textit{Ha}_z$
and is determined solely by the geometrical confinement, i.e.
$Ra_c=502\varGamma ^{-4}$
. On the other hand, when
$\varGamma$
is larger than the black dashed line, i.e.
$\varGamma =2^{1/6}\pi ^{1/3}\textit{Ha}_z^{-1/3}$
,
$Ra_c$
is independent of
$\varGamma$
and is determined solely by the strength of the magnetic field. When
$\varGamma$
is in the region between the red solid line and the black dashed line,
$Ra_c$
depends on both the geometrical confinement and magnetic field strength. The critical Rayleigh number
$Ra_c$
and the number of rolls
$n$
for several representative values of
$\varGamma$
and
$\textit{Ha}_z$
are listed in table 2.
Phase diagram showing the dominating factors that determine the onset of convection with a vertical magnetic field. Regime I (blue area) represent the region where
$Ra_c$
is mainly determined by geometrical confinement; Regime III (purple area) represents the region where
$Ra_c$
is mainly determined by the Lorentz force. Regime II (orange area) represents the region where the geometrical confinement and magnetic confinement are coupled together in determining
$Ra_c$
. The squares are data points with
$0.99Ra_c(\textit{Ha}_z)=Ra_c(\textit{Ha}_z=0)$
. The triangles represent the
$\varGamma$
corresponding to the single-roll structure of the most unstable mode for a given
$\textit{Ha}_z$
in the horizontally periodic layer with top/bottom no-slip boundaries. The red solid line separating regimes I and II is a power-law fit to the squares with
$\varGamma _{c_1}=0.83\textit{Ha}_z^{-0.50}$
. The black solid line separating regimes II and III is
$\varGamma _{c_2} = 2^{1/6} \pi ^{1/3} \textit{Ha}_z^{-1/3}$
.

3.2.2. Length scale of the flow at the onset of convection
We now study the horizontal length scale
$\ell$
of the flow in the presence of a vertical magnetic field. We first look at an example in a cell with
$\varGamma =2$
. Figure 8 shows the onset pattern and the number of the horizontally aligned rolls
$n$
for different
$\textit{Ha}_z$
. For
$\textit{Ha}_z = 0$
, the onset pattern of classical RBC is observed with
$n=2$
. The number of rolls increases as
$\textit{Ha}_z$
increases, i.e.
$n=3$
for
$\textit{Ha}_z=30$
and
$n=12$
for
$\textit{Ha}_z=1000$
, suggesting that the flow will organise into smaller structures with increasing strength of the vertical magnetic field. Moreover, for an individual roll structure, while its kinetic energy in the vertical direction becomes dominant, its kinetic energy in the horizontal direction is significantly suppressed with increasing
$\textit{Ha}_z$
. This can be understood from the governing equation, cf. (2.10), which shows that the Lorentz force induced by a vertical magnetic field reduces the velocity in the
$x$
-direction.
Flow pattern at the onset of convection in a cell with
$\varGamma =2$
and for (a)
$\textit{Ha}_z=0$
and the number of rolls being
$n=2$
; (b)
$\textit{Ha}_z=30$
and
$n=3$
; (c)
$\textit{Ha}_z=100$
and
$n=5$
; (d)
$\textit{Ha}_z=1000$
and
$n=12$
. For each panel, the lines with arrows represent streamlines and the colour represents the normalised kinetic energy.

Summary of LSA results for the critical Rayleigh number
$Ra_c$
and the number of rolls
$n$
, evaluated at representative Hartmann numbers
$\textit{Ha}_z$
and aspect ratios
$\varGamma$
. In each data entry, the first value denotes
$Ra_c$
and the second value denotes
$n$
.

To study the length scale systematically as a function of
$\textit{Ha}_z$
and
$\varGamma$
, we show in figure 9(a) the number of rolls as a function of
$\textit{Ha}_z$
with
$\varGamma$
varying in the range from
$1/3$
to 2. Similar to the demonstration shown in figure 8, the number of rolls increases with
$\textit{Ha}_z$
for a fixed value of
$\varGamma$
and it increases with
$\varGamma$
for a fixed value of
$\textit{Ha}_z$
. To compare with the length scale from classical LSA theory with the horizontally periodic boundary condition (Chandrasekhar Reference Chandrasekhar1952), i.e.
$a=2^{-1/6}\pi ^{2/3}\textit{Ha}_z^{1/3}$
, we convert the number of rolls
$n$
into the wavenumber using the relation
$a=n\pi /D$
. The so-obtained
$a$
versus
$\textit{Ha}_z$
is shown in figure 9(b). Similar to the behaviour of
$Ra_c$
shown in figure 3, the data show that, for large enough
$\textit{Ha}_z$
, the wavenumbers all collapse on top of each other and on the theoretical prediction with the horizontally periodic boundary condition. Note that the asymptotic relation between the wavelength and
$\textit{Ha}_z$
has been verified in a 2-D domain with periodic lateral boundary conditions by Bader & Zhu (Reference Bader and Zhu2023). The present finding suggests that it also holds in domains with no-slip boundary conditions due to
$\ell \ll D$
in a strong vertical magnetic field.
(a) Number of rolls
$n$
as a function of
$\textit{Ha}_z$
for different
$\varGamma$
. (b) Wavenumber
$a$
calculated from the number of rolls in panel (a) using
$n \pi / \varGamma$
as a function of
$\textit{Ha}_z$
for different
$\varGamma$
. The dashed line represents the asymptotic relation, cf. (1.3).

3.3. Case with
$\boldsymbol{B}=B\hat {\boldsymbol{e}}_{\boldsymbol{x}}$
3.3.1. Onset Rayleigh number
$Ra_c$
In this section, we study how a horizontal magnetic field in the
$x$
-direction affects the onset of convection in confined geometries. The strength of the magnetic field is characterised by
$\textit{Ha}_x=\textit{BH}\sqrt {{\sigma }/{\rho \nu }}$
. Figure 10 shows the critical Rayleigh number
$Ra_c$
for the onset of convection as a function of
$\varGamma$
for different
$\textit{Ha}_x$
. In addition, the
$Ra_c$
without a magnetic field (i.e.
$Ra_c = 502\,\varGamma ^{-4.0}$
) is plotted as a dashed line, and the DNS results obtained at
$\textit{Ha}_x = 100$
and
$\textit{Ha}_x = 1000$
are plotted as circles. It is seen that
$Ra_c$
obtained from the DNS agrees well with that from the LSA.
$Ra_c$
versus
$\varGamma$
for different
$\textit{Ha}_x$
. The solid lines represent the LSA results, and the circles denote the DNS results at
$\textit{Ha}_x = 100$
and
$1000$
. The dashed line and the horizontal dash-dotted line are the same as those in figure 2(b). The black solid line marks
$Ra_c\sim \varGamma ^{-2}$
.

In the small
$\varGamma$
limit, similar to the case with
$\textit{Ha}_z$
, all
$Ra_c$
versus
$\varGamma$
curves for different
$\textit{Ha}_x$
collapse on top of each other and agree with the curve where
$Ra_c$
is determined by geometrical confinement. To determine the transitional aspect ratio
$\varGamma _{c_3}$
when the curves collapse, we used a similar method as in the case with vertical magnetic field, i.e. we locate the point where
$Ra_c(\textit{Ha}_x)$
curve for different
$\textit{Ha}_x$
approaches the
$\textit{Ha}_x=0$
curve with
$0.99Ra_c(\textit{Ha}_x)=Ra_c(\textit{Ha}_x=0)$
. The so-determined
$\varGamma _{c_3}$
versus
$\textit{Ha}_x$
is plotted in figure 14 as squares. The data can be fitted by a power law, i.e.
$\varGamma _{c_3}=0.66\textit{Ha}_x^{-1.01}$
. Thus, for a given
$\textit{Ha}_x$
, if
$\varGamma \lt \varGamma _{c_3}$
, the onset of convection is mainly determined by the geometrical confinement. The scaling exponent varies in the range from −1.01 to −1.00 when the above threshold varies in the range of 0.95–0.99. Thus, it is also insensitive to the value of this threshold chosen.
In the large
$\varGamma$
limit, one sees that
$Ra_c$
increases with
$\textit{Ha}_x$
and it will become independent of
$\varGamma$
for sufficiently large
$\varGamma$
. To determine this critical
$\varGamma$
, we examine the relation between
$Ra_c$
and
$\textit{Ha}_x$
for several representative
$\varGamma$
, which are shown as examples in figure 11(a). The figure shows that for a given
$\varGamma$
,
$Ra_c$
first remains a constant as
$\textit{Ha}_x$
increases. It then reached the asymptotic scaling with
$Ra_c=S\textit{Ha}_x^2$
, with the pre-factor
$S$
that depends strongly on
$\varGamma$
. Figure 11(b) plots
$S$
as a function of
$\varGamma$
, consisting of several hundred logarithmically evenly spaced points to ensure smoothness. When
$\varGamma \leqslant 1/10$
, a power law fits the data well, i.e.
$S=9.9\varGamma ^{-2.0}$
. It indicates that there exists a regime in which
$Ra_c$
can be fitted as
$Ra_c = 9.9\varGamma ^{-2.0} \textit{Ha}_x^2$
. In addition, the value of
$S$
will approach the asymptotic value of
$\pi ^2$
with increasing
$\varGamma$
, suggesting that the effect of spatial confinement on the system will be diminishing. When
$\varGamma =5$
,
$S$
is approximately 95 % of the value for the case with periodic boundary conditions in the horizontal direction, i.e.
$\pi ^2$
. We thus use
$\varGamma _{c_4}\geqslant 5$
as a criterion for the case when the
$Ra_c$
is mainly determined by the magnetic field strength.
(a)
$Ra_c$
versus
$\textit{Ha}_x$
for different
$\varGamma$
shown by the solid lines. For a given
$\varGamma$
and sufficiently large
$\textit{Ha}_x$
, the data can be fitted by a power law, i.e.
$Ra_c=S\textit{Ha}^2$
with the dependence of the prefactor
$S$
on
$\varGamma$
shown in panel (b). The dashed line in panel (a) represents the asymptotic relation, cf. (1.3) and the horizontal dash-dotted line marks
$Ra_c=1708$
. (b) Prefactor
$S$
versus
$\varGamma$
. The dash-dotted line marks the asymptotic value of
$\pi ^2$
and the dashed line marks a fitting to the data, giving
$S=9.9\varGamma ^{-2.0}$
.

When
$\varGamma$
is in the intermediate region, i.e.
$\varGamma _{c_3}\lt \varGamma \lt \varGamma _{c_4}$
, the onset of convection depends on both the strength of spatial confinement and magnetic confinement. An interesting observation from figure 10 is the appearance of a new scaling region with
$Ra_c\sim \varGamma ^{-2}$
. Its range extends with increasing
$\textit{Ha}_x$
, which can be seen more clearly from figure 12, where we show a compensated plot of
$Ra_c\varGamma ^{2}$
as a function of
$\varGamma$
.
(a) Compensated plot of
$Ra_c$
versus
$\varGamma ^{-2}$
. The up-pointing triangle marks the left boundary of the
$Ra_c=K\kern-1pt\varGamma ^{-2}$
scaling region, while the down-pointing triangle marks the right boundary. The squares are data points with
$0.99Ra_c(\textit{Ha}_x)=Ra_c(\textit{Ha}_x=0)$
. (b) Prefactor
$K$
versus
$\textit{Ha}_x$
. For
$\textit{Ha}_x\gt 30$
, the data can be fitted by a power law, i.e.
$K=12.2\textit{Ha}_x^{1.98}$
.

To quantify the region with the new
$Ra_c\sim \varGamma ^{-2}$
scaling for a given
$\textit{Ha}_x$
, we locate the two points where
$0.95\varGamma ^2 Ra_c={(\varGamma ^2Ra_{c})}_{min }$
as marked by the triangles in figure 12. Here,
$(\varGamma ^2Ra_{c})_{min }$
is the minimum value of the compensated critical Rayleigh number for the onset of convection. The so-determined upper and lower boundaries of the
$Ra_c\sim \varGamma ^{-2}$
region are shown as down-pointing triangles and up-pointing triangles in figure 14, respectively. The data can be fitted by two power laws, i.e.
$\varGamma =1.35\textit{Ha}_x^{-0.23}$
for the upper boundary (down-pointing triangles) and
$\varGamma =1.71\textit{Ha}_x^{-0.48}$
for the lower boundary (up-pointing triangles). It should also be noted that the prefactor
$K$
of the
$Ra_c\sim \varGamma ^{-2}$
scaling region increases with
$\textit{Ha}_x$
. To find the relation between
$K$
and
$\textit{Ha}_x$
, we show in figure 12(b)
$K$
as a function of
$\textit{Ha}_x$
. The data for
$\textit{Ha}_x\geqslant 30$
can be fitted by a power law with
$K=(12.2\pm 0.6)\textit{Ha}_x^{1.98\pm 0.02}$
. Thus, the dependence of
$Ra_c$
on
$\textit{Ha}_x$
and
$\varGamma$
in this region can be written as
$Ra_c=12.2\textit{Ha}_x^{1.98}\varGamma ^{-2}$
.
We obtained similar
$Ra_c$
scaling laws from the fittings in figures 11(b) and 12(b), namely
$Ra_c = 9.9\varGamma ^{-2.0} \textit{Ha}_x^2$
and
$Ra_c=12.2\textit{Ha}_x^{1.98}\varGamma ^{-2}$
, respectively. These results agree well with the asymptotic scaling, i.e.
$\varGamma ^{-2}\textit{Ha}_x^2$
, which will be derived in § 3.3.3. Figures 11(b) and 12(b) essentially correspond to fittings of the same
$Ra_c$
scaling, with the former obtained by fixing
$\textit{Ha}_x^2$
and the latter by fixing
$\varGamma ^{-2}$
. Considering that the fitting in figure 11(b) is based on more data points and is therefore expected to be more accurate, we adopt the fitting result from figure 11(b) as the representative scaling for this intermediate regime, namely
$Ra_c=9.9\varGamma ^{-2.0}\textit{Ha}_x^2$
.
To check the difference between the
$\varGamma ^{-2}\textit{Ha}_x^2$
scaling induced by the horizontal magnetic field and that without a magnetic field, we compare the onset patterns for
$\textit{Ha}_x = 0$
and
$\textit{Ha}_x = 1000$
in a cell with
$\varGamma =1/5$
. Note the data with
$\textit{Ha}_x = 1000$
is within the
$\varGamma ^{-2}\textit{Ha}_x^2$
scaling region. Figure 13(a) shows the onset pattern for
$\textit{Ha}_x=0$
. The streamlines are marked by black lines with arrows, and the magnitude of the normalised kinetic energy is colour-coded. A classic single-roll structure with its maximum kinetic energy concentrated away from the sidewall can be observed. However, in the case with
$\textit{Ha}_x=1000$
, the flow pattern changes. Although the flow is in a single-roll form, its maximum kinetic energy is concentrated in the vicinity of the sidewalls. This can be seen more clearly from the horizontal velocity profile of the normalised vertical velocity
$w^*=w/\max (w)$
at the mid-height of the cell, as shown in figure 13(c). Here,
$\max (w)$
is the maximum velocity of the profile. Compared with the case of
$\textit{Ha}_x=0$
, where the velocity is peaked at
$x=-0.055$
, the velocity profile is peaked at
$x=-0.093$
for the case with
$\textit{Ha}_x=1000$
. The boundary layer-like shape of the velocity profile at the onset of convection indicates that many more grids are needed to resolve the flow near the sidewall in the direct numerical simulation of magnetoconvection with a horizontally applied magnetic field.
Flow patterns at the onset of convection in a cell with
$\varGamma =1/5$
for (a)
$\textit{Ha}_x=0$
, (b)
$\textit{Ha}_x=1000$
. The black lines with arrows represent streamlines and the colour represents the normalised kinetic energy. (c) Horizontal profiles of normalised vertical velocity
$w^*$
at
$z = 1/2$
for the two patterns in (a,b), where
$w^* = w / \max (w)$
.

We can now outline a phase diagram for the dominant factors that determine the onset of convection in the presence of
$B\hat {\boldsymbol{e}}_{\boldsymbol{x}}$
. The result is summarised in figure 14 in the
$\varGamma {-}\textit{Ha}_x$
parameter space. When
$\varGamma$
is smaller than the red solid line, i.e.
$\varGamma _{c_3}=0.66\textit{Ha}_x^{-1.01}$
,
$Ra_c$
is independent of
$\textit{Ha}_x$
and is determined solely by the geometrical confinement with
$Ra_c=502\varGamma ^{-4.0}$
. When
$\varGamma \geqslant \varGamma _{c_4}$
(the black solid line),
$Ra_c$
is independent of
$\varGamma$
and is determined by the strength of the applied horizontal magnetic field, i.e.
$Ra_c=\pi ^2\textit{Ha}_x^2$
. When
$\varGamma$
is in the region between the red and black lines,
$Ra_c$
depends on the strength of both the geometrical and magnetic confinements. It should be noted that a new scaling relation for
$Ra_c$
exists in the region between the two dashed lines, i.e.
$Ra_c=9.9\varGamma ^{-2.0}\textit{Ha}_x^{2}$
. Lastly, comparing
$Ra_c$
in regime II with a vertical magnetic field and that in regime II with a horizontal magnetic field, one finds that the suppression of convection with a horizontal magnetic field is stronger than that of a vertical magnetic field. For example, in a cell with
$\varGamma =1$
and
$\textit{Ha}_x=1000$
, we have
$Ra_c=1.99\times 10^7$
, while
$Ra_c=1.04\times 10^7$
in the same cell for the vertical magnetic field. This discovery highlights the importance of the direction of the magnetic field again. The critical Rayleigh number
$Ra_c$
and the number of rolls
$n$
for several representative values of
$\varGamma$
and
$\textit{Ha}_x$
are listed in table 3.
Phase diagram showing the dominating factors that determine the onset of convection with a horizontal magnetic field. Regime I (blue area) represents the region where
$Ra_c$
is mainly determined by geometrical confinement; Regime III (purple area) represents the region where
$Ra_c$
is mainly determined by the Lorentz force. Regime II (orange area) represents the region where the geometrical confinement and magnetic confinement are coupled together in determining
$Ra_c$
. The squares are data points with
$0.99Ra_c(\textit{Ha}_z)=Ra_c(\textit{Ha}_z=0)$
. The red solid line separating regimes I and II is a power law fit to the squares with
$\varGamma_{c_3}=0.66Ha_x^{-1.01}$
. The black solid line separating regimes II and III is
$\varGamma _{c_4} = 5$
. The boundaries of the regime with
$Ra_c=9.9\varGamma ^{-2.0}\textit{Ha}_x^{2}$
is marked by the triangles.

Summary of LSA results for the critical Rayleigh number
$Ra_c$
and the number of rolls
$n$
, evaluated at representative Hartmann numbers
$\textit{Ha}_x$
and aspect ratios
$\varGamma$
. In each data entry, the first value denotes
$Ra_c$
and the second value denotes
$n$
.

3.3.2. Length scale of the flow at the onset of convection
In this subsection, we study the horizontal length scale
$\ell$
of the flow for the onset of convection with
$B\hat {\boldsymbol{e}}_{\boldsymbol{x}}$
. Figure 15 shows the flow patterns obtained from the present LSA in a cell with
$\varGamma = 2$
for
$\textit{Ha}_x = 0, 30, 100, 1000$
. It is seen that with increasing
$\textit{Ha}_x$
, the two-roll structure observed, where there is no magnetic field, changes into a single-roll structure at
$\textit{Ha}_x=30$
. With further increases in
$\textit{Ha}_x$
, this single-roll structure preserves, but its velocity distribution changes, i.e. the maximum velocity shifts more closely to the top and bottom boundaries with increasing
$\textit{Ha}_x$
.
Flow pattern at the onset of convection in a cell with
$\varGamma =2$
and for (a)
$\textit{Ha}_x=0$
and the number of rolls being
$n=2$
; (b)
$\textit{Ha}_x=30$
and
$n=1$
; (c)
$\textit{Ha}_x=100$
and
$n=1$
; (d)
$\textit{Ha}_x=1000$
and
$n=1$
. For each panel, the lines with arrows represent streamlines and the colour represents the normalised kinetic energy.

Comparing the case with the vertical magnetic field shown in figure 8 and the horizontal magnetic field, one sees that their effects on the horizontal length scale of the flow are dramatically different. While the vertical magnetic field will result in smaller length scales, the horizontal magnetic field promotes the stability of the single-roll structure. This difference may be due to the direction of the Lorentz force. With a horizontal magnetic field in the
$x$
-direction, the Lorentz force, given by
$-Pr\textit{Ha}_x^2 w \hat {\boldsymbol{e}}_z$
in (2.9), opposes the vertical velocity. Thereby, it suppresses the up and down motion of the flow in the bulk. As a result, under the horizontal magnetic field, the horizontal kinetic energy becomes dominant, as shown in figure 15, leading to the formation of an extended single-roll structure.
The critical aspect ratio
$\varGamma ^*$
for the transition from the multiple horizontally aligned roll structure to the single-roll structure as a function of
$\textit{Ha}_x$
is identified and plotted in figure 16. For sufficiently large
$\textit{Ha}_x$
, i.e.
$\textit{Ha}_x\gt 30$
, the data can be fitted by a power law, i.e.
$\varGamma ^*=0.62\textit{Ha}_x^{0.47}$
. For a given
$\textit{Ha}_x$
, when
$\varGamma$
is smaller than
$\varGamma ^*$
, the onset pattern is in the form of a single-roll structure. Thus, the horizontal length scale of the flow will be the width
$D$
of the domain.
Critical aspect ratio
$\varGamma ^*$
for the transition between double-roll structure and single-roll structure as a function of
$\textit{Ha}_x$
. For
$\textit{Ha}_x \ge 30$
, the data can be fitted by a power law shown as the solid line, i.e.
$\varGamma ^* = 0.62 \textit{Ha}_x^{0.47}$
.

We remark that the length scale of the flow at the onset of convection depends on the strength of spatial confinement, the direction and the strength of the magnetic field. The findings shown in figures 9 and 16 may serve as a non-contact method for actively controlling the large-scale structures of thermal convection near the onset.
3.3.3. An explanation of the
$\varGamma ^{-2}\textit{Ha}_x^2$
scaling regime
In this subsection, we provide an explanation of the
$\varGamma ^{-2}\textit{Ha}_x^2$
scaling. This new scaling relation only appears under horizontal magnetic fields (
$x$
-direction). It may not be possible to obtain an analytical expression for a system with complex boundary conditions. Therefore, we turn to analyse a similar system, namely a horizontally infinite layer with top and bottom free-slip boundaries, while following the same governing equations, i.e. (2.11)–(2.13). It is expected that when a system reaches the asymptotic regime, the influence of the boundary conditions will become negligible, i.e. the boundary conditions are not expected to affect the scaling exponent in the asymptotic regime. For example, in the case with vertical magnetic fields, where the analytical asymptotic solution
$Ra_c = \pi ^2 \textit{Ha}_z^2$
obtained for top and bottom free-slip boundaries is also applicable to the no-slip case when
$\textit{Ha}_z$
is sufficiently large (Chandrasekhar Reference Chandrasekhar1952).
We assume the horizontal dependence to be of the form
$\exp (-\textrm{i}{\kern0.75pt}ax)$
, where
$i$
is the imaginary unit and
$a$
is the horizontal wavenumber. Thus, we rewrite the variables as
By substituting (3.9) into (2.11)–(2.13), we obtain
\begin{equation} \left ( \begin{matrix} {\textrm d}_z^2-a^2 & 0 & ia & 0 \\ 0 & {\textrm d}_z^2-a^2-\textit{Ha}_x^2 & -{\textrm d}_z & Ra \\ 0 & 1 & 0 & {\textrm d}_z^2-a^2 \\ -ia & {\textrm d}_z & 0 & 0 \end{matrix} \right ) \left ( \begin{matrix} \tilde {u} \\ \tilde {w} \\ \tilde {p} \\ \tilde {T} \end{matrix} \right ) =0, \end{equation}
where
${\textrm d}_z={\textrm d}/{\textrm d}z$
. The variables
$\tilde {u}$
,
$\tilde {p}$
and
$\tilde {T}$
can be eliminated from (3.10), yielding
\begin{equation} \left( \frac {{\textrm d}_z^2\left({\textrm d}_z^2-a^2\right)}{a^2}-\left({\textrm d}_z^2-a^2\right)+\textit{Ha}_x^2+\frac {Ra}{{\textrm d}_z^2-a^2} \right )\tilde {w}=0 . \end{equation}
Referring to Chandrasekhar (Reference Chandrasekhar1952), for the case with top and bottom free-slip boundaries, it is convenient to define the boundaries at
$z=0$
and 1 (note that
$z$
ranges from −0.5 to 0.5 in other parts of this paper), and then
$\tilde {w}(z)$
can be expressed as
\begin{equation} \tilde {w} = \sum _{n = 1}^{\infty } \sin (n\pi z), \end{equation}
which forms a set of basis functions that satisfy the boundary conditions. Only the lowest mode (
$n = 1$
), which is the most unstable, needs to be considered. We then substitute
$\tilde {w} = \sin (\pi z)$
into (3.11) directly and obtain
Combining figures 14 and 16, it can be seen that when
$\textit{Ha}_x \gtrsim 100$
, the flow is always in a single-roll state in both the geometry-dominated regime and the coupled-dominated regime, which includes the
$\varGamma ^{-2}\textit{Ha}_x^2$
regime. Therefore, the aspect ratio of a single-roll structure
$\varGamma _r$
is equal to the aspect ratio of the cell
$\varGamma$
. Considering the relation between the horizontal wavenumber
$a$
and the aspect ratio of a single-roll structure, i.e.
$a = \pi / \varGamma _r$
, (3.13) becomes
First, one can observe that when the geometrical confinement is strong, i.e.
$\varGamma$
is sufficiently small such that
$\varGamma ^{-2} \gg 1$
, and the term
$\pi ^2 (1 + \varGamma ^{-2})$
dominates in the square brackets in (3.14), this leads to
which agrees well with the scaling observed in the geometry-dominated regime.
Second, when the magnetic field is sufficiently strong so that the
$\textit{Ha}_x^2$
term dominates in the square brackets in (3.14), while the geometrical confinement is weak, i.e.
$\varGamma ^{-2} \lesssim 1$
, this leads to
which agrees well with the scaling observed in the Lorentz-force-dominated regime. The
$\textit{Ha}_x^2$
scaling can also be directly inferred from (3.13), which does not necessarily require
$\varGamma = \varGamma _r$
.
Finally, an intermediate asymptotic relation can be observed, which lies between the two asymptotic regimes discussed above. Specifically, when
$\textit{Ha}_x$
is sufficiently large such that the
$\textit{Ha}_x^2$
term again dominates in the square brackets in (3.14), while the geometrical confinement is still not negligible, i.e. it still satisfies
$\varGamma ^{-2} \gg 1$
, but does not dominate in the square brackets in (3.14), we obtain
which agrees well with the fitted scaling shown in figures 11(b) and 12(b). Furthermore, from (3.14), the prefactor can even be directly obtained as
$Ra_c\approx \pi ^2\varGamma ^{-2}\textit{Ha}_x^2$
, which is very close to the fitted result from figure 11(b), namely
$Ra_c = 9.9\varGamma ^{-2.0}\textit{Ha}_x^{2}$
.
For the case with a vertical magnetic field, Chandrasekhar (Reference Chandrasekhar1952) has already provided the derivation, as shown in (1.1). Following the same reasoning, it can be directly seen from (1.1) that only two asymptotic relations exist: when the geometrical confinement is dominant,
$Ra_c \sim \varGamma ^{-4}$
; and when the magnetic field is dominant,
$Ra_c \sim \textit{Ha}_z^2$
. Therefore, the
$\varGamma ^{-2}\textit{Ha}^2$
regime is a special feature that only exists under horizontal magnetic fields.
4. Conclusion
We have studied the onset of bulk convection in confined two-dimensional magnetoconvection systems systematically using linear stability analysis and direct numerical simulation. In the Cartesian coordinates, the convection domain lies in the
$x{-}z$
plane with
$y=0$
. The direction and strength of the magnetic field (the strength of the magnetic field is characterised by the Hartmann number
$\textit{Ha}$
) as well as the aspect ratio
$\varGamma$
of the convection domain are considered. All the walls satisfy the no-slip and no-penetration velocity boundary condition. For the temperature boundary condition, while the top and bottom walls are held at constant temperature, the two sidewalls are held adiabatic. To simplify the analysis, we employed the low-Rm quasi-static approximation, which is true in conventional fluids like liquid metal. In this case, the exchange of stability holds, namely, the onset of convection is steady.
We first showed that when the applied magnetic field is perpendicular to the convection domain, i.e. in the
$y$
-direction, the resulting Lorentz force is always zero. This suggests that the magnetic field strength does not affect the onset of convection.
With the presence of a magnetic field in the vertical direction (
$z$
-direction) or horizontal direction (
$x$
-direction), the onset of convection is delayed, resulting in a larger critical Rayleigh number
$Ra_c$
for the onset of convection compared with the case of no magnetic field. In the regime where the magnetic field and spatial confinements act together in determining
$Ra_c$
, the suppression effect of the magnetic field in the
$x$
-direction is found to be stronger than that in the
$z$
-direction.
The magnetic field also changes the horizontal length scale of the flow. In the case of a vertical magnetic field, the length scale
$\ell$
decreases with increasing
$\textit{Ha}_z$
. For sufficiently large
$\textit{Ha}_z$
, the length scale in the confined domain approaches that with periodic boundary conditions, i.e.
$a= {\pi }/{\ell }=(( {1}/{2})\pi ^4\textit{Ha}^2)^{1/6}$
. In the case of a magnetic field in the
$x$
-direction, the study shows that when
$\varGamma$
is smaller than
$\varGamma ^*=0.62\textit{Ha}_x^{0.47}$
, it will be in a single-roll structure. Otherwise, one may observe multiple horizontally aligned roll structures. The resulting different length scales with different magnetic field directions may be due to the different forces exerted by magnetic fields with different directions, i.e. the vertical magnetic field reduces the horizontal velocity of the flow, and the
$x$
-direction magnetic field reduces the vertical velocity of the flow.
We also outlined the phase diagrams that determine the
$Ra_c$
in the
$\varGamma {-}\textit{Ha}_z$
space for the vertical magnetic field and the
$\varGamma {-}\textit{Ha}_x$
space for the horizontal magnetic field in the
$x$
-direction. On the one hand, in both cases, there is a regime where
$Ra_c$
is mainly determined by the strength of the geometrical confinement, namely
$\varGamma \leqslant 0.83\textit{Ha}_z^{-0.5}$
for the vertical magnetic field and
$\varGamma \leqslant 0.66\textit{Ha}_x^{-1.01}$
for the horizontal magnetic field. In this regime,
$Ra_c=502\varGamma ^{-4.0}$
. On the other hand, there is a regime where
$Ra_c$
is mainly determined by the strength of the magnetic field, namely,
$\varGamma \geqslant 2^{1/6}\pi ^{1/3}\textit{Ha}_z^{-1/3}$
for vertical magnetic field and
$\varGamma \geqslant 5$
for the horizontal magnetic field. In this regime,
$Ra_c=\pi ^2\textit{Ha}_z^2$
for the vertical magnetic field and
$Ra_c=\pi ^2\textit{Ha}_x^2$
for the magnetic field in the
$x$
-direction. In the intermediate regime, where both the magnetic field strength and the spatial confinement determine
$Ra_c$
, a subregime exists under a horizontal magnetic field, characterised by
$Ra_c = 9.9\varGamma^{-2.0}Ha_x^2$
, which is absent in the case of a vertical magnetic field. For other cases in the intermediate regime, the value of
$Ra_c$
is typically needed to be calculated numerically. For ease of use, we have tabulated
$Ra_c$
values for typical combinations of
$\textit{Ha}$
and
$\varGamma$
in table 2 for a magnetic field in the vertical direction and table 3 for a magnetic field in the
$x$
-direction.
Our study suggests that magnetic field can be used to tune the structure of the flow near the onset of convection, e.g. smaller structures can be achieved using strong vertical magnetic field and large-scale structures can be achieved using strong horizontal magnetic field, which may have implications for both natural and industrial applications, and facilitates the active control of large-scale structures in thermal convection. In addition, natural systems usually have no solid boundaries, such as the outer core of the Earth. Our study suggests that there is a regime where the effect of boundaries is minimal, thus providing a platform to study magnetoconvection with no effect of solid boundaries. Finally, we remark that recent studies show that near-wall structures, namely wall modes, can be observed in DNS of magnetoconvection in rectangular cells with
$1\leqslant \varGamma \leqslant 4$
(Liu et al. Reference Liu, Krasnov and Schumacher2018; McCormack et al. Reference McCormack, Teimurazov, Shishkina and Linkmann2023; Xu et al. Reference Xu, Horn and Aurnou2023; Wu, Chen & Ni Reference Wu, Chen and Ni2025). It will be interesting to study the origin of these modes from linear stability analysis and their structure and dynamics with varying
$\varGamma$
. This work is ongoing and the results will be reported in the future.
Acknowledgements
We thank the anonymous referees for the helpful comments.
Funding
This work is supported by the National Natural Science Foundation of China under grant Nos. 12422209, 12595303, a XJTU young talent support plan and Fundamental Research Funds for the Central Universities under grant number xtr042024012.
Declaration of interests
The authors report no conflict of interest.
Data availability statement
The data that support the findings of this study can be obtained upon reasonable request to the corresponding author.
Appendix A. Accuracy of the linear stability analysis method
To test the accuracy of the critical Rayleigh number
$Ra_c$
obtained from the present LSA, we performed calculations with different orders of the trial functions. Specifically, we studied
$M = N = 30, 60$
and 120 for the vertical magnetic field and horizontal magnetic field. The calculated
$Ra_c$
in cells with
$\varGamma =1/100, 1/10, 1$
and 5 for
$\textit{Ha}_z=0,100$
and 3000 and with
$\varGamma =1/10000, 1/10, 1$
and 20 for
$\textit{Ha}_x=0,100$
and 3000 are listed in table 4. It can be seen that the calculation of
$Ra_c$
with
$M = N = 30$
already provides an accuracy better than
$1\,\%$
, suggesting that the calculations performed in the present paper with
$M = N = 60$
are good enough in precision.
Validation of LSA accuracy. The
$Ra_c$
results for typical values of
$\textit{Ha}_z$
and
$\textit{Ha}_x$
at several representative
$\varGamma$
values for different orders
$(M, N)$
are listed.

However, we noted that the flow pattern for the case with a vertical magnetic field has length scales smaller than the system size. Thus, a higher order of
$M$
is required to correctly capture the number of rolls
$n$
. In this study, we employed an empirical criterion that
$M \gtrsim n/2$
.
For the case of a horizontal magnetic field in the
$x$
-direction, although the number of rolls reduces with increasing
$\textit{Ha}_x$
, finer boundary structures form near the sidewalls. To resolve the boundary structures also requires a higher order of the trial functions. This is especially true at large
$\varGamma$
and high
$\textit{Ha}_x$
. For example, we observe wave-like structures near the sidewalls with
$M=N=60$
for the case with
$\varGamma =2$
and
$\textit{Ha}_x=300$
. See figure 17(a). If the order of the trial function is increased to
$M = N = 120$
, the wavy structures become nearly invisible. See figure 17(b). However,
$Ra_c$
for the two cases only differs by less than
$0.1\,\%$
, suggesting that the calculation of
$Ra_c$
is insensitive to the order of the trial function once
$M = N \geqslant 60$
. It should be noted that using excessively high numbers of trial functions demands greater computational resources. Therefore, to keep the calculation manageable in this paper, we chose
$M = N = 60$
to ensure both accuracy and computational efficiency in the present study.
Normalised kinetic energy contour for
$\textit{Ha}_x = 300$
and
$\varGamma =2$
with the order of mode numbers being (a)
$M = N = 60$
and (b)
$M = N = 120$
. The calculated
$Ra_c$
is
$1.126\times 10^6$
and
$1.125\times 10^6$
in panels (a) and (b), respectively.

Appendix B. Details about the DNS
Direct numerical simulation (DNS) of the governing equations, cf. (2.8), (2.1) and (2.3) for
$\textit{Ha}_z = 100$
and (2.9), (2.1) and (2.3) for
$\textit{Ha}_x = 100$
, were carried out over a series of
$\varGamma$
. In the DNS process, we replaced vertical diffusion time
$H^2/\kappa$
in the governing equations with the free-fall time
$\sqrt {H/\alpha g \Delta T}$
as the characteristic time scale, and the Prandtl number
$\textit{Pr}$
was set to be
$\textit{Pr}=0.029$
. The governing equations were solved by the CUPS code (Chong, Ding & Xia Reference Chong, Ding and Xia2018). Following the method proposed by Ren et al. (Reference Ren, Tao, Xia and Xie2024a), we fit the
$\textit{Nu}$
data deviating from the horizontal line, i.e. the conduction state, and determine the intersection point between the extrapolated linear fitting function and the horizontal line, from which
$Ra_c$
for DNS is determined. Two examples determining
$Ra_c$
from DNS for the system with
$\varGamma = 1$
at
$\textit{Ha}_z = 100$
and
$\textit{Ha}_x = 100$
are shown in figure 18. Note in the figure, three types of
$\textit{Nu}$
are defined as follows:
where
$\varepsilon _u$
and
$\varepsilon _J$
represent the kinetic energy dissipation rates due to viscous and Ohmic effects, respectively. The
$\varepsilon _T$
refers to the thermal dissipation rate. The three types of
$\textit{Nu}$
align closely with each other, suggesting that the DNS are well resolved. Table 5 lists the data from the DNS studies for all cases used in this paper.
Determination of the critical Rayleigh number
$Ra_c$
for the onset of convection in a
$\varGamma =1$
cell based on
$\textit{Nu}$
obtained from DNS with (a)
$\textit{Ha}_z=100$
and (b)
$\textit{Ha}_x=100$
. The solid line is a linear fit to the data above the onset of convection and the dashed line marks
$\textit{Nu}=1$
for the conduction state.

Simulation details. Here,
$\textit{Ha}_{i=x,z}$
is Hartmann number with its subscript indicates the direction of the magnetic field.
$Ra$
is the Rayleigh number;
$\textit{Nu}$
is the Nusselt number based on volume-averaged heat flux;
$\textit{Nu}_{\varepsilon _{u+J}}$
is the Nusselt number based on kinetic energy dissipation rate via viscous and Ohmic counterparts;
$\textit{Nu}_{\varepsilon _T}$
is the Nusselt number based on the thermal dissipation rate;
$\varGamma$
is aspect ratio of the domain;
$N_x$
and
$N_z$
represent the resolution of the grid in horizontal and vertical directions, respectively.

A comparison of the onset flow pattern from LSA and DNS is shown in figure 19. In figure 19(a), we show the onset pattern obtained from LSA for
$\textit{Ha}_z = 100$
with
$Ra_c = 1.318 \times 10^5$
, while in figure 19(b), we show the flow pattern from DNS with
$Ra = 1.320 \times 10^5$
. The two cases are both just above the onset of convection. In each panel, the black lines with arrows represent streamlines and the colour indicates the kinetic energy. For the LSA result, the colourbar is normalised to 1. For the DNS result, the colourbar corresponds to the real dimensionless kinetic energy. Figures 19(c) and 19(d) show a comparison of the onset flow pattern with the presence of the horizontal (
$x$
-direction) magnetic field. From figure 19, one observes that the flow pattern just above the onset of convection from LSA and DNS agrees with each other very well. Thus validating the LSA results presented.
Comparison of the flow pattern at the onset of convection in a
$\varGamma = 1$
cell between LSA and DNS. (a, c) LSA results, (b, d) DNS results. (a, b) For
$\textit{Ha}_z=100$
and (c, d) for
$\textit{Ha}_x=100$
. For each panel, the lines with arrows represent streamlines and the colour represents the normalised kinetic energy.






































































































































































































































