Full Support for Zero-Centered Storage
-
Review changes -
-
Download -
Patches
-
Plain diff
This merge request introduces several changes into the heart of lbmpy to finally allow unrestricted usage of zero-centered PDF storage and to decouple storage format from compressibility. This requires several major incisions:
Conserved Quantity Computation
The DensityVelocityComputation
class is updated. It shall now take compressible
and zero_centered
as separate arguments and handle populations and macroscopic quantities accordingly. The x_order_moment_symbol[s]
properties are deprecated in favor of more specific symbol getters. A dedicated density_deviation_symbol
is introduced to clearly separate density \rho
, background density \rho_0
and density fluctuation \delta \rho
, s.t. \rho = \rho_0 + \delta\rho
in all situations. Depending on zero-centering, either \rho
or \delta\rho
are computed from PDFs, and the other one is inferred accordingly.
Equilibrium Formulations
So far, lbmpy separates formulations of its hydrodynamic equilibria into continuous vs. discrete and compressible vs. incompressible. The full-PDF storage format is implicitly assumed for the compressible case, while zero-centered storage is implicitly assumed in the incompressible case. This has been known to lead to a lot of confusion. In particular, the formation of the incompressible equilibrium moment values is quite hacky and not at all obvious.
With this MR, the hydrodynamic equilibrium shall be fully encapsulated in a dedicated class, which hides all technicalities of computing equilibrium moments and derivation of the equilibrium PDF (continuous or discrete). It will fully handle compressibility and zero-centering, and all information about the equilibrium will be held in one place. Once an instance of an equilibrium is created, it shall be immutable.
The hydrodynamic equilbria, both continuous and discrete, are derived from a common base class AbstractEquilibrium
, which provides a common interface, as well as caching functionality for the computation of moments. It can be extended by custom subclasses for describing custom equilibrium distributions.
To date, instances of the *Method
classes have only held a set of moments with associated equilibrium values. In the future, however, the method instances shall hold an equilibrium class instance instead of moment equilibrium values. It still manages its own moments and relaxation rate, but equilibrium values of moments are derived on demand, and only through the equilibrium object's interface.
Full vs. Delta-Equilibrium
The equation governing PDF storage is \vec{f} = \vec{w} + \delta\vec{f}
, where \vec{w}
are the lattice weights, and \delta\vec{f}
are the fluctuations, which are the values to be stored in the zero-centered case. Equivalently, both compressible and incompressible equilibria can be expressed both in their absolute form or only by their deviation (delta) from the rest state Let \Psi
be the continuous Maxwellian equilibrium. Like for the PDFs, the reference state, called background distribution, is \Psi (\rho_0, 0)
. Depending on compressibility and full or delta format, we obtain four different equilibria:
compressible | incompressible | |
---|---|---|
full | \Psi(\rho, \vec{u}) |
\Psi(\rho_0, \vec{u}) + \Psi(\delta\rho, 0) |
delta | \Psi(\rho, \vec{u}) - \Psi(\rho_0, 0) |
\Psi(\rho_0, \vec{u}) - \Psi(\rho_0, 0) + \Psi(\delta\rho, 0) |
Regularly stored PDFs may be relaxed immediately to the full equilibria, and zero-centered PDFs can be immediately relaxed to the delta equilibria. To relax zero-centered PDFs against the full equilibria, the constant background part must first be added and subtracted again after the collision. This might be necessary because especially central moments of the delta-equilibria become more complicated, introducing velocity dependencies that degrade the CM method's numerical properties. Furthermore, it will definitely be necessary for cumulant LBMs, as cumulants of the delta-equilibrium are potentially undefined.
Analogously, in theory, you could relax the full PDF vector against the delta-equilibrium, but there isn't really a point to that, hence it is not supported.
Moment Transform Classes
Depending on zero-centering and choice of equilibrium (delta or full), the transformation of PDFs to moments and back might have to add in the constant background part. The transform classes are adapted accordingly.
Interface
All of this substructure shall be invisible to the everyday user, while at the same time providing a cleaner and easier to work with an ecosystem for the power user. All possible configurations for equilibrium are encapsulated in three arguments to the creation functions:
-
compressible
, defaultFalse
-
zero_centered
, defaultTrue
, -
delta_equilibrium
, defaultNone
, inferred according to the chosen method.
Supersedes !97 (closed). Depends on pystencils!285 (merged) and pystencils!286 (merged).
Merge request reports
- version 38954aa5b8
- version 378e15a3f8
- version 362ca0433b
- version 35c0c06faf
- version 34b72a2f45
- version 338c62de37
- version 3269922553
- version 31d320341a
- version 3056623640
- version 297f1425d4
- version 28085d719c
- version 27018cf5fc
- version 26eeb16000
- version 255cdd070c
- version 2424d498a4
- version 232ee924dd
- version 2225dc9349
- version 21dd66e6bc
- version 207df54896
- version 1999aa4b79
- version 189903be73
- version 17b2ad4cb3
- version 165f9933a2
- version 15a0f157c9
- version 14265965bd
- version 1338589306
- version 120484f5c8
- version 112a91d29a
- version 106a9acc05
- version 9fb7da4ad
- version 852a75552
- version 74c4ec353
- version 68b4582d9
- version 566ce5cc3
- version 47baeee84
- version 34a8948e6
- version 2445d7a43
- version 15d911af7
- master (base)
- latest version3fc22a6948 commits,
- version 38954aa5b847 commits,
- version 378e15a3f846 commits,
- version 362ca0433b45 commits,
- version 35c0c06faf44 commits,
- version 34b72a2f4543 commits,
- version 338c62de3742 commits,
- version 326992255340 commits,
- version 31d320341a39 commits,
- version 305662364038 commits,
- version 297f1425d437 commits,
- version 28085d719c36 commits,
- version 27018cf5fc35 commits,
- version 26eeb1600034 commits,
- version 255cdd070c33 commits,
- version 2424d498a432 commits,
- version 232ee924dd31 commits,
- version 2225dc934930 commits,
- version 21dd66e6bc29 commits,
- version 207df5489627 commits,
- version 1999aa4b7924 commits,
- version 189903be7323 commits,
- version 17b2ad4cb322 commits,
- version 165f9933a221 commits,
- version 15a0f157c920 commits,
- version 14265965bd19 commits,
- version 133858930616 commits,
- version 120484f5c815 commits,
- version 112a91d29a14 commits,
- version 106a9acc0512 commits,
- version 9fb7da4ad10 commits,
- version 852a755529 commits,
- version 74c4ec3538 commits,
- version 68b4582d97 commits,
- version 566ce5cc36 commits,
- version 47baeee845 commits,
- version 34a8948e64 commits,
- version 2445d7a433 commits,
- version 15d911af72 commits,
- Side-by-side
- Inline
Files
83Changes are too large to be shown.
View file @ 3fc22a69