lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2022-09-23T10:45:40+02:00https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/130Fixed extraction of common srt eq term2022-09-23T10:45:40+02:00Frederik HennigFixed extraction of common srt eq termIntegration of zero-centered storage has broken a simplification step central to SRT/TRT methods. This MR fixes it.Integration of zero-centered storage has broken a simplification step central to SRT/TRT methods. This MR fixes it.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/127Rework of the Cumulant-Based Method2022-09-15T17:24:23+02:00Frederik HennigRework of the Cumulant-Based MethodThis MR updates the cumulant-based LB method to better fit into our updated modelling framework.
Several components are changed:
### Central Moment to Cumulant Transform
- Now derives equations for polynomial cumulants, with monomials...This MR updates the cumulant-based LB method to better fit into our updated modelling framework.
Several components are changed:
### Central Moment to Cumulant Transform
- Now derives equations for polynomial cumulants, with monomials as intermediary values
- No longer ignores cumulants of zeroth and first order
- No longer simplifies according to a-priori assumptions about zeroth and first order cumulants, but emits equations containing logarithms and exponentials that need to be simplified later
### Cumulant-Based Method
- Renamed to `CumulantBasedLbMethod`
- Forces are now applied symmetrically in central moment space according to the given force model, no more 'implicit forcing'
- Zeroth and first order cumulants are now treated regularily
- The Galilean correction was extracted as an a-posteriori-modification
### Force Models
- Introduced interface method `symmetric_central_moment_forcing` for use with the cumulant method and implemented it for `Simple`, `Luo`, `Guo` and `He`
### Central Moment Transform
- Introduced `BinomialChimeraTransform` as a new central moment transform class.
### Method Creation
- Cumulant-based methods are now created like all other methods using `create_with_equilibrium`, and are thus open for use with arbitrary custom equilibria
### Simplification
The changes to the derivation did increase the FLOP count of the cumulant method slightly.
- Added `insert_logs` to eliminate exponentials and logarithms in the cumulant-based method
- Added `expand_post_collision_central_moments` to simplify post-collision equations
- Added `insert_conserved_quantity_products` and `insert_half_force` to simplify expressions in central moment and cumulant based methods that depend only on conserved quantitites or the body forceFrederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/129Notebooks of PHLBM FSLBM comparison2022-08-30T12:52:44+02:00Markus HolzerNotebooks of PHLBM FSLBM comparisonMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/128Fix longruns2022-07-02T16:02:10+02:00Markus HolzerFix longrunsMarkus HolzerMarkus Holzerhttps://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/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/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/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/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/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/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/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/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/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/117Integrate AllenCahn fully in lbmpy2022-03-29T18:06:17+02:00Markus HolzerIntegrate AllenCahn fully in lbmpyUpdates the Allen-Cahn model and integrates it fully with lbmpyUpdates the Allen-Cahn model and integrates it fully with lbmpyMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/114SquaredChannel2022-03-10T09:05:32+01:00Markus HolzerSquaredChannelFixes the failing square channel test in the windows pipeline. The test does not fail in other pipelines and it is hard to tell where this is coming from. The assumption for now is numerical issues that might be solved with !113Fixes the failing square channel test in the windows pipeline. The test does not fail in other pipelines and it is hard to tell where this is coming from. The assumption for now is numerical issues that might be solved with !113Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/115Fix FreeSlip boundary condition2022-03-02T18:24:03+01:00Daniel BauerFix FreeSlip boundary conditionThere is an issue with the proxy field substitution and the FreeSlip boundary condition.
This is true in particular if the normal vector is not pre-determined as implemented in https://i10git.cs.fau.de/walberla/walberla/-/merge_requests/...There is an issue with the proxy field substitution and the FreeSlip boundary condition.
This is true in particular if the normal vector is not pre-determined as implemented in https://i10git.cs.fau.de/walberla/walberla/-/merge_requests/520.
Currently, with the pull pattern the following substitutions are performed:
```
f_in[0,0](invdir[dir]) ← f_in[{indexField}_{0}^{wnx},{indexField}_{0}^{wny}](indexField[0](ref_dir))
->
pdfs[{f_{in inv offsets x}}_{dir},{f_{in inv offsets y}}_{dir},{f_{in inv offsets z}}_{dir}](f_in_inv_dir_idx[dir]) ← pdfs[{indexVector}_{0}^{wnx} + {f_{in offsets x}}_{{indexVector}_{0}^{ref_dir}},{indexVector}_{0}^{wny} + {f_{in offsets y}}_{{indexVector}_{0}^{ref_dir}},{indexVector}_{0}^{wnz} + {f_{in offsets z}}_{{indexVector}_{0}^{ref_dir}}](indexVector[0](ref_dir))
```
Whereas the correct substitutions are:
```
f_in[0,0](invdir[dir]) ← f_in[{indexField}_{0}^{wnx},{indexField}_{0}^{wny}](indexField[0](ref_dir))
->
pdfs[{f_{in inv offsets x}}_{dir},{f_{in inv offsets y}}_{dir},{f_{in inv offsets z}}_{dir}](f_in_inv_dir_idx[dir]) ← pdfs[{indexVector}_{0}^{wnx} + {f_{in inv offsets x}}_{dir},{indexVector}_{0}^{wny} + {f_{in inv offsets y}}_{dir},{indexVector}_{0}^{wnz} + {f_{in inv offsets z}}_{dir}](indexVector[0](ref_dir))
```
The problem is that the population index (ref_dir) is used to determine a spatial offset.
This MR in its current form fixes this issue for the particular case of the FreeSlip condition and the pull pattern.
Other configurations break.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/103Oldroyd-B2022-02-14T09:45:15+01:00Michael Kuronmkuron@icp.uni-stuttgart.deOldroyd-BHere is the Oldroyd-B viscoelastic method I published in https://doi.org/10.1140/epje/s10189-020-00005-6. A Poiseuille flow test case is included.
Resolves https://i10git.cs.fau.de/walberla/walberla/-/issues/158Here is the Oldroyd-B viscoelastic method I published in https://doi.org/10.1140/epje/s10189-020-00005-6. A Poiseuille flow test case is included.
Resolves https://i10git.cs.fau.de/walberla/walberla/-/issues/158Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/99Shan-Chen tutorial fixes2022-02-12T16:53:13+01:00Alexander ReinauerShan-Chen tutorial fixesI included the changes i made to the tutorial during the espresso summer school to make it momentum conserving.
The comparison with the reference data is now done after 1000 timesteps for the two-component version and also only done up t...I included the changes i made to the tutorial during the espresso summer school to make it momentum conserving.
The comparison with the reference data is now done after 1000 timesteps for the two-component version and also only done up to an error of 1e-4. The reason is that there is a difference in the velocity-calculation using the Guo-force correction, the reference implementation always uses the current force whereas this notebook uses the old force value. I might be wrong here but the version from this notebook seems more physical to me.Michael Kuronmkuron@icp.uni-stuttgart.deMichael Kuronmkuron@icp.uni-stuttgart.dehttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/112Fix precision problems2021-12-21T11:14:02+01:00Markus HolzerFix precision problemsSee pystencils!282See pystencils!282Markus HolzerMarkus Holzer