1 Introduction

Bifurcations and instabilities in differential equations are features that allow the explanation of many fluid dynamics phenomena in nature and industrial processes [1]. An example is the Rayleigh–Bénard convection problem [2, 3]. Rayleigh–Bénard and related natural convection phenomena are usual in many industrial applications. For instance, in the formation of microstructures during the cooling of molten metals in computer chips or large scale equipments. The model equations in this case are the incompressible Navier–Stokes equations coupled with a heat equation under the Boussinesq approximation. Here the conductive solution becomes unstable for a critical vertical temperature gradient beyond a certain threshold and therefore a convective motion sets in, and, depending on boundary conditions and other external physical parameters, new convective patterns occur [1].

All these problems usually need to be solved with numerical methods. To find all the different solutions for the same or different values of the bifurcation parameter and bifurcations among them specific continuation techniques are required. These techniques are highly developed for ordinary differential equations [4], but are less advanced for partial differential equations. Some continuation methods consider a perturbation with the eigenfunctions at the bifurcation point in order to find the bifurcated solution, others are based on the existence of finite dimensional inertial manifolds [5] and projections on this manifold [6], other use proper orthogonal decomposition (POD) [7].

In [8, 9] a Rayleigh–Bénard problem is studied under the perspective of looking for the bifurcation diagrams. The different solutions and successive bifurcations when the temperature gradients increase are obtained based on a branch continuation technique. In the study of these bifurcation problems the model of partial differential equations must be solved for lots of values of the bifurcation parameter and a linear stability analysis has to be performed for each solution in order to know its linear stability properties and the succession of bifurcations.

The reduced basis method is a meaningful numerical technique to solve problems of partial differential equation for a large amount of values of the bifurcation parameter with a reduced cost [1017]. This method consists of the construction of a basis of solutions for different values of this parameter. These solutions are obtained in a preliminary stage with a standard discretization and a greedy selection is applied to them. A further use of a Galerkin method for the reduced basis expansion is implemented.

In this work the reduced basis method is applied as a continuation technique to find the multiple steady solutions and instabilities among them, that appear in a Rayleigh–Bénard convection problem in a rectangle. In [18] the reduced basis method has been applied to this problem to obtain some stable solutions, allowing one to prove the efficiency of the given method to obtain solutions for different values of the parameters. The aim of the present paper is to complete the study of bifurcations with the calculation of the whole bifurcation diagram with all the solutions including the unstable ones, their linear stability, bifurcations among them and the capturing of the bifurcation points. All the steps are solved with reduced basis.

The article is organized as follows. In Sect. 2 we formulate the problem, providing the description of the physical setup, the basic equations and boundary conditions. We describe the numerical stationary problem and the linear stability analysis of the stationary solutions. Section 3 discusses the numerical reduced basis method. Section 4 describes the numerical results. Finally Sect. 5 presents the conclusions.

2 Formulation of the problem

The domain is a rectangle \(\Omega= [0,\Gamma] \times[0,1]\) containing a fluid that is heated from below at temperature \(T_{0}\) and on the upper plate the temperature is \(T_{1}\). The equations governing the system are the incompressible Navier–Stokes equations with the Boussinesq approximation coupled with a heat equation. The variables present in the problem are \(u_{x}\) and \(u_{z}\), the components of the velocity vector field u, θ the temperature, P the pressure, x and z the spatial coordinates and t the time. The magnitudes are expressed in dimensionless form as explained in [18]:

$$\begin{aligned}& 0=\nabla\cdot\textbf{u},\quad\hbox{in } \Omega, \end{aligned}$$
(1)
$$\begin{aligned}& \frac{1}{\mathit{Pr}} ( \partial_{t} \textbf{u} +\textbf{u}\cdot\nabla \textbf{u} )=R \theta{\textbf{e}_{z}}-\nabla P+ \Delta \textbf {u}, \quad\hbox{in } \Omega, \end{aligned}$$
(2)
$$\begin{aligned}& \partial_{t} \theta+\textbf{u}\cdot\nabla\theta-u_{z}= \Delta\theta ,\quad\hbox{in } \Omega. \end{aligned}$$
(3)

Here \(\textbf{e}_{z}\) is the unit vector in the vertical direction, R is the Rayleigh number that measures the effect of buoyancy and Pr is the Prandtl number. Motivated by mantle convection modelling, the Prandtl number Pr is considered infinite as in [8, 9], then the left hand side term in Eq. (2) can be made equal to zero.

Lateral walls are thermally insulated, non-deformable and free slip. The bottom plate is rigid and the upper surface is non deformable and free slip. These conditions along with the thermal boundaries on the top and bottom plates are expressed as,

$$\begin{aligned}& \textbf{u} =\textbf{0},\qquad \theta=0 \quad\mbox{on }z= 0; \qquad\theta=\partial _{z}{u_{x}}=u_{z} ={0} \quad\mbox{on }z= {1}, \end{aligned}$$
(4)
$$\begin{aligned}& \partial_{x} \theta=\partial_{x}{u_{z}}=u_{x} ={0}, \quad\mbox{on }x=0,\quad\hbox{and}\quad \hbox{on } {x=\Gamma}. \end{aligned}$$
(5)

Equations in problem (1)–(5) are invariant under the symmetry,

$$\gamma: (x,z,u_{x},u_{z},\theta,P) \rightarrow(-x,z,-u_{x},u_{z}, \theta,P). $$

Then, if S is solution of the problem, γS is a solution as well. This solution is said to be in the orbit of S [19]. We consider solutions in the orbit of S to be equivalent, so sometimes we restrict ourselves to one single solution in an orbit.

2.1 Stationary equations

The corresponding stationary problem is the following,

$$\begin{aligned}& \nabla\cdot\textbf{u}=0,\quad \hbox{in } \Omega, \end{aligned}$$
(6)
$$\begin{aligned}& R \theta{\textbf{e}_{z}}-\nabla P+ \Delta\textbf{u}=0,\quad \hbox{in } \Omega, \end{aligned}$$
(7)
$$\begin{aligned}& \textbf{u}\cdot\nabla\theta- u_{z} =\Delta\theta,\quad\hbox{in } \Omega \end{aligned}$$
(8)

with the boundary conditions (4)–(5). There are results for the existence of solutions in this problem in [20, 21].

This stationary problem (6)–(8) with boundary conditions (4)–(5) is solved numerically with a Newton method for the nonlinear terms [22] and a Legendre collocation [23, 24] for each step in the Newton procedure. In the Newton method an aproximate solution \(u_{x}^{0}\), \(u_{z}^{0}\), \(P^{0}\), \(\theta ^{0}\) is required at the beginning. This guess solution can be the solution for a different value of the parameters or the solution for the linear problem. This initial guess is improved by adding to it a small correction as follows: \(u_{x}^{0} + \tilde{u}_{x}\), \(u_{z}^{0} + \tilde{u}_{z}\), \(P^{0} + \tilde{P}\), \(\theta^{0} + \tilde{\theta}\). These expressions are introduced into equations (6)–(8) and boundary conditions (4)–(5) where only order one terms in the perturbation fields are kept in the linear approximation. The fields are expanded into Legendre polynomials,

