<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7ff4007f0d00>
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7f0d39f23760>
%% Cell type:markdown id: tags:
One can check if a method is orthogonalized:
...
...
@@ -189,18 +193,20 @@
Another popular method is the cascaded lattice Boltzmann method. The cascaded LBM increases the numerical stability by shifting the collision step to the central moment space. Thus it is applied in the non-moving frame and achieves a better Galilean invariance. Typically the central moment collision operator is derived for compressible LB methods, and a higher-order equilibrium is used. Although incompressible LB methods with a second-order equilibrium can be derived with lbmpy, it violates the Galilean invariance and thus reduces the advantages of the method.
<lbmpy.methods.momentbased.centralmomentbasedmethod.CentralMomentBasedLbMethod at 0x7ff400771910>
<lbmpy.methods.momentbased.centralmomentbasedmethod.CentralMomentBasedLbMethod at 0x7f0d39c84d90>
%% Cell type:markdown id: tags:
The shift to the central moment space is done by applying a so-called shift matrix. Usually, this introduces a high numerical overhead. This problem is solved with lbmpy because each transformation stage can be specifically optimised individually. Therefore, it is possible to derive a CLBM with only a little numerical overhead.
...
...
@@ -307,16 +313,16 @@
This nested moment list can be passed to `create_lb_method`:
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7ff4005d7160>
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7f0d39cceac0>
%% Cell type:markdown id: tags:
If one needs to also specify custom equilibrium moments the following approach can be used
...
...
@@ -347,11 +353,11 @@
method
```
%%%% Output: execute_result
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7ff400465f10>
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7f0d39bf1c10>
%% Cell type:markdown id: tags:
Instead of manually defining all entries in the method table, *lbmpy* has functions to fill the table according to a specific pattern. For example:
- for a full stencil (D2Q9, D3Q27) there exist exactly 9 or 27 linearly independent moments. These can either be taken as they are, or orthogonalized using Gram-Schmidt, weighted Gram-Schmidt or a Hermite approach
...
...
@@ -373,11 +379,11 @@
method
```
%%%% Output: execute_result
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7ff4004bfac0>
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7f0d39bfbc70>
%% Cell type:markdown id: tags:
Our customized method can be directly passed into one of the scenarios. We can for example set up a channel flow with it. Since we used symbols as relaxation rates, we have to pass them in as `kernel_params`.
When creating a monomial cumulant method, one option is to specify only a single relaxation rate which will then be assigned to all cumulants related to the shear viscosity. In this case, all other non-conserved cumulants will be relaxed to equilibrium. Alternatively, individual relaxation rates for all non-conserved cumulants can be specified. The conserved cumulants are set to zero by default to save computational cost. They can be adjusted with `set_zeroth_moment_relaxation_rate`, `set_first_moment_relaxation_rate` and `set_conserved_moments_relaxation_rate`.
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f52c30150a0>
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f1b2d7d6070>
%% Cell type:markdown id: tags:
### Relaxation of Polynomial Cumulants
By setting `method="cumulant"`, a set of default polynomial cumulants is chosen to be relaxed. Those cumulants are taken from literature and assembled into groups selected to enforce rotational invariance (see: `lbmpy.methods.centeredcumulant.centered_cumulants`). Default polynomial groups are available for the D2Q9, D3Q19 and D3Q27 stencils. As before it is possible to specify only a single relaxation rate assigned to the moments governing the shear viscosity. All other relaxation rates are then automatically set to one.
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f52d37f5940>
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f1b339eeb20>
%% Cell type:markdown id: tags:
### Central Moments and Forcing
...
...
@@ -139,11 +141,11 @@
method_with_force
```
%%%% Output: execute_result
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f52c2fd6880>
<lbmpy.methods.centeredcumulant.centeredcumulantmethod.CenteredCumulantBasedLbMethod at 0x7f1b33d73460>
%% Cell type:markdown id: tags:
## C) Exemplary simulation: flow around sphere
...
...
@@ -209,17 +211,20 @@
We choose a cumulant lattice Boltzmann method, as described above. Here the second-order cumulants are relaxed with the relaxation rate calculated above. All higher-order cumulants are relaxed with one, which means we set them to the equilibrium.
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7f0b1feea940>
<lbmpy.methods.momentbased.momentbasedmethod.MomentBasedLbMethod at 0x7fc79c0cb7f0>
%% Cell type:markdown id: tags:
Only the collision rule has to be changed. Thus we first construct the collision rule, add the Smagorinsky equations and create a normal scenario from the modified collision rule. To avoid that the macroscopic quantity symbols in the Smagorinsky equations fall prey to optimization, we must disable simplification:
For both LB steps, a weighted orthogonal MRT (WMRT) method is used. It is also possible to change the method to a simpler SRT scheme or a more complicated CLBM scheme. The CLBM scheme can be obtained by commenting in the python snippets in the notebook cells below. Note here that the hydrodynamic LB step is formulated as an incompressible velocity-based LBM. Thus, the velocity terms can not be removed from the equilibrium in the central moment space.