Demo: Automatic Chapman Enskog Analysis

from lbmpy.session import *
from lbmpy.chapman_enskog import ChapmanEnskogAnalysis
sp.init_printing()

Demo: Automatic Chapman Enskog Analysis#

First, we create a SRT lattice Boltzmann method. It is defined as the set of moments, together with one relaxation rate per moment.

lb_config = LBMConfig(method=Method.TRT, stencil=Stencil.D3Q19, compressible=False, zero_centered=False)
method = create_lb_method(lbm_config=lb_config)
method
Moment-Based Method Stencil: D3Q19 Zero-Centered Storage: ✗ Force Model: None
Continuous Hydrodynamic Maxwellian Equilibrium $f (\rho, \left( u_{0}, \ u_{1}, \ u_{2}\right), \left( v_{0}, \ v_{1}, \ v_{2}\right)) = \frac{3 \sqrt{6} \delta_{\rho} e^{- \frac{3 v_{0}^{2}}{2} - \frac{3 v_{1}^{2}}{2} - \frac{3 v_{2}^{2}}{2}}}{4 \pi^{\frac{3}{2}}} + \frac{3 \sqrt{6} e^{- \frac{3 \left(- u_{0} + v_{0}\right)^{2}}{2} - \frac{3 \left(- u_{1} + v_{1}\right)^{2}}{2} - \frac{3 \left(- u_{2} + v_{2}\right)^{2}}{2}}}{4 \pi^{\frac{3}{2}}}$
Compressible: ✗ Deviation Only: ✗ Order: 2
Relaxation Info
Moment Eq. Value Relaxation Rate
$1$ $\rho$ $\omega$
$x$ $u_{0}$ $\omega$
$y$ $u_{1}$ $\omega$
$z$ $u_{2}$ $\omega$
$x^{2}$ $\frac{\rho}{3} + u_{0}^{2}$ $\omega$
$y^{2}$ $\frac{\rho}{3} + u_{1}^{2}$ $\omega$
$z^{2}$ $\frac{\rho}{3} + u_{2}^{2}$ $\omega$
$x y$ $u_{0} u_{1}$ $\omega$
$x z$ $u_{0} u_{2}$ $\omega$
$y z$ $u_{1} u_{2}$ $\omega$
$x^{2} y$ $\frac{u_{1}}{3}$ $\omega$
$x^{2} z$ $\frac{u_{2}}{3}$ $\omega$
$x y^{2}$ $\frac{u_{0}}{3}$ $\omega$
$x z^{2}$ $\frac{u_{0}}{3}$ $\omega$
$y^{2} z$ $\frac{u_{2}}{3}$ $\omega$
$y z^{2}$ $\frac{u_{1}}{3}$ $\omega$
$x^{2} y^{2}$ $\frac{\rho}{9} + \frac{u_{0}^{2}}{3} + \frac{u_{1}^{2}}{3}$ $\omega$
$x^{2} z^{2}$ $\frac{\rho}{9} + \frac{u_{0}^{2}}{3} + \frac{u_{2}^{2}}{3}$ $\omega$
$y^{2} z^{2}$ $\frac{\rho}{9} + \frac{u_{1}^{2}}{3} + \frac{u_{2}^{2}}{3}$ $\omega$

Next, the Chapman Enskog analysis object is created. This may take a while…

analysis = ChapmanEnskogAnalysis(method)

This object now information about the method, e.g. the relation of relaxation rate to viscosities, if the method approximates the compressible or incompressible continuity equation …

analysis.compressible
False
analysis.pressure_equation
../_images/21ae73f1b5b3eb5dc21f747dddc2638b1ed275ebf807f0ca6a5169a01bb10a3c.png
analysis.get_kinematic_viscosity()
../_images/33c8a3b3f0a1605772f58612ab7f7e39bfe3d8f1379a9a03d41f865b343685b6.png
analysis.get_bulk_viscosity()
../_images/9d1b039c2524643709f888fdff10f53fc222e08cf588817ffb45de4c1111015c.png

But also details of the analysis are available:

sp.Matrix(analysis.get_macroscopic_equations())
../_images/3e4a023a685fe796dcca78c246c8f4cfb971eb275b7771235dbeb3f4749ada0f.png