$$\begin{aligned}& \tilde{u}_{x} = \sum_{i=0}^{n} \sum_{j=0}^{m} a^{u_{x}}_{ij} L_{i}(x) L_{j}(z),\qquad \tilde{u}_{z} = \sum _{i=0}^{n} \sum_{j=0}^{m} a^{u_{z}}_{ij} L_{i}(x) L_{j}(z), \end{aligned}$$
(9)
$$\begin{aligned}& \tilde{P} = \sum_{i=0}^{n} \sum _{j=0}^{m} a^{P}_{ij} L_{i}(x) L_{j}(z),\qquad \tilde {\theta} = \sum _{i=0}^{n} \sum_{j=0}^{m} a^{\theta}_{ij} L_{i}(x) L_{j}(z), \end{aligned}$$
(10)

where \(L_{i}\) is the Legendre polynomial of degree i. The expansions are introduced into the equations, they are evaluated at the Legendre Gauss–Lobatto points and a linear problem on the coefficients \(a^{u_{x}}_{ij}\), \(a^{u_{z}}_{ij}\), \(a^{P}_{ij}\), \(a^{\theta}_{ij}\), \(i=0,\ldots,n\); \(j=0,\ldots,m\) is solved with a Gaussian elimination. Then we obtain the solution of the first iteration of the Newton method \(u_{x}^{1}=u_{x}^{0} + \tilde{u}_{x}\), \(u_{z}^{1}=u_{z}^{0} + \tilde{u}_{z}\), \(P^{1}=P^{0} + \tilde{P}\), \(\theta ^{1}=\theta^{0} + \tilde{\theta}\). This procedure is repeated \(u_{x}^{s+1}=u_{x}^{s} + \tilde{u}_{x}\), \(u_{z}^{s+1}=u_{z}^{s} + \tilde{u}_{z}\), \(P^{s+1}=P^{s} + \tilde{P}\), \(\theta^{s+1}=\theta^{s} + \tilde{\theta}\) until a convergence criterion is satisfied. In particular we have considered that the \(L^{2}\) norm of the computed perturbation should be less than 10−7. Where the \(L^{2}\) scalar product and norm are calculated with the Legendre Gauss–Lobatto quadrature

$$ \langle f,g\rangle_{\mathrm{GL}} = \sum_{l=0}^{n} \sum _{s=0}^{m} f(x_{l},z_{s}) g(x_{l},z_{s}) \rho_{ls}, $$
(11)

and \(x_{l}\), \(l=0,\ldots,n\), \(z_{s}\), \(s=0,\ldots,m\), are the Legendre Gauss–Lobatto points, and \(\rho_{ls}\) are the Legendre Gauss–Lobatto weights. We have increased the number of polynomials in the Legendre expansion with respect to [18] in order to improve the accuracy of the calculation of the bifurcation points. The criteria to choose an order expansion is the critical Rayleigh number where the bifurcation takes place does not change if we increase further the order expansion. So, in this calculations we have considered expansions of order \(n=35\) in the x-direction and \(m=13\) in the z-direction.

2.2 Linear stability of the stationary problem

Once the stationary solutions \(( \textbf{u}^{b}, \theta^{b}, P^{b} )\) \((x, z)\) are obtained, the stability of these solutions is determined by a linear stability analysis as in [8]. In this analysis the stationary solutions are perturbed as follows:

$$\begin{aligned}& \textbf{u}(x,z,t) =\textbf{u}^{b}(x,z)+\widetilde{\textbf {u}}(x,z) \exp(\sigma t), \end{aligned}$$
(12)
$$\begin{aligned}& {\theta}(x,z,t) ={\theta}^{b}(x,z)+\widetilde{\theta}(x,z)\exp( \sigma t), \end{aligned}$$
(13)
$$\begin{aligned}& {P}(x,z,t) ={P}^{b}(x,z)+\widetilde{P}(x,z)\exp(\sigma t). \end{aligned}$$
(14)

Here superscript b indicates the corresponding solutions of the stationary problem (6)–(8)–(4)–(5) and the tilde refers to the perturbation. Expressions for the perturbed fields (12)–(14) are introduced in equations (1)–(5) and the resulting equations are linearized. Therefore, if we drop the tildes to simplify notation, we get the following eingenvalue problem:

$$\begin{aligned}& \nabla\cdot\textbf{u}=0, \quad\hbox{in } \Omega, \end{aligned}$$
(15)
$$\begin{aligned}& R \theta{\textbf{e}_{z}}-\nabla P+ \Delta\textbf{u}=0,\quad \hbox{in } \Omega, \end{aligned}$$
(16)
$$\begin{aligned}& \Delta\theta-\textbf{u}^{b}\cdot\nabla\theta-\textbf{u}\cdot\nabla \theta^{b} + u_{z} =\sigma\theta,\quad\hbox{in } \Omega, \end{aligned}$$
(17)

together with boundary conditions (4)–(5). The resulting problem is an eigenvalue problem in \(\sigma(R)\). The sign of the real part of \(\sigma(R)\) determines the stability of the stationary solution. If \(\operatorname{Re}(\sigma(R))<0\) for any eigenvalue of the stationary state, then it is stable, while if there exists a value of \(\sigma(R)\) such that \(\operatorname{Re}(\sigma(R))>0\) then the stationary state becomes unstable. If we name \(\sigma_{1}(R)\) the eigenvalue with largest real part, as \(\operatorname{Re}(\sigma_{1}(R))\) depends on R, by increasing R, \(\operatorname{Re}(\sigma_{1}(R))\) changes sign at a critical threshold \(R_{c}\), where \(\operatorname{Re}(\sigma_{1}(R_{c}))=0\) which separates stable from unstable solutions. The condition \(\operatorname{Re}(\sigma _{1}(R_{c}))=0\) defines the critical threshold of the bifurcation at which \(\operatorname{Im}(\sigma_{1}(R_{c}))\) may be either zero or not.

