{'fraction_non_alphanumeric': 0.04188738473611928, 'fraction_numerical': 0.013144987247400432, 'mean_word_length': 4.463558413719185, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Spectral method for vorticity-streamfunction equations, with application to Rayleigh-Benard convection

The spectral method with an explicit time integration scheme is implemented to solve the vorticity-streamfunction equations. In spectral method, functions are approximated with finite sums of periodic sine and cosine functions, which makes this method suitable for periodic problems. Numerical experiments for several cases are discussed. In Rayleigh-Benard convection problem, a horizontal layer of incompressible fluid is kept within high and low temperatures along the bottom and top boundaries, respectively. Triggered by a periodic initial condition, we simulate the occurrence of a regular pattern of convection cells, known as Benard cells.


Introduction
Transfer of heat in a medium can occur by means of three possible mechanisms, conduction, convection and radiation. Convective heat transfer is the transfer of heat from one place to another by the movement of fluid molecules due to temperature difference in the fluid. If one region of the fluid is heated, it will become less dense compare to its surroundings, and due to buoyancy, give rise to transport of fluid molecules. This is the underlying physical mechanism of heat convection process. Rayleigh-Benard's convection is a simple convection system that occurs in a layer of fluid heated from below (Hepworth 2014 [6]). In this phenomenon, the fluid develops a regular pattern of convection, known as Benard cells.
In Rayleigh-Benard convection, heat transfer in a fluid between two rigid plates with different fixed temperature is observed. This problem was firstly initiated by Henri Benard in 1900. He made an experiment on the instability of fluid in a thin layer that was heated from below involving the surface tension and thermo-capillary convection (Sandberg 2011 [7]). In 1916 Lord Rayleigh [9], who was inspired by Benard's experiment, derived the theoritical demands for temperature gradient convection. He predicted that instability occurs when the temperature gradient is large enough, and that the onset of the convection is governed by Rayleigh number, R a , that exceed a certain critical value. Further work in this area is recorded by Chandrasekhar 1961 [5], which is also be the foremost text on linear theory of Rayleigh-Benard convection.  [3], the Rayleigh-Benard problem was solved by using Fourier -Chebyshev approximation. In this paper, we simulate the similar phenomenon using the spectral method. In this method, the solution is represented as a truncated Fourier series expansion, therefore this method is appropriate for periodic problem. Derivation of the governing equations for Rayleigh-Benard convection is presented in Sections 2 and 3. Then we describe the numerical implementation and the results of linear part in Sections 4 and 5.

Vorticity-streamfunction equations
Vorticity-streamfunction equations are derived from the Navier-Stokes equations for incompressible flow [4]. It consists of the conservation of momentum and mass Let V = (u, v) describes the velocity vector of the fluid, p as the pressure (divided by constant density ρ), ν as the kinematic viscosity, τ as the time constant for linear frictional damping in the 2D flow, and f as a forcing term. To obtain the vorticity-streamfunction equations, we apply curl operator on the momentum equation so that we have where ω is the vorticity defined as ω ≡ |∇ × V| = (|∂ x v − ∂ y u|)k with F = |∇ × fk| is the forcing term, and k the unit vector normal to the (x, y) plane of the flow. Vorticity is related to the interaction of local swirls or eddies in the fluid.
Considering the conservation of mass in equation (2), there exist a scalar function Ψ(x, y) which is called streamfunction so that the velocity vector can be written as V = ∇ × (ψk). Hence, the conservation of mass can be satisfied automatically since div curl is a zero operator. So the fluid velocity and the vorticity are related to the stream function by

Rayleigh-Benard convection problem
Rayleigh-Benard is a thermal convection problem that occurs when a layer of fluid is heated from below. As response to the non-uniform temperature distribution, the fluid develops a regular pattern of convection known as Benard cells. To accommodate the non-uniform temperature, the following energy conservation equation is taken with T is the fluid temperature, and κ T thermal diffusivity. Fluid density depends on temperature according to ρ = ρ 0 (1 − α T (T − T 0 )) with ρ 0 is the reference fluid density associated with the reference temperature T 0 , and α T is the thermal expansion coefficient. Here, fluid motion is affected by the buoyant force f = ρ ρ 0 g, with g the gravitational vector field. Therefore, the forcing term in the vorticity equation is F = |∇ × f | = gα T ∂ x T . If we neglect the frictional damping, the governing equations written in full are as follows In this problem, three independent variables are involved, those are vorticity ω, stream function ψ, and temperature T , all of them are functions of dependent variables x, y, t. The governing equations (6)(7)(8) hold in a 2D domain with −H/2 < y < 0 and 0 < x < L, with H and L are typical height and length, respectively. The Rayleigh-Benard problem takes place in a long channel, and therefore periodicity in x-direction can be assumed. Further, there is no fluid flow across the upper and lower boundary, which leads to the following boundary conditions The upper and lower temperatures are kept constant, to yield the following boundary conditions with T 1 − T 2 is positive, since in this case the fluid is heated from below.

Normalized variables
Our computations will be conducted to the normalized equations, and therefore we first introduce the following normalized variables The governing equations (6)-(8) written in dimensionless variables are The above equations hold in a domain 0 < X < 2π and −π < Y < 0. The boundary conditions (9),(10) are now read The velocity vector W = (U, V ) is related to the stream function by with a = H/L. In the above equations, gradient, Laplace operator, and the vorticity in the transformed variables are We note that in the normalized formulation, there is only two non-dimensional numbers, those are the Prandtl number P r and Rayleigh number R a defined as In the next section, these normalized equations will be solved numerically using spectral method, and in this article we restrict to the linear model.

Implementation
The Rayleigh-Benard problem that we consider has Dirichlet boundary conditions of different temperatures along the top and bottom boundaries. In order to implement the spectral method, the problem should be formulated in periodic form, so here we extend the y−interval to [−π, π]. Hence, equations (13)-(15) is solved in a domain 0 < X < 2π and −π < Y < π with boundary conditions θ = 1, Consider the linear part of equation (13) and (14) ∂tθ − ∇ 2 θ = 0, (21) Apply Fourier transform to the above equations to get the following ordinary differential equations ∂tθ k,l = − a 2 k 2 + l 2 θ k,l , The explicit time integration of Crank-Nicholson scheme is implemented to yield Ω n+1 k,l = 1 − ∆t 2 P r a 2 k 2 + l 2 Ω n k,l + ∆t 16π 3 aP r R a ik θ n+1 k,l +θ n k,l 1 + ∆t 2 P r (a 2 k 2 + l 2 ) .
Streamfunction can be computed by applying Fourier transform to equation (15) so that Ψ =Ω/(a 2 k 2 + l 2 ). The streamfunction is needed to calculate the velocity W and the nonlinear terms that is not investigated in this paper.

Results
In this section the numerical results for the linear part of Rayleigh-Benard convection problem is presented. There are three cases of simulation with different initial conditions. For the first one, we set the initial condition for temperature θ(X, Y, 0) = cos(X) and vorticity Ω(X, Y, 0) = 0. We use P r = 0.71, R a = 6 × 10 3 , and ∆t = 10 −3 as the parameters. The simulation shows that the temperature becomes θ = |Y |/π which is the steady state solution, and the vorticity develops a regular pattern of convection cells known as Benard cells. These results are shown in Figure 1 and 2.   Figure 2. Vorticity with initial condition θ(X, Y, 0) = cos(X) and Ω(X, Y, 0) = 0 (a) at t = 0 (b) at t = 0.5 (c) at t = 1 (d) at t = 2.
In the next case, we set the initial condition of the temperature θ(X, Y, 0) = cos(4x) and the vorticity Ω(X, Y, 0) = 0. Figure 3 and 4 present the result of this case. The temperature has the same behavior as the previous case, which becomes the steady solution. And the regular pattern of convection cells appear in the vorticity field.  In the previous simulations, the spectral method has been succesfully applied to simulate the Rayleigh-Benard convection problems. It was shown that due to high temperature as bottom boundary, fluid temperature will eventually change to a steady temperature, whereas the vorticity develop Benard cells.
Finally, in the last simulation, we start with an initial temperature, which is a perturbation of the steady temperature. To be explicit, we set the initial condition for the temperature θ(X, Y, 0) = |Y |/π + 10 −3 and vorticity Ω(X, Y, 0) = 0, whereas parameters are the same as the previous simulations. Result for the vorticity is shown in Figure 5. At the early stage of simulation, an irregular pattern of convection cells appear, but then as time progresses, it developes into a regular pattern. In this case, we also have fluid temperature that tends to the steady temperature θ = |Y |/π. But the figure is not given here because the perturbation is too small to be visible in temperature plots.

Conclusions
The spectral method with an explicit time integration scheme has been formulated to solve the vorticity stream function equations. For the linearized model, the resulting scheme has been used to simulate various thermal convection problems. Steady state solution was simulated, also the development of Benard cells in a layer of horizontal fluid heated from below. Moreover, simulation result shows that perturbation of steady temperature also induces a regular pattern.

Acknowledgement
The authors acknowledge the financial support of research grant Riset KK ITB 2017.