pylbm.Scheme

class pylbm.Scheme(dico, stencil=None, check_inverse=False)

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.

dim

spatial dimension

Type

int

dx

space step

Type

double

dt

time step

Type

double

la

scheme velocity, ratio dx/dt

Type

double

nscheme

number of elementary schemes

Type

int

stencil

a stencil of velocities

Type

object of class Stencil

P

list of polynomials that define the moments

Type

list of sympy matrix

EQ

list of the equilibrium functions

Type

list of sympy matrix

s

relaxation parameters (exemple: s[k][l] is the parameter associated to the lth moment in the kth scheme)

Type

list of list of doubles

M

the symbolic matrix of the moments

Type

sympy matrix

Mnum

the numeric matrix of the moments (m = Mnum F)

Type

numpy array

invM

the symbolic inverse matrix

Type

sympy matrix

invMnum

the numeric inverse matrix (F = invMnum m)

Type

numpy array

generator

the used generator ( NumpyGenerator, CythonGenerator, …)

Type

Generator

ode_solver

the used ODE solver ( explicit_euler, heun, …)

Type

ode_solver,

Examples

see demo/examples/scheme/

__init__(dico, stencil=None, check_inverse=False)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(dico[, stencil, check_inverse])

Initialize self.

compute_amplification_matrix(wave_vector)

compute the amplification matrix of one time step of the scheme for the given wave vector.

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 for a given wave vector.