lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2022-03-30T11:26:48+02:00https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/116Adapted to SymPy 1.102022-03-30T11:26:48+02:00Markus HolzerAdapted to SymPy 1.10In this MR a small change in the simplifications of lbmpy is introduced due to https://github.com/sympy/sympy/issues/23297
Furthermore, minor clean upIn this MR a small change in the simplifications of lbmpy is introduced due to https://github.com/sympy/sympy/issues/23297
Furthermore, minor clean upMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/113Full Support for Zero-Centered Storage2022-04-06T20:19:29+02:00Frederik HennigFull Support for Zero-Centered StorageThis 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:
## Conser...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`, default `False`
- `zero_centered`, default `True`,
- `delta_equilibrium`, default `None`, inferred according to the chosen method.
Supersedes !97. Depends on pycodegen/pystencils!285 and pycodegen/pystencils!286.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/118Cassons2022-04-14T10:54:46+02:00Markus HolzerCassonsAdding the Cassons model to lbmpyAdding the Cassons model to lbmpyMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/119[BugFix] Wrong factor in Casson model2022-04-26T16:36:03+02:00Markus Holzer[BugFix] Wrong factor in Casson modelFixes a wrong factor in the Casson modelFixes a wrong factor in the Casson modelMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/120Adaption to pystencils's new type system2022-05-12T12:15:13+02:00Markus HolzerAdaption to pystencils's new type systemAdapts lbmpy to pystencils's new type systemAdapts lbmpy to pystencils's new type systemMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/122Creationfunctions now update LBMConfig. Small fix to `GenericDiscreteEquilibr...2022-05-24T09:05:45+02:00Frederik HennigCreationfunctions now update LBMConfig. Small fix to `GenericDiscreteEquilibrium`.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/121Remove entropic srt2022-05-24T12:19:34+02:00Markus HolzerRemove entropic srtRemove Entropic SRT and minor changesRemove Entropic SRT and minor changesMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/123Short Straming pattern demo2022-06-17T13:44:48+02:00Markus HolzerShort Straming pattern demoThis MR provides a short tutorial on streaming patterns and implements the EsoPull and EsoPush streaming patternThis MR provides a short tutorial on streaming patterns and implements the EsoPull and EsoPush streaming patternMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/125Fixed headlines in streaming pattern demo2022-06-23T08:58:51+02:00Frederik HennigFixed headlines in streaming pattern demoSubsection headers in the streaming pattern demo notebook were marked `#` instead of `##`, causing Sphinx to treat them as top-level (section) headers and listing them all on the left-hand side panel in the documentation.Subsection headers in the streaming pattern demo notebook were marked `#` instead of `##`, causing Sphinx to treat them as top-level (section) headers and listing them all on the left-hand side panel in the documentation.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/124Fix: Broken He model population space forcing with zero-centered storage2022-06-23T13:27:04+02:00Frederik HennigFix: Broken He model population space forcing with zero-centered storageThe population-space equations of the He force model were not derived correctly when using zero-centered storage,
introducing $`\rho`$-dependent terms and a nonvanishing zeroth moment.
- Fixed He model in population space
- Extended m...The population-space equations of the He force model were not derived correctly when using zero-centered storage,
introducing $`\rho`$-dependent terms and a nonvanishing zeroth moment.
- Fixed He model in population space
- Extended momentum test case to check for mass conservationFrederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/128Fix longruns2022-07-02T16:02:10+02:00Markus HolzerFix longrunsMarkus HolzerMarkus Holzer