We choose the value of the aspect ratio \(\Gamma=3.495\) as in [8, 18] and let the Rayleigh number R vary in the interval: \([1000; 3000]\). In this interval two pitchfork bifurcations and two inverse pitchfork bifurcations appear [18]. In this problem we take into account nine different solutions. In the interval \([1000;1102]\) there is only the zero solution \(S_{0}\), in the interval \([1101; 1252]\) there are two other solutions, three in total, \(S_{0}\), \(S_{1}\) and \(S_{2}\), in the interval \([1252;1538]\) five solutions \(S_{0}\)\(S_{4}\), and finally in the interval \([1538;3000]\) nine solutions \(S_{0}\)\(S_{8}\). Therefore solution \(S_{0}\) exists in the interval \([1000;3000]\), solutions \(S_{1}\) and \(S_{2}\) in the interval \([1102;3000]\), solutions \(S_{3}\) and \(S_{4}\) in the interval \([1252;3000]\) and solutions \(S_{5}\)\(S_{8}\) in the interval \([1538;3000]\).

3 Numerical reduced basis method

The numerical method is based on the approximation of all the solutions by the linear combination of some well chosen solutions computed for some particular values of R, the same ones for every variable: u, θ, P. These values are obtained in a greedy fashion.

3.1 Construction of the reduced basis

The procedure we have implemented in this paper in order to obtain the reduced basis is the pure greedy that is explained next in a inductive way:

  • First we fix the solutions we want to calculate and the interval of values of R where these solutions exist.

  • We solve numerically the stationary equations (6)–(8) with boundary conditions (4)–(5), with the Newton Legendre collocation method described in the previous section, for different values of the Rayleigh number R chosen on a subset of the interval, denoted as “trial set” \(\Xi_{\mathrm{trial}}\). Some values of the Rayleigh number are equidistant, and others are near the bifurcation points. We name the associated solutions \(\Phi(R) \equiv( \textbf {u}(R), \theta(R), P(R))\).

  • For the first step \(i=1\), we choose a value of the Rayleigh number that we name \(R_{1}\), with its corresponding solution \(\Phi(R_{1})\), i.e. in this work it is the smallest value of R in the interval we consider. We normalize this stationary solution according to the \(L^{2}\) scalar product:

    $$\Psi_{1}= \biggl( \psi_{1}^{\textbf{u}} = \frac{\textbf{u}_{1}}{\| \textbf{u}_{1}\|_{L^{2}}}, \psi_{1}^{\theta}= \frac{{\theta}_{1}}{\| \theta_{1} \|_{L^{2}}}, \psi_{1}^{P} = \frac {{P}_{1}}{\| P_{1} \|_{L^{2}}} \biggr), $$

    then we consider a first space \(X_{1}=\mbox{span}\{ \psi^{\textbf{u}}_{1}\}\times\mbox{span}\{ \psi^{\theta}_{1}\} \times\mbox{span}\{ \psi^{P}_{1}\} \).

  • We introduce the projection operator \(\Pi_{X_{1}^{\textbf{u}}} \times\Pi_{X_{1}^{\theta}} \times\Pi_{X_{1}^{P}}\) onto \(X_{1}\) for the \(L^{2}\) inner product and consider the approximation \((\textbf{u}^{(1)}(R), \theta^{(1)}(R), P^{(1)}(R)) = [\Pi_{X_{1}^{\textbf {u}}} (\textbf{u}(R)),\Pi_{X_{1}^{\theta}} (\theta(R)), \Pi _{X_{1}^{P}}(P(R))]\) for every R. Note that it corresponds to the product of independent projection operators \(\Pi_{X_{1}^{\textbf{u}}}\), \(\Pi_{X_{1}^{\theta}}\) and \(\Pi_{X_{1}^{P}}\).

  • We evaluate the relative errors of the projections on \(X_{1}\) for the velocity and temperature fields u, θ on one side and the pressure P on the other side:

    $$\epsilon^{(1)}_{1}(R) = \frac{\| (u_{x}(R), u_{z}(R),\theta (R))-(u^{(1)}_{x}(R),u^{(1)}_{z}(R),\theta^{(1)}(R))\|_{(L^{2})^{3}}}{\| (u_{x}(R), u_{z}(R),\theta(R))\|_{(L^{2})^{3}}} $$

    and

    $$\epsilon^{(1)}_{2}(R)= \frac{\| P(R)-P^{(1)}(R)\|_{L^{2}}}{\|P(R)\|_{L^{2}}}, $$

    over any values of R chosen on \(\Xi_{\mathrm{trial}}\). We then choose \(R_{2}\) as follows:

    $$R_{2} = \underset{R\in\Xi_{\mathrm{trial}}}{\operatorname{argmax}} \max_{j=1, 2} \epsilon^{(1)}_{j}(R) $$

    and the corresponding stationary solution is \(\Phi(R_{2})\).

  • Given step i, we orthonormalize the \(i+1\) functions by Gram–Schmidt procedure and we consider the \(i+1\) space \(X_{i+1} = \mbox{span}\{ \psi^{\textbf{u}}_{1}, \ldots,\psi^{\textbf{u}}_{i+1}\}\times\mbox{span}\{ \psi^{\theta}_{1}, \ldots,\psi^{\theta}_{i+1}\} \times\mbox{span}\{ \psi^{P}_{1}, \ldots,\psi^{P}_{i+1}\}\).

  • We introduce the projection operator \(\Pi_{X_{i+1}^{\textbf{u}}} \times\Pi_{X_{i+1}^{\theta}} \times\Pi_{X_{i+1}^{P}}\) onto \(X_{i+1}\) for the \(L^{2}\) inner product and consider the approximation

    $$\bigl(\textbf{u}^{(i+1)}(R), \theta^{(i+1)}(R), P^{(i+1)}(R)\bigr) =\bigl[\Pi _{X_{i+1}^{\textbf{u}}} \bigl(\textbf{u}(R)\bigr), \Pi_{X_{i+1}^{\theta}} \bigl(\theta (R)\bigr), \Pi_{X_{i+1}^{P}}\bigl(P(R)\bigr) \bigr] $$

    for every R.

  • Again, we evaluate the relative errors of the projections on \(X_{i+1}\) for the velocity and temperature fields u, θ on one side and the pressure P on the other side:

    $$\epsilon^{(i+1)}_{1}(R) = \frac{\| (u_{x}(R), u_{z}(R),\theta (R))-(u^{(i+1)}_{x}(R),u^{(i+1)}_{z}(R),\theta^{(i+1)}(R))\| _{(L^{2})^{3}}}{\| (u_{x}(R), u_{z}(R),\theta(R))\|_{(L^{2})^{3}}} $$

    and

    $$\epsilon^{(i+1)}_{2}(R)=\frac{\|P(R)-P^{(i+1)}(R)\|_{L^{2}}}{\|P(R)\|_{L^{2}}}, $$

    over any values for R chosen on \(\Xi_{\mathrm{trial}}\). We then choose \(R_{i+2}\) as follows:

    $$R_{i+2} = \underset{R\in\Xi_{\mathrm{trial}}}{\operatorname{argmax}} \max_{j=1, 2} \epsilon^{(i+1)}_{j}(R) $$

    and the corresponding stationary solution is \(\Phi(R_{i+2})\).

  • This procedure is repeated until we reach a value \(N < \hbox{card}(\Xi_{\mathrm{trial}})\) for which the stopping criterium \(\epsilon^{(N)}_{j} \leq10^{-7}\), \(j=1,2\) is satisfied.

