pyLBM.Scheme

class pyLBM.Scheme(dico, stencil=None)

Create the class with all the needed informations for each elementary scheme.

Parameters:

dico : a dictionary that contains the following key:value

  • dim : spatial dimension (optional if the box is given)
  • scheme_velocity : the value of the ratio space step over time step (la = dx / dt)
  • schemes : a list of dictionaries, one for each scheme
  • generator : a generator for the code, optional (see Generator)
  • ode_solver : a method to integrate the source terms, optional (see ode_solver)
  • test_stability : boolean (optional)

Notes

Each dictionary of the list schemes should contains the following key:value

  • velocities : list of the velocities number
  • conserved moments : list of the moments conserved by each scheme
  • polynomials : list of the polynomial functions that define the moments
  • equilibrium : list of the values that define the equilibrium
  • relaxation_parameters : list of the value of the relaxation parameters
  • source_terms : dictionary do define the source terms (optional, see examples)
  • init : dictionary to define the initial conditions (see examples)

If the stencil has already been computed, it can be pass in argument.

Examples

see demo/examples/scheme/

Attributes

dim (int) spatial dimension
dx (double) space step
dt (double) time step
la (double) scheme velocity, ratio dx/dt
nscheme (int) number of elementary schemes
stencil (object of class Stencil) a stencil of velocities
P (list of sympy matrix) list of polynomials that define the moments
EQ (list of sympy matrix) list of the equilibrium functions
s (list of list of doubles) relaxation parameters (exemple: s[k][l] is the parameter associated to the lth moment in the kth scheme)
M (sympy matrix) the symbolic matrix of the moments
Mnum (numpy array) the numeric matrix of the moments (m = Mnum F)
invM (sympy matrix) the symbolic inverse matrix
invMnum (numpy array) the numeric inverse matrix (F = invMnum m)
generator (Generator) the used generator ( NumpyGenerator, CythonGenerator, ...)
ode_solver (ode_solver,) the used ODE solver ( explicit_euler, heun, ...)

Methods

create_moments_matrix : Create the moments matrices
create_relaxation_function : Create the relaxation function
create_equilibrium_function : Create the equilibrium function
create_transport_function : Create the transport function
create_f2m_function : Create the function f2m
create_m2f_function : Create the function m2f
generate : Generate the code
equilibrium : Compute the equilibrium
transport : Transport phase
relaxation : Relaxation phase
f2m : Compute the moments from the distribution functions
m2f : Compute the distribution functions from the moments
onetimestep : One time step of the Lattice Boltzmann method
set_initialization : set the initialization functions for the conserved moments
set_source_terms : set the source terms functions
set_boundary_conditions : Apply the boundary conditions
compute_amplification_matrix_relaxation : compute the amplification matrix of the relaxation
compute_amplification_matrix(wave_vector) : compute the amplification matrix of one time step of the scheme for the given wave vector
vp_amplification_matrix(wave_vector) : compute the eigenvalues of the amplification matrix for a given wave vector
is_L2_stable : test the L2 stability of the scheme
is_monotonically_stable : test the monotonical stability of the scheme