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
analysis.get_kinematic_viscosity()
analysis.get_bulk_viscosity()
But also details of the analysis are available:
sp.Matrix(analysis.get_macroscopic_equations())