Therefore, we obtain the reduced basis \(\{\Psi_{1},\Psi_{2}, \ldots,\Psi _{N}\}\) and a corresponding discrete space \(X_{N} \equiv X_{N}^{\textbf{u}} \times X_{N}^{\theta}\times X_{N}^{P}\). For some solutions we have constructed a reduced basis, besides for other solutions two reduced basis and for other ones three reduced basis, in order to reach the same accuracy for all the solutions. Table 1 shows the number of snapshots used to calculate the reduced basis and the number of elements of the reduced basis for each solution.

Table 1 Number of snapshots in the trial set for the different reduced basis (RB) for different solution

Tables 2, 3, 4, 5, 6 present the maximum values of \(\epsilon ^{(j)}_{1}\) and \(\epsilon^{(j)}_{2}\) for increasing values of j and the corresponding R parameter in which the maximum value is obtained for the different solutions.

Table 2 \(\epsilon^{(j)}_{1}\), \(\epsilon^{(j)}_{2}\), \(j=1,\ldots,N\) and the respective Rayleigh number R in which the maximum takes place for different dimensions j of the reduced basis space. R is in the interval \([1102;3000]\) for solutions \(S_{1}\)
Table 3 \(\epsilon^{(j)}_{1}\), \(\epsilon^{(j)}_{2}\), \(j=1,\ldots,N\) and the respective Rayleigh number R in which the maximum takes place for different dimensions j of the reduced basis space. R is in the interval \([1253;3000]\) for solutions \(S_{3}\)
Table 4 \(\epsilon^{(j)}_{1}\), \(\epsilon^{(j)}_{2}\), \(j=1,\ldots,N\) and the respective Rayleigh number R in which the maximum takes place for different dimensions j of the reduced basis space. R is in the interval \([1253;1538]\) for solutions \(S_{3}\) in the upper part of the table and R is in the interval \([1538;3000]\) for solutions \(S_{3}\) in the lower part of the table
Table 5 \(\epsilon^{(j)}_{1}\), \(\epsilon^{(j)}_{2}\), \(j=1,\ldots,N\) and the respective Rayleigh number R in which the maximum takes place for different dimensions j of the reduced basis space. R is in the interval \([1538;3000]\) for solutions \(S_{5}\)
Table 6 \(\epsilon^{(j)}_{1}\), \(\epsilon^{(j)}_{2}\), \(j=1,\ldots,N\) and the respective Rayleigh number R in which the maximum takes place for different dimensions j of the reduced basis space. R is in the interval \([1539;1600]\) for solutions \(S_{5}\) in the first part of the table, R is in the interval \([1600;2000]\) for solutions \(S_{5}\) in the second part of the table and R is in the interval \([2000;3000]\) for solutions \(S_{5}\) in the last part of the table

3.2 Galerkin procedure

Once the reduced basis \(\{\Psi_{1},\Psi_{2},\ldots,\Psi_{N}\}\) has been calculated, the Galerkin method with expansions in this basis is implemented to solve the problem (6)–(8) with boundary conditions (4)–(5). The nonlinearity of this problem is solved with an iterative Newton procedure, i.e. a linearization of the equations around a previous solution. We start with an approximated solution at iteration \(s=0\), taken e.g. as a previously computed solution at a Rayleigh number \(R^{*}\) belonging to the trial set, then, at each iteration step \(s+1\) we solve the linear problem obtained by linearizing around the previous step s. In practice this procedure is equivalent to introduce a perturbation to the step s,

$$u^{s+1}_{N,x}=u^{s}_{N,x}+ \widetilde{u}_{N,x},\qquad u^{s+1}_{N,z}=u^{s}_{N,z}+ \widetilde{u}_{N,z}, \qquad\theta_{N}^{s+1}=\theta _{N}^{s}+\widetilde{\theta}_{N},\qquad P_{N}^{s+1}=P_{N}^{s}+ \widetilde{P}_{N}, $$

we want to emphasize that both \((u^{s}_{N,x}, u^{s}_{N,z})\) and \((\widetilde {u}_{N,x}, \widetilde{u}_{N,z})\) belong to \(X_{N}^{\textbf{u}}\), both \(\theta_{N}^{s}\) and \(\widetilde{\theta}_{N}\) belong to \(X_{N}^{\theta}\) and both \(P_{N}^{s}\) and \(\widetilde{P}_{N}\) belong to \(X_{N}^{P}\).

We then introduce these fields into the equations (6)–(8) and boundary conditions (4)–(5) and linearize with respect to the perturbation. The following problem is obtained (where the tildes have been omitted to simplify notation)

$$\begin{aligned}& \nabla\cdot\textbf{u}_{N}=-\nabla\cdot\textbf{u}_{N}^{s}, \quad\hbox{in } \Omega, \end{aligned}$$
(18)
$$\begin{aligned}& R \theta_{N} {\textbf{e}_{z}} -\nabla P_{N} + \Delta\textbf{u}_{N}=-R \theta_{N}^{s} { \textbf{e}_{z}} +\nabla P_{N}^{s}- \Delta \textbf{u}_{N}^{s},\quad \hbox{in } \Omega, \end{aligned}$$
(19)
$$\begin{aligned}& \textbf{u}_{N} \cdot\nabla\theta^{s}_{N} + \textbf{u}_{N}^{s} \cdot\nabla \theta_{N} - \Delta \theta_{N} - u_{N,z}= \Delta \theta_{N}^{s} - \textbf{u}_{N}^{s} \cdot\nabla\theta_{N}^{s} + u_{N,z}^{s},\quad\hbox{in } \Omega. \end{aligned}$$
(20)

The variational formulation of this problem for the velocity and the temperature fields is the following:

Find \(\textbf{u}_{N}\in X^{ {\textbf{u}}}_{N}\) and \(\theta_{N} \in X^{ \theta}_{N}\) such that:

