# Rayleigh–Bénard Convection Using buoyantBoussinesqPimpleFoam

Here is an extremely simple simulation to set up that has a surprisingly beautiful output. In this post, we will simulation the classic Rayleigh–Bénard convection (see Wikipedia) in 3D using the buoyant solver, buoyantBoussinesqPimpleFoam.

buoyantBoussinesqPimpleFoam is a solver for buoyant, turbulent, incompressible flows. The incompressible part of the solver comes from the fact that it uses the Boussinesq approximation for buoyancy which is only suitable for flows with small density changes (aka incompressible). A good source for the equations in this solver is this blog post.

## Simulation Set-up

The basic set-up for this case is simple: a hot bottom surface, a cold top surface, either cyclic or zero-gradient sides, and some initial conditions.

For this example, I used the properties of water, I set the bottom plate at 373 K (don’t ask me why… I know it’s close to boiling point of water), and the top plate at 273 K. For this case, we will not use any turbulent modeling and will simply use a laminar model (this simply means there is only molecular viscosity, there are no simplifications applied to the equations).

### Geometry and Mesh

The geometry is shown below. As the geometry is so simple… I will not go over the blockMesh set up. The mesh discretization that I used was simplegrading (i.e. no inflation), with 200x200x50 cells.

### Constant

For this case, we will simulate water. The transportProperties file should look like:

transportModel Newtonian;

// Laminar viscosity
nu [0 2 -1 0 0 0 0] 1e-06;

// Thermal expansion coefficient
beta [0 0 0 -1 0 0 0] 0.000214;

// Reference temperature
TRef [0 0 0 1 0 0 0] 300;

// Laminar Prandtl number
Pr [0 0 0 0 0 0 0] 7.56;

// Turbulent Prandtl number (not used)
Prt [0 0 0 0 0 0 0] 0.7;

I don’t typically delete unused entries from dictionaries. This makes using previous simulations as templates much easier. Therefore note that the turbulent Prandtl number is in the dictionary but it is not used.

Selecting Reference Temperature TRef for buoyantBoussinesqPimpleFoam. To answer this recall that when the Boussinesq buoyancy approximation is used, the solver does not solve for the density. It solves the relative density using the linear function:

$\frac{\rho}{\rho_0}=1-\beta \left(T-T_0\right)$

Therefore, I think it makes sense that we should choose a temperature for $T_{ref}$ that is somewhere in the range of the simulation. Thus I chose Tref=300. Somewhere in the middle!

And the turbulenceProperties file is:

simulationType laminar;

RAS
{
RASModel laminar;

turbulence off;

printCoeffs off;
}

The g file tells the solver the acceleration due to gravity, as well as the direction:

dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);

### Boundary Conditions

In the “zero” folder, we need the following files: p, p_rgh, T, U, and alphat (this file needs to be present… however it is not used given the laminar simulationType.

T:

dimensions [0 0 0 1 0 0 0];

internalField uniform 273;

boundaryField
{
floor
{
type fixedValue;
value uniform 373;
}
ceiling
{
type fixedValue;
value uniform 273;
}
fixedWalls
{
}
}

p_rgh:

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
floor
{
type fixedFluxPressure;
rho rhok;
value uniform 0;
}

ceiling
{
type fixedFluxPressure;
rho rhok;
value uniform 0;
}

fixedWalls
{
type fixedFluxPressure;
rho rhok;
value uniform 0;
}
}

p:

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
floor
{
type calculated;
value $internalField; } ceiling { type calculated; value$internalField;
}

fixedWalls
{
type calculated;
value \$internalField;
}
}

U:

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
floor
{
type noSlip;
}

ceiling
{
type noSlip;
}

fixedWalls
{
type noSlip;
}
}

## Simulation Results

The results (as always) are the best part. But especially for this case since they are so nice to look at! I have made a couple animations of temperature fields and contours. Enjoy.

## Conclusion

This case demonstrated the simple set up of a case using buoyantBoussinesqPimpleFoam. The case (Rayleigh-Bénard convection) was simulated in 3D on a fine grid.

Comments and questions are welcome! Keep in mind I set this case up very quickly.

If you are struggling with CFD, are interested in getting started, or are looking for consulting services, visit www.stfsol.com for information on CFD consulting services including training, development, private webinars and other simulation services.

Categories

Tags

1. Cham says:

Can i ask you something regarding the solver in advance? Some way of private message or email will do…thanks

2. Rajjo says:

It looks pretty nice. How did you make this kind of resolution? I made the same setup but haven’t got this kind of result.

3. Cfd@kgp says:

Hi, thanks for sharing your simulation results.

I was trying to capture the critical Rayleigh number using Openfoam buoyantBoussinesqPimpleFoam?

However, I am unsuccessful to get the onset close to 1706; as one has to perturb the initial field with the correct scale.

I have tried 2d simulations for a wide aspect ratio case (5:1) with periodic boundary conditions in x-axis, with central differencing scemes for both convective and diffussive terms

Do you have any experience/suggesstion regarding this?
Waiting for earliest positive response from anyone.

4. Saurav kumar says:

Could you please share the case file?
how to create this type of animation that you?