implementations.problem_classes.RayleighBenard module

class CFLLimit(controller, params, description, **kwargs)[source]

Bases: ConvergenceController

static compute_max_step_size(P, u)[source]
dependencies(controller, *args, **kwargs)[source]

Load dependencies on other convergence controllers here.

Parameters:
  • controller (pySDC.Controller) – The controller

  • description (dict) – The description object used to instantiate the controller

Returns:

None

get_new_step_size(controller, step, **kwargs)[source]

This function allows to set a step size with arbitrary criteria. Make sure to give an order to the convergence controller by setting the control_order variable in the params. This variable is an integer and you can see what the current order is by using controller.print_convergence_controllers().

Parameters:
  • controller (pySDC.Controller) – The controller

  • S (pySDC.Step) – The current step

Returns:

None

setup(controller, params, description, **kwargs)[source]

Define default parameters here.

Default parameters are:
  • control_order (int): The order relative to other convergence controllers

  • dt_max (float): maximal step size

  • dt_min (float): minimal step size

Parameters:
  • controller (pySDC.Controller) – The controller

  • params (dict) – The params passed for this specific convergence controller

  • description (dict) – The description object used to instantiate the controller

Returns:

The updated params dictionary

Return type:

(dict)

setup_status_variables(controller, **kwargs)[source]

Add the embedded error variable to the error function.

Parameters:

controller (pySDC.Controller) – The controller

class LogAnalysisVariables[source]

Bases: Hooks

post_step(step, level_number)[source]

Record Nusselt numbers.

Parameters:
  • step (pySDC.Step.step) – the current step

  • level_number (int) – the current level number

Returns:

None

class LogCFL[source]

Bases: Hooks

post_step(step, level_number)[source]

Record CFL limit.

Parameters:
  • step (pySDC.Step.step) – the current step

  • level_number (int) – the current level number

Returns:

None

class RayleighBenard(Prandtl=1, Rayleigh=2000000.0, nx=256, nz=64, BCs=None, dealiasing=1.5, comm=None, Lx=4, Lz=1, z0=0, **kwargs)[source]

Bases: GenericSpectralLinear

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

The equations we solve are

u_x + v_z = 0 T_t - kappa (T_xx + T_zz) = -uT_x - vT_z u_t - nu (u_xx + u_zz) + p_x = -uu_x - vu_z v_t - nu (v_xx + v_zz) + p_z - T = -uv_x - vv_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, 8) x (-1, 1) T(z=+1) = 0 T(z=-1) = 2 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

apply_BCs(sol)[source]

Enforce the Dirichlet BCs at the top and bottom for arbitrary solution. The function modifies the last two modes of u, v, and T in order to achieve this. Note that the pressure is not modified here and the Nyquist mode is not altered either.

Parameters:

sol – Some solution that does not need to enforce boundary conditions

Returns:

Modified version of the solution that satisfies Dirichlet BCs.

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

compute_buoyancy_generation(u)[source]
compute_viscous_dissipation(u)[source]
compute_vorticity(u)[source]
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

getOutputFile(fileName)[source]
get_fig()[source]

Get a figure suitable to plot the solution of this problem

Returns:

self.fig

Return type:

matplotlib.pyplot.figure.Figure

plot(u, t=None, fig=None, quantity='T')[source]

Plot the solution.

Parameters:
  • u (dtype_u) – Solution to be plotted

  • t (float) – Time to display at the top of the figure

  • fig (matplotlib.pyplot.figure.Figure) – Figure with the same structure as a figure generated by self.get_fig. If none is supplied, a new figure will be generated.

  • quantity ((str)) – quantity you want to plot

Return type:

None

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