$$\begin{aligned}& R \int_{ \Omega}\theta_{N} v_{z}- \int_{ \Omega} \nabla \textbf{u}_{N}\cdot\nabla \textbf{v}=-R \int_{ \Omega}\theta_{N}^{s} v_{z}+ \int_{ \Omega} \nabla \textbf{u}_{N}^{s}\cdot \nabla\textbf{v},\quad \forall\textbf{v} \in X^{ \textbf {u}}_{N}, \end{aligned}$$
(21)
$$\begin{aligned}& \begin{aligned}[b]&\int_{ \Omega} \bigl(\textbf{u}_{N} \cdot\nabla \theta_{N}^{s} + \textbf {u}_{N}^{s} \cdot\nabla\theta_{N} - u_{N,z} \bigr)\cdot\phi+ \int_{ \Omega} \nabla\theta_{N} \cdot\nabla\phi \\ &\quad = - \int_{ \Omega} \nabla \theta_{N}^{s} \cdot \nabla\phi- \int_{ \Omega} \bigl(\textbf{u}_{N}^{s} \cdot \nabla\theta_{N}^{s} - u_{N,z}^{s}\bigr) \cdot\phi, \quad\forall\phi\in X^{ \theta}_{N},\end{aligned} \end{aligned}$$
(22)

we discretize this problem by using expansions in terms of the reduced basis obtained in the previous section, \(\textbf{u}_{N} = \sum^{N}_{i=1} \alpha_{i} \psi^{\textbf{u}}_{i}\) and \({\theta}_{N} = \sum^{N}_{i=1} \beta_{i} \psi^{\theta}_{i}\). The integrals are calculated by using Legendre Gauss–Lobatto integration. Note that our basis of solutions for the velocity are divergence free, and thus the pressure disappears in this formulation.

Each step in the Newton iteration becomes a \(2N \times 2N\) algebraic system of equations:

$$M^{s}\cdot \boldsymbol{\xi} = \textbf{F}\quad \Leftrightarrow\quad \left ( \textstyle\begin{array}{c@{\quad}c} A_{1}& B_{1}\\ A_{2}&B_{2} \end{array}\displaystyle \right )\cdot \left ( \textstyle\begin{array}{c} \boldsymbol{\alpha}\\ \boldsymbol{\beta} \end{array}\displaystyle \right )=\left ( \textstyle\begin{array}{c} {\textbf{F}_{1}}\\ {\textbf{F}_{2}} \end{array}\displaystyle \right ), $$

where

$$\begin{gathered} M^{s} = \left ( \textstyle\begin{array}{c@{\quad}c} A_{1}& B_{1}\\ A_{2}&B_{2} \end{array}\displaystyle \right );\qquad \boldsymbol{\xi} = \left ( \textstyle\begin{array}{c} \boldsymbol{\alpha}\\ \boldsymbol{\beta} \end{array}\displaystyle \right );\\ A_{i}\in\mathcal{M}_{N\times N}, \quad i=1,2;\qquad B_{i}\in \mathcal{M}_{N\times N}, \quad i=1,2; \\ \boldsymbol{\alpha}=(\alpha_{1},\ldots, \alpha_{N});\qquad \boldsymbol{\beta} = (\beta_{1},\ldots, \beta_{N});\qquad {\textbf{F}_{i}} \in\mathcal {M}_{N \times1},\quad i=1,2. \end{gathered}$$

\(M^{s}\) is a non-singular and well conditioned matrix, condition numbers are \(O(10^{4})\) in all the studied cases.

Note that the construction of the matrix \(M^{s}\) can be done online very efficiently in \(\mathcal{O}(N^{3})\) operations if, during the pre-processing off-line stage, double integrals involving the elements of the reduced basis are computed, we are indeed in the case where the appearance of the parameter is outside of the integrals and the problem is only slightly nonlinear (bilinear), during the offline stage the integrals are calculated using the Legendre Gauss–Lobatto quadrature formulas [24].

3.3 Linear stability analysis

Following the Galerkin variational procedure explained in the previous section, the eigenvalue problem (15)–(17) described in Sect. 2.2 is presented in its corresponding variational form as follows:

$$\begin{aligned}& R \int_{ \Omega}\theta_{N} v_{z}- \int_{ \Omega} \nabla \textbf{u}_{N}\cdot\nabla \textbf{v}=0, \quad\forall\textbf{v} \in X^{ \textbf{u}}_{N}, \end{aligned}$$
(23)
$$\begin{aligned}& \begin{aligned}[b]& \int_{ \Omega} \bigl(\textbf{u}_{N} \cdot\nabla \theta_{N}^{b} + \textbf {u}_{N}^{b} \cdot\nabla\theta_{N} - u_{N,z} \bigr)\cdot\phi+ \int_{ \Omega} \nabla\theta_{N} \cdot\nabla \phi \\ &\quad = -\sigma \int_{ \Omega} \theta_{N} \cdot\phi, \quad\forall\phi\in X^{ \theta}_{N}, \end{aligned} \end{aligned}$$
(24)

we discretize this problem with the corresponding expansions into the reduced basis, \(\textbf{u}_{N} = \sum^{N}_{i=1} \alpha_{i} \psi^{\textbf{u}}_{i}\) and \({\theta}_{N} = \sum^{N}_{i=1} \beta_{i} \psi^{\theta}_{i}\). The eigenvalue problem (23)–(24) is then transformed into its discrete form as:

$$ M^{s}\cdot \boldsymbol{\xi} = \sigma B \cdot\boldsymbol{\xi} \quad\Leftrightarrow\quad \left ( \textstyle\begin{array}{c@{\quad}c} A_{1}& B_{1}\\ A_{2}&B_{2} \end{array}\displaystyle \right )\cdot \left ( \textstyle\begin{array}{c} \boldsymbol{\alpha}\\ \boldsymbol{\beta} \end{array}\displaystyle \right )=\sigma \left ( \textstyle\begin{array}{c@{\quad}c} 0& 0\\ 0&\textbf{b} \end{array}\displaystyle \right )\cdot \left ( \textstyle\begin{array}{c} \boldsymbol{\alpha}\\ \boldsymbol{\beta} \end{array}\displaystyle \right ), $$
(25)

where \(\textbf{b} = -(\int_{\Omega} \psi_{i}^{\theta} \cdot\psi _{j}^{\theta})_{i,j=1}^{N} = - I_{N}\), where \(I_{N}\) is the identity matrix of size N, and \(A_{1}\), \(B_{1}\), \(A_{2}\), \(B_{2}\), α and β are defined in Sect. 3.2. The discrete eigenvalue problem (25) has a finite number of eigenvalues \(\sigma_{i}\). As explained in Sect. 2.2 we are interested in the presence of eigenvalues that have a positive real part. If such eigenvalue exists the solution is unstable otherwise the solution is stable.

3.4 Post-processing

The reduced basis is formed by functions that are not solutions of the Galerkin procedure, indeed these are solutions of a Legendre collocation method. We introduce a rectification post-processing presented in [18], which consists of a change of basis from the reduced basis to the Galerkin solutions on the values of R of the basis as is explained as follows:

