implementations.problem_classes.RayleighBenard3D module

class RayleighBenard3D(Prandtl=1, Rayleigh=1000000.0, nx=64, ny=64, nz=32, BCs=None, dealiasing=1.5, comm=None, Lz=1, Lx=4, Ly=4, useGPU=False, **kwargs)[source]

Bases: GenericSpectralLinear

Rayleigh-Benard Convection is a variation of incompressible Navier-Stokes.

The equations we solve are

u_x + v_y + w_z = 0 T_t - kappa (T_xx + T_yy + T_zz) = -uT_x - vT_y - wT_z u_t - nu (u_xx + u_yy + u_zz) + p_x = -uu_x - vu_y - wu_z v_t - nu (v_xx + v_yy + v_zz) + p_y = -uv_x - vv_y - wv_z w_t - nu (w_xx + w_yy + w_zz) + p_z - T = -uw_x - vw_y - ww_z

with u the horizontal velocity, v the vertical velocity (in z-direction), T the temperature, p the pressure, indices denoting derivatives, kappa=(Rayleigh * Prandtl)**(-1/2) and nu = (Rayleigh / Prandtl)**(-1/2). Everything on the left hand side, that is the viscous part, the pressure gradient and the buoyancy due to temperature are treated implicitly, while the non-linear convection part on the right hand side is integrated explicitly.

The domain, vertical boundary conditions and pressure gauge are

Omega = [0, Lx) x [0, Ly] x (0, Lz) T(z=+1) = 0 T(z=-1) = Lz u(z=+-1) = v(z=+-1) = 0 integral over p = 0

The spectral discretization uses FFT horizontally, implying periodic BCs, and an ultraspherical method vertically to facilitate the Dirichlet BCs.

Parameters:
  • Prandtl (float) – Prandtl number

  • Rayleigh (float) – Rayleigh number

  • nx (int) – Horizontal resolution

  • nz (int) – Vertical resolution

  • BCs (dict) – Can specify boundary conditions here

  • dealiasing (float) – Dealiasing factor for evaluating the non-linear part

  • comm (mpi4py.Intracomm) – Space communicator

compute_Nusselt_numbers(u)[source]

Compute the various versions of the Nusselt number. This reflects the type of heat transport. If the Nusselt number is equal to one, it indicates heat transport due to conduction. If it is larger, advection is present. Computing the Nusselt number at various places can be used to check the code.

Parameters:

u – The solution you want to compute the Nusselt numbers of

Returns:

Nusselt number averaged over the entire volume and horizontally averaged at the top and bottom.

Return type:

dict

dtype_f

alias of imex_mesh

dtype_u

alias of mesh

eval_f(u, *args, **kwargs)[source]

Abstract interface to RHS computation of the ODE

Parameters:
  • u (dtype_u) – Current values.

  • t (float) – Current time.

Returns:

f – The RHS values.

Return type:

dtype_f

get_frequency_spectrum(u)[source]

Compute the frequency spectrum of the velocities in x and y direction in the horizontal plane for every point in z. If the problem is well resolved, the coefficients will decay quickly with the wave number, and the reverse indicates that the resolution is too low.

The returned spectrum has three dimensions. The first is for component (i.e. u or v), the second is for every point in z and the third is the energy in every wave number.

Parameters:

u – The solution you want to compute the spectrum of

Returns:

wave numbers RayleighBenard3D.xp.ndarray: spectrum

Return type:

RayleighBenard3D.xp.ndarray

u_exact(t=0, noise_level=0.001, seed=99)[source]