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

compute_amplification_matrix(wave_vector) compute the amplification matrix of one time step of the scheme
compute_amplification_matrix_relaxation() compute the amplification matrix of the relaxation.
compute_consistency(dicocons) compute the consistency of the scheme.
create_moments_matrices() Create the moments matrices M and M^{-1} used to transform the repartition functions into the moments
equilibrium(mm) Compute the equilibrium
f2m(ff, mm) Compute the moments m from the distribution functions f
generate(backend, sorder, valin) Generate the code by using the appropriated generator
is_L2_stable([Nk]) test the L2 stability of the scheme
is_monotonically_stable() test the monotonical stability of the scheme.
m2f(mm, ff) Compute the distribution functions f from the moments m
onetimestep(mm, ff, ff_new, in_or_out, valin) Compute one time step of the Lattice Boltzmann method
relaxation(m) The relaxation phase on the moments m
set_boundary_conditions(f, m, bc, interface) Apply the boundary conditions
set_initialization(scheme) set the initialization functions for the conserved moments.
set_source_terms(scheme) set the source terms functions for the conserved moments.
source_term(m[, tn, dt, x, y, z]) The integration of the source term on the moments m
transport(f) The transport phase on the distribution functions f
vp_amplification_matrix(wave_vector) compute the eigenvalues of the amplification matrix