We start by computing the reduced basis Galerkin approximations for all values \(R=R_{i}\), \(i=1,\dots,N\), that are used in the reduced basis construction. This gives us coefficients \(\textbf{u}_{N}(R_{i}) = \sum^{N}_{j=1} \alpha^{i}_{j} \psi^{\textbf{u}}_{j}\) and \({ {\theta}_{N} (R_{i})}= \sum^{N}_{j=1} \beta^{i}_{j} \psi^{\theta}_{j}\). We name \(Q^{u}\) (resp. \(Q^{\theta} \)) the matrix with entries equal to \(\alpha^{i}_{j}\) (resp. \(\beta^{i}_{j}\)). We call \(S^{u}\) (resp. \(S^{\theta}\)) the matrix with columns equal to the coordinates of \(\textbf{u}(R_{i})\) (resp. \(\theta(R_{i})\)) in the reduced basis \(\psi^{\textbf{u}}_{j}\) (resp. \(\psi^{\theta}_{j}\)), \(j=1,\dots,N\). Finally, we set \(P^{u}=S^{u} [Q^{u}]^{-1}\) (resp. \(P^{\theta}=S^{\theta}[Q^{\theta} ]^{-1}\)). This part is done during the off-line stage and the matrix is stored.

Then for every other values for which we apply the RB Galerkin approximation, we are able to rectify the coefficients as follows: \(\boldsymbol{\alpha}_{\mathrm{new}} = P^{u} \boldsymbol{\alpha}\) (resp. \(\boldsymbol{\beta}_{\mathrm{new}} = P^{\theta} \boldsymbol{\beta}\)) and the post-processed solutions are then

$$ \mathbf{u}_{N} \simeq\sum^{N}_{i=1} \alpha_{\mathrm{new}, i} \psi^{\bf{u}}_{i}, \qquad{\theta} \simeq \sum ^{N}_{i=1} {\beta_{\mathrm{new},i}} \psi^{\theta}_{i}. $$
(26)

4 Results and discussion

As explained in Sect. 3.1. for each type of solution we have constructed one or more reduced basis with those solutions. We have calculated with reduced basis the nine different solutions in the interval of R, \([0; 3000]\). All these solutions except the conductive zero solution are presented in Figs. 12 with plots of their isotherms and velocity fields. The zero solution \(S_{0}\) is invariant under all the symmetries. A solution with 3 rolls, \(S_{1}\), without any symmetry, can be seen in Fig. 1(a). Two solutions with 4 rolls, \(S_{3}\) and \(S_{4}\), with the symmetry γ, are shown in Figs. 1(c) and 1(d), respectively. Two solutions with 4 rolls, \(S_{5}\) and \(S_{7}\), without any symmetry, can be seen in Figs. 2(a) and 2(c), respectively. If we consider solutions in the different orbits, \(S_{2}=\gamma S_{1}\) (see Fig. 1(b)), \(S_{6}= \gamma S_{5}\) (see Fig. 2(b)) and \(S_{8}=\gamma S_{7}\) (see Fig. 2(d)) are solutions as well, then we have found a total of nine solutions in that interval of R.

Figure 1
figure 1

(a) Isotherms and velocity field for \(R=1900\) for solution \(S_{1}\) and (b) \(S_{2}\); (c) isotherms and velocity field for \(R=1900\) for solution \(S_{3}\) and (d) \(S_{4}\)

Figure 2
figure 2

(a) Isotherms and velocity field for \(R=1900\) for solution \(S_{5}\) and (b) \(S_{6}\); (c) isotherms and velocity field for \(R=1900\) for solution \(S_{7}\) and (d) \(S_{8}\)

4.1 Linear stability analysis

We have calculated the linear stability analysis for each type of solution. The exchange of stability bifurcations are well captured. The stability of \(S_{1}\) with respect to \(S_{1}\) captures correctly the bifurcation from \(S_{0}\) to \(S_{1}\). The real part of the eigenvalues is negative for any value of R and the largest one becomes zero at \(R_{c1}=1101\). The stability of \(S_{3}\) with respect to \(S_{3}\) and \(S_{5}\) captures the bifurcation from \(S_{3}\) to \(S_{5}\). The real part of the eigenvalues is negative for \(R > R_{c3}=1538\) and become positive for \(R < R_{c3}=1538\). Figure 3(a) presents real part of the eigenvalues as a function of R for solutions \(S_{3}\). In order to calculate a bifurcation point, the equations have to be solved for a lot of values of the bifurcation parameter R. In this case the problems are solved increasing R with steps of 1. Then the bifurcation point is the first integer where the sign of the real part of the eigenvalue with largest real part changes sign as R increases. For this reason we say the bifurcation point is correctly captured at \(R_{c3}=1538\). But there is an error, with a linear interpolation the value of the bifurcation for Reduced Basis is \(R_{c3\mathrm{RB}}=1537.5442\) and for Legendre collocation it is \(R_{c3\mathrm{L}}=1537.0860\), the relative error is \(O(10)^{-4}\). For both calculations, i.e., Legendre collocation solver and post-processed reduced basis method, the real part of the eigenvalues becomes negative for the same integer value, \(R_{c3}=1538\). The same behavior is observed for the rest of the bifurcation points at the values of \(R_{c1}= 1101\) and \(R_{c2}=1252\). Therefore, we may conclude that the bifurcation points are correctly captured.

Figure 3
figure 3

(a) Eigenvalue with maximum real part near the bifurcation point. Dashed line for the Legendre solver and solid line for the post-processed reduced basis. (b) Norm of the difference between \(\operatorname{Re}(\sigma_{1})\) obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation. (c) Norm of the difference between \(\operatorname{Re}(\sigma_{1})\) obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation divided by the norm of \(\operatorname{Re}(\sigma_{1})\) obtained with Legendre collocation

Figure 3(b) shows the norm of the difference between the real part of the eigenvalue with largest real part obtained via Legendre collocation and by a post-processed reduced basis method based on Legendre collocation for solutions \(S_{3}\) in the interval of R \([1534; 1539]\) near the bifurcation point at \(R_{c3}=1538\). This difference is \({\mathcal {O}}(10^{-4})\) (where both approximations cross near the bifurcation point), increasing as we move away from the bifurcation point. Figure 3(c) shows the norm of the difference between the real part of the eigenvalue with largest real part obtained via Legendre collocation and by a post-processed reduced basis method based on Legendre collocation divided by the norm of the real part of the eigenvalue obtained with Legendre collocation for solutions \(S_{3}\) in the interval of R \([1534; 1539]\) near the bifurcation point at \(R_{c3}=1538\). This difference is \({\mathcal {O}}(10^{-1})\) except around \(R=1537\) where it is \(O(1)\) because the real part of the eigenvalue crosses the axis and becomes zero near this point at \(R_{c3\mathrm{L}}=1537.0860\), for this reason the relative error becomes maximum at this value \(R=1537\).

4.2 Capturing the bifurcation points

