Base class for all lattice Boltzman simulations in Sailfish.
Describes a specific type of a lattice Boltzmann simulation.
Updates the context dicitionary containing variables used for code generation.
Returns a grid object representing the connectivity of the lattice used in the simulation. If the simulation uses more than 1 grid, returns the grid with the highest connectivity.
How many layers of nearest neighbors nodes are required by the model.
Classes for single fluid lattice Boltzmann simulations.
Simulates a single phase fluid.
Args: full_output: if True, returns kernels that prepare fields for
visualization or saving into a file
Grid with the highest connectivity (Q).
Adds support for body forces.
Add a constant global force field acting on the fluid.
Multiple calls to this function will add the value of force to any previously set value. Forces and accelerations are processed separately and are never mixed in this addition process.
Parameters: |
|
---|
Classes to specify global LB simulation geometry and its partitions.
Describes the high-level geometry of a LB simulation.
Helper code for symbolic processing and RTCG.
TargetDist(var, idx)
Alias for field number 1
Alias for field number 0
Get a set of indices which have to be swapped for a full bounce-back.
Get expressions for the BGK equilibrium distribution.
Parameters: | grid – the grid class to be used |
---|---|
Return type: | list of sympy epxressions representing the equilibrium distribution functions |
Get expressions for the external body force correction in the BGK model.
This implements the external force as in Eq. 20 from PhysRevE 65, 046308.
Parameters: | grid – the grid class to be used |
---|---|
Return type: | list of sympy expressions (in the same order as the current grid’s basis) |
Parameters: |
|
---|
Convert a SymPy expression into a string containing valid C code.
Parameters: |
|
---|---|
Return type: | string representing the C code |
Substitute any additional variables directly into the expressions for the equilibrium distribution.
Equilibrium distributions can use additional local variables, which are stored in the form of sympy equalities in the second element of the equilibrium pair. If the abliity to directly evalute the equilibrium distribution is required, this function will substitute the local variables into the expressions.
Express density as a function of the distributions.
Parameters: |
|
---|---|
Return type: | sympy expression for the density |
Express velocity as a function of the distributions.
Parameters: |
|
---|---|
Return type: | sympy expression for the velocity in a given direction |
Computes a list of indices of the distributions that would be transferred to a node pointed to by the vector ‘direction’.
Compute a list of base vectors with a specific value of the X component (dir).
Get a lambdified version of the equilibrium distribution.
Parameters: | sim – a lbm.LBMSim instance |
---|---|
Return type: | iterable of Q callables, Q being the number of basis vectors for the grid used in sim |
Ortogonalize a set of vectors.
Given a set of vectors orthogonalize them using the GramSchmidt procedure. The vectors are then simplified (common factors are removed to keep their norm small).
Parameters: | vectors – a collection of vectors to orthogonalize |
---|---|
Return type: | orthogonalized vectors |
Factorize multivariate polynomials into a sum of products of monomials.
This function can be used to decompose polynomials into a form which minimizes the number of additions and multiplications, and which thus can be evaluated efficently.
Get expressions for the BGK equilibrium distribution for the shallow water equation.