lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2021-09-26T14:55:52+02:00https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/93Dataclasses for method creation2021-09-26T14:55:52+02:00Markus HolzerDataclasses for method creationIn lbmpy large dicts are created to manage all parameters for the lb method and the pystencils kernel parameters. This MR introduces dataclasses to manage all these parameters. Furthermore, a better integration with pystencils is achieve...In lbmpy large dicts are created to manage all parameters for the lb method and the pystencils kernel parameters. This MR introduces dataclasses to manage all these parameters. Furthermore, a better integration with pystencils is achieved since pystencils introduced dataclasses lately.
Fixes #1Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/94Fix smagorinsky2021-09-26T15:20:30+02:00Markus HolzerFix smagorinskyThe Smagorinsky model was adapted in !93. This change should ensure that a smagorinsky model can also be added when omega is not a symbol but a number.
However, due to a small issue, only collision rules with omega being a number can be...The Smagorinsky model was adapted in !93. This change should ensure that a smagorinsky model can also be added when omega is not a symbol but a number.
However, due to a small issue, only collision rules with omega being a number can be generated at the moment. With this MR, this issue is fixed again.
Furthermore, some wrong type hints in the LBMConfig class have been correctedMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/95Pre-Collision PDFs in Macroscopic Quantity Kernels2021-11-09T07:58:55+01:00Frederik HennigPre-Collision PDFs in Macroscopic Quantity KernelsAdded flags to `macroscopic_values_getter` and `macroscopic_values_setter` to explicitly use pre-collision PDFs. Required for consistent initialization in the presence of forces.Added flags to `macroscopic_values_getter` and `macroscopic_values_setter` to explicitly use pre-collision PDFs. Required for consistent initialization in the presence of forces.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/96Fix setup dependency2021-09-30T13:44:21+02:00Markus HolzerFix setup dependencyFixes #22Fixes #22Markus 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/100Adaption to new API2021-10-27T15:32:20+02:00Markus HolzerAdaption to new APIWith this MR, all test cases etc should be adapted to the new API. Since all test cases are touched anyway some adaptions are made additionally. The vast majority is just formatting and removing for loops over parameter sets completely t...With this MR, all test cases etc should be adapted to the new API. Since all test cases are touched anyway some adaptions are made additionally. The vast majority is just formatting and removing for loops over parameter sets completely to replace it with the pytest functionality. A larger change is the removal of the serial scenarios since these used the LBM module of waLBerlas python coupling. However, this module is removed for almost a year now.
Furthermore, the broken elementwise multiplication from SymPy is removed (https://github.com/sympy/sympy/issues/22353).
Further changes:
- It is not simple to build entropic collision operators when forces are involved. A long and clear error message has been added if such a case occurs
- Default moment sets have been moved to their own file as they only pollute the creation functions
- Addition of better documentation for the LBMConfig and LBMOptimisation Classes
- Addition of the `_get_relaxation_info_dict` function which defines how relaxation rates are set for all methods.
- Dokumentation for the Enum classes
- Filter warnings for third party warnings
- Fixing of the maximum supported SymPy version to 1.9Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/101Fix longrun2021-10-28T10:27:17+02:00Markus HolzerFix longrun- Fixes `test_modes_central_moment_longrun`.
- Removes benchmark case, because it is outdated. The issue to reintroduce it again is #19
- Small fix to make entropic LBM work again, when relaxation rate for conserved quantities is not de...- Fixes `test_modes_central_moment_longrun`.
- Removes benchmark case, because it is outdated. The issue to reintroduce it again is #19
- Small fix to make entropic LBM work again, when relaxation rate for conserved quantities is not defined.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/102Remove Mathjax path2021-10-29T14:36:31+02:00Markus HolzerRemove Mathjax pathAt the moment the LaTeX rendering in the HMTL output of the docu is broken.
Apparently, the mathjax hack introduced with !92 breaks the LaTeX rendering in the doc.At the moment the LaTeX rendering in the HMTL output of the docu is broken.
Apparently, the mathjax hack introduced with !92 breaks the LaTeX rendering in the doc.Markus HolzerMarkus Holzerhttps://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/104D3Q7 Stencil2021-11-02T21:58:04+01:00Markus HolzerD3Q7 StencilThis MR adds a D3Q7 stencil to lbmpy which can be used for advection-diffusion equations.This MR adds a D3Q7 stencil to lbmpy which can be used for advection-diffusion equations.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/105Relaxation rates should be floats2021-11-10T20:37:52+01:00Markus HolzerRelaxation rates should be floatsdefault rrs should be floats. Otherwise, this gives problems in the vectorisation.default rrs should be floats. Otherwise, this gives problems in the vectorisation.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/107shorten test cases2021-11-16T09:11:04+01:00Markus Holzershorten test casesFixes #27Fixes #27Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/108Set maximal version of lbmpy to maximal version of pystencils2021-11-09T18:41:15+01:00Markus HolzerSet maximal version of lbmpy to maximal version of pystencilsIt does not make sense to have a version of pystencils which is newer than the lbmpy version.It does not make sense to have a version of pystencils which is newer than the lbmpy version.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/109Fix data type for LB weight info2021-11-16T11:54:35+01:00Markus HolzerFix data type for LB weight info`LbmWeightInfo` used `double` as fixed type. The switch to `float` should be supported`LbmWeightInfo` used `double` as fixed type. The switch to `float` should be supportedMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/110Remove OpenCL support2021-11-22T23:30:24+01:00Markus HolzerRemove OpenCL supportDue to pystencils!278 the OpenCL support of lbmpy needs to be removedDue to pystencils!278 the OpenCL support of lbmpy needs to be removedMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/111Minor fixes to the central moment method.2021-12-15T15:21:56+01:00Frederik HennigMinor fixes to the central moment method.Added missing auto-simplification to central moment based method. Fixed broken simplification in FastCentralMomentTransform.Added missing auto-simplification to central moment based method. Fixed broken simplification in FastCentralMomentTransform.https://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 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/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.