Once we have calculated all solutions, a plot of the combination of coefficients \(a_{03}+a_{13}\) of the Legendre expansion of the field \(u_{xN}\) as a function of the Rayleigh number is drawn in the bifurcation diagram in Fig. 4. The combination \(a_{03} + a_{13}\) is employed because some of the coefficients for the stationary solutions are approximately zero but others are not. In order to characterise the stationary solutions and its evolution as a function of the Rayleigh number, we present the bifurcation diagram in Fig. 4 with a selection of nonzero coefficients \(a_{03} + a_{13}\) for which the bifurcation diagram is clear. Four bifurcations are observed in this problem. A first pitchfork bifurcation from the zero solution towards solutions with 3 rolls, \(S_{1}\) and \(S_{2}=\gamma S_{1}\). A second pitchfork bifurcation from the zero solution towards solutions with 4 rolls, \(S_{3}\) and \(S_{4}\). Two inverse pitchfork bifurcations from \(S_{3}\) (respectively \(S_{4}\)) towards non symmetric solutions with the same number of rolls, \(S_{5}\), \(S_{6} = \gamma S_{5}\) (respectively, \(S_{7}\) and \(S_{8}=\gamma S_{7}\)).

Figure 4
figure 4

Bifurcation diagram where the value of the combination of coefficients \(a_{03}+a_{13}\) of the Legendre expansion of the field \(u_{x}\) as a function of the Rayleigh number is presented. Solutions S are calculated by reconstructing all the solutions in each branch by Galerkin approach on the corresponding reduced basis

The point where different types of solutions intersect or get together is going to be the bifurcation point, where the bifurcation takes place. The first pitchfork bifurcation takes place at \(R=1101\), where solutions \(S_{1}\) and \(S_{2}\) get together. The second bifurcation occurs at \(R=1252\), where solutions \(S_{3}\) and \(S_{4}\) intersect. Finally both secondary inverse pitchfork bifurcations take place at \(R=1538\), where \(S_{5}\) and \(S_{6}\) intersect, and where \(S_{7}\) and \(S_{8}\) get together. These bifurcation points are correctly captured with the reduced basis method by plotting the solutions in the bifurcation diagram in Fig. 4. The bifurcations are pitchfork because symmetric solutions appear at those points.

The bifurcation points are also captured with the linear stability analysis as explained in Sect. 4.1.

4.3 Errors on the solutions

Legendre collocation is a spectral method with exponential rate of convergence [23]. We define the relative error as a measure of the difference between the solution obtained with Legendre collocation and the solution obtained with the reduced basis procedure divided by the measure of the solution obtained with Legendre collocation. In Fig. 5(a) the norm of the difference between the stationary solution obtained with the reduced basis method and the solution obtained with Legendre collocation divided by the norm of the solution obtained with Legendre collocation in case \(R \in[1101; 3000]\) for solution \(S_{1}\) are presented. The errors are \({\mathcal {O}}(10^{-2})\) far from the bifurcation point, that is already a quite good approximation in comparison with the number of degrees of freedom that have been used in the reduced basis. Near the bifurcation point relative errors increase till \({\mathcal {O}}(10^{-1})\) because those points are critical. The solutions cease to exist at these point. The norm of the solutions goes to zero, for this reason a peak appear near the bifurcation point.

Figure 5
figure 5

(a) Natural logarithm of the norm of the difference between the stationary solution obtained with Legendre collocation and with a reduced basis method based on Legendre collocation divided by the norm of the solution obtained with Legendre collocation without post-processing for solution \(S_{1}\) in the interval of R \([1101 ;3000]\); (b) Norm of the difference between the stationary solution obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation divided by the norm of the solution obtained with Legendre collocation for solution \(S_{1}\) in the interval of R \([1101 ;3000]\)

With the post-processing explained in Sect. 3.4 the solutions are improved, first, by construction the error is zero at \(R=R_{i}\), for the other values of \(R \in[1101;3000]\) the maximum relative error becomes \({\mathcal {O}}(10^{-4})\) outside the bifurcation point, see Fig. 5(b), where the norm of the difference between the stationary solution obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation divided by the norm of the solution obtained with Legendre collocation for solutions \(S_{1}\) in the interval of R \([1101; 3000]\) is drawn. Near the bifurcation point the relative error increases to \({\mathcal {O}}(10^{-3})\). The solutions cease to exist at these point. The norm of the solutions goes to zero, and the errors are relative, for this reason a peak appear near the bifurcation point. A better relative error is obtained for the stable part of solutions \(S_{3}\) in the interval \([1539;3000]\) where the relative errors are \({\mathcal {O}}(10^{-7})\) as can be seen in Fig. 6(a). The relative error for the \(S_{3}\) unstable solutions are not better than \({\mathcal {O}}(10^{-4})\) outside the bifurcation point, near the bifurcation points the relative errors increase to \({\mathcal {O}}(10^{-2})\), as can be seen in Fig. 6(b). The solutions cease to exist at the bifurcation point. The norm of the solutions goes to zero, for this reason a peak appear near the bifurcation point. Figure 7(a) corresponds to relative errors for solution \(S_{5}\) in the interval \([1539;1600]\). Relative errors are \({\mathcal {O}}(10^{-4})\), except near the bifurcation point, where the error is \({\mathcal {O}}(10^{-3})\). Solutions \(S_{5}\) cease to exist at these point, for this reason a peak appear near the bifurcation point. The relative error in the interval \([1600;2000]\) is \({\mathcal {O}}(10^{-4})\) in Fig. 7(b), except a peak that appears \({\mathcal {O}}(10^{-3})\) due to the few values of snapshots considered in this case. A better relative error is obtained for the third part of solution \(S_{5}\) in the interval \([2000;3000]\) where the relative errors are \({\mathcal {O}}(10^{-7})\) as can be seen in Fig. 7(c).

Figure 6
figure 6

Norm of the difference between the stationary solution obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation divided by the norm of the solution obtained with Legendre collocation for solution \(S_{3}\) in the interval of R (a) \([1539;3000]\) and (b) \([1253;1538]\)

Figure 7
figure 7

Norm of the difference between the stationary solution obtained with Legendre collocation and with a post-processed reduced basis method based on Legendre collocation divided by the norm of the solution obtained with Legendre collocation for (a) solution \(S_{5}\) in the interval of R \([1539;1600]\); (b) solution \(S_{5}\) in the interval of R \([1600;2000]\); (c) solution \(S_{5}\) in the interval of R \([2000;3000]\)

4.4 Advantages of reduced basis method

The reduced basis method is supported by standard discretizations. The off-line work for the calculation of the solutions to construct the reduced basis needs these standard methods. But, once the work of the standard method is done, the use of the reduced basis has several advantages.

