pylbm.
Scheme
(dico, stencil=None, check_inverse=False)¶Create the class with all the needed informations for each elementary scheme.
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
int
dx
¶space step
double
dt
¶time step
double
la
¶scheme velocity, ratio dx/dt
double
nscheme
¶number of elementary schemes
int
P
¶list of polynomials that define the moments
list of sympy matrix
EQ
¶list of the equilibrium functions
list of sympy matrix
s
¶relaxation parameters (exemple: s[k][l] is the parameter associated to the lth moment in the kth scheme)
list of list of doubles
M
¶the symbolic matrix of the moments
sympy matrix
Mnum
¶the numeric matrix of the moments (m = Mnum F)
numpy array
invM
¶the symbolic inverse matrix
sympy matrix
invMnum
¶the numeric inverse matrix (F = invMnum m)
numpy array
generator
¶the used generator (
NumpyGenerator
,
CythonGenerator
,
…)
Generator
ode_solver
¶the used ODE solver (
explicit_euler
,
heun
,
…)
ode_solver
,
Examples
see demo/examples/scheme/
__init__
(dico, stencil=None, check_inverse=False)¶Initialize self. See help(type(self)) for accurate signature.
Methods
|
Initialize self. |
|
compute the amplification matrix of one time step of the scheme for the given wave vector. |
|
compute the amplification matrix of the relaxation. |
|
compute the consistency of the scheme. |
|
Create the moments matrices M and M^{-1} used to transform the repartition functions into the moments |
|
Compute the equilibrium |
|
Compute the moments m from the distribution functions f |
|
Generate the code by using the appropriated generator |
|
test the L2 stability of the scheme |
|
test the monotonical stability of the scheme. |
|
Compute the distribution functions f from the moments m |
|
Compute one time step of the Lattice Boltzmann method |
|
The relaxation phase on the moments m |
|
Apply the boundary conditions |
|
set the initialization functions for the conserved moments. |
|
set the source terms functions for the conserved moments. |
|
The integration of the source term on the moments m |
|
The transport phase on the distribution functions f |
|
compute the eigenvalues of the amplification matrix for a given wave vector. |