The pressure variable disappears in the Galerkin approach due to the variational formulation and the incompressibility of the fluid (\(\nabla \cdot\vec{v}=0\)). This fact, together with the few modes required for the Galerkin expansion, provides small matrices with the reduced bases discretization. For a single value of the Rayleigh number R the size of the matrices that appear after the discretizations is 2016 in Legendre collocation with expansions of order \(13 \times35\), whereas in the case of the reduced basis with 8 elements the size of matrices is 16. A factor of 126 in the size of the matrices for each value of R. Legendre collocation matrices are dense by diagonal blocks of size \(14 \times36\).

The behavior of the Newton method for the nonlinearity is improved with respect to standard methods. A branch of solutions of a type refers to the solutions of that kind for different values of the parameter R in the interval where they exist. In the Legendre collocation method case to calculate solutions in a new branch a continuation technique is required, in this case it is based in adding the eigenfunction of the linear stability analysis near the bifurcation point to the base solution as initial guess in the Newton method. Once a solution in a branch is obtained to reach the solution in this branch for a larger value of the Rayleigh number the new solution is considered as initial guess. For a large value of the Rayleigh number the solution must be calculated by increasing slowly the Rayleigh number. For instance, we obtain the first solution in the branch in the interval \([1101; 3000]\) near \(R=1101\). To obtain the solution at \(R=3000\) we need to calculate the solution at \(R=1102\), take this solution as initial guess for \(R=1110\) and calculate the solutions increasing the value of R in steps of 10 till \(R=3000\). Sometimes the steps of increase on R can be larger. So, it is not possible to jump from \(R=1101\) till \(R=3000\) with Legendre collocation. In the reduced basis this is not the case, the solution can be directly calculated for any value of R. The reason for this behavior must be that nothing drive the solutions to be attracted by a different branch since there is not unexpected elements in the basis set. Also solutions obtained with reduced basis method are a great help as guess solutions for the Newton method in Legendre collocation. In fact the Legendre solutions necessary to valuate the errors have been calculated solving first with Galerkin reduced basis and taking this solution as initial guess for Legendre.

The number of operations is drastically reduced. If we calculate the branch of solutions \(S_{5}\) taking steps of 10 in R in the interval \([1538; 3000]\), 146 values of R are required, for the branch in the interval \([1101; 3000]\), 190 values of R and for the branch in the interval \([1252; 3000]\) 175 values of R. Therefore the whole diagram requires 1314 values of R. If we take into account symmetries only 511 values of R are necessary. The problem is nonlinear, if we consider an average of 10 iterations for each problem and we solve the linear systems with a method with \({\mathcal {O}}(N^{2})\) operations, being N the size of the matrices, for each value of R we solve the system with \({\mathcal {O}}(10^{7})\) operations for Legendre collocation and with \({\mathcal {O}}(10^{3})\) with reduced basis. Then multiplying by 103 values of R, \({\mathcal {O}}(10^{10})\) operations for Legendre collocation and \(O(10^{6})\) for reduced basis to obtain the whole bifurcation diagram. The off-line number of operations of reduced basis requires to solve Legendre for order 10 values of the Rayleigh number, therefore \({\mathcal {O}}(10^{8})\) operations.

Summarizing, for a single value of the parameter R, the off-line number of operations is \({\mathcal {O}}(10^{8})\), the on-line maximum number of operations for Legendre collocation is \({\mathcal {O}}(10^{9})\) and for reduced basis \({\mathcal {O}}(10^{3})\). For the whole bifurcation diagram the off-line number of operations is \({\mathcal {O}}(10^{8})\), the on-line number of operations for Legendre collocation is \({\mathcal {O}}(10^{10})\) and for reduced basis \({\mathcal {O}}(10^{6})\).

A significant advantage of solving the eigenvalue problem is provided by the use of a reduced basis, which is due to a large reduction in computational cost. This reduction arises due to the size of the matrices in the eigenvalue problem; in Legendre collocation the size of the matrix is 2016, while using a reduced basis with 8 elements it is only 16. The eigenvalue problem is solved with an adaptation of the implicitly restarted Lanczos method [25]. This method has computational complexity \(O(N^{3})\), where N is the size of the matrix. Therefore for a fixed value of R in Legendre collocation the complexity is \(O(10^{9})\) whereas for reduced basis it is only \(O(10^{3})\), six orders lower. For 1000 values of the Rayleigh number Legendre collocation reaches \(O(10^{12})\) and reduced basis \(O(10^{6})\). This is reflected in the temporal computational cost, which is 122 s when using Legendre collocation and only it is 6 s using a reduced basis. Therefore the reduction is of a factor of 20 in time.

5 Conclusions

We have solved a Rayleigh–Bénard problem in a rectangle using a reduced basis method in an interval of values of the Rayleigh number R where there are four bifurcations and nine different solutions. Different basis have been considered in each branch of solutions. A linear stability analysis on those solutions has been performed with reduced basis. The bifurcation points are correctly captured with the reduced basis method looking at the intersection of branches of solutions or regarding the eigenvalues of the linear stability analysis. The relative errors on the solutions in the unstable branches are of the same order as the stable ones, \({\mathcal {O}}(10^{-2})\), and \({\mathcal {O}}(10^{-4})\) after a post-processing, and become worse near the bifurcation points. Near those points the errors are divided by the norm of solutions that are disappearing, for this reason relative errors become \({\mathcal {O}}(10^{-1})\). The behavior of the Newton method for the nonlinearity is improved with reduced basis method with respect to standard methods. Matrices are small with the reduced basis discretization. For a single value of the Rayleigh number R the size of the matrices that appear after the discretizations are 2016 in Legendre collocation, whereas in the case of the reduced basis with 8 elements the size of matrices are 16 because pressure disappears in this formulation. A factor of 126 in the size of the matrices for each value of R. The computational complexity is less with reduced basis method. For a single value of the parameter R, the off-line number of operations is \({\mathcal {O}}(10^{8})\), the on-line number of operations for Legendre collocation is \({\mathcal {O}}(10^{9})\) and for reduced basis \({\mathcal {O}}(10^{3})\). For the whole bifurcation diagram the off-line number of operations is \({\mathcal {O}}(10^{8})\), the on-line number of operations for Legendre collocation is \({\mathcal {O}}(10^{10})\) and for reduced basis \({\mathcal {O}}(10^{6})\). The advantage of solving the eigenvalue problem with reduced basis is huge as regards with respect to the large reduction of the computational cost. For a fixed value of R in Legendre collocation the complexity is \(O(10^{9})\) whereas for reduced basis it is only \(O(10^{3})\), six orders lower. This is reflected in the reduction in the computational cost in time of a factor of 20. There is a startup work in order to calculate the reduced basis, but once this is done, the reduced basis method permits to speed up the computations of these bifurcation diagrams. A study of the eigenfunction spaces obtained with reduced basis can be also of interest and it will be addressed in future work.