lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2021-05-17T10:48:32+02:00https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/74Generalize stream only kernel2021-05-17T10:48:32+02:00Markus HolzerGeneralize stream only kernelThere exists a `create_stream_pull_only_kernel`. This could be generalized for all Access patternsThere exists a `create_stream_pull_only_kernel`. This could be generalized for all Access patternsMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/150Generalise Cumulant simplificaiton2023-08-03T12:53:59+02:00Markus HolzerGeneralise Cumulant simplificaitonIn the cumulant method, the elimination of the logarithm only works when occurring exclusively or inside a `sp.Mul` expression. This MR generalises it to detect all log expressionsIn the cumulant method, the elimination of the logarithm only works when occurring exclusively or inside a `sp.Mul` expression. This MR generalises it to detect all log expressionsMarkus 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/89FreeSlip2021-07-09T10:14:40+02:00Markus HolzerFreeSlipThis MR adds FreeSlip boundary conditions to lbmpy. Fixes #3This MR adds FreeSlip boundary conditions to lbmpy. Fixes #3Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/147Fourth-order correction for cumulants2023-07-18T12:49:48+02:00Helen SchottenhammlFourth-order correction for cumulantsAdds the fourth-order diffusion correction to the D3Q27 cumulants, as proposed in [Geier et al. (2017)](https://doi.org/10.1016/j.jcp.2017.05.040). Also adds the possibility to use limiters for the third-order cumulants in order to incre...Adds the fourth-order diffusion correction to the D3Q27 cumulants, as proposed in [Geier et al. (2017)](https://doi.org/10.1016/j.jcp.2017.05.040). Also adds the possibility to use limiters for the third-order cumulants in order to increase stability.
This MR depends on the MR [pystencils!338](https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/338) and can only be merged afterwards.Helen SchottenhammlHelen Schottenhammlhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/11Fluctuating MRT: use the correct prefactors2019-11-06T12:41:01+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFluctuating MRT: use the correct prefactorsAs discovered by @rudolfweeber, the temperatures were wrong. This happened because we didn't correctly calculate the normalization prefactors.
I have now confirmed that `stencil="D3Q19", method="mrt"` produces the same prefactors as t...As discovered by @rudolfweeber, the temperatures were wrong. This happened because we didn't correctly calculate the normalization prefactors.
I have now confirmed that `stencil="D3Q19", method="mrt"` produces the same prefactors as the [Ladd/Schiller/Dünweg](https://doi.org/10.1103/PhysRevE.76.036704)-style D3Q19 MRT. Thermalization should probably also work when using any of the other methods (TRT, SRT, MRT3), but there no reference values of these prefactors are available in literature.
That paper also provides reference values for `stencil="D2Q9", method="mrt"`, which we reproduce after switching to their orthogonalization:
```diff
--- a/lbmpy/methods/creationfunctions.py
+++ b/lbmpy/methods/creationfunctions.py
@@ -10,7 +10,7 @@ from lbmpy.maxwellian_equilibrium import (
compressible_to_incompressible_moment_value, get_cumulants_of_continuous_maxwellian_equilibrium,
get_cumulants_of_discrete_maxwellian_equilibrium,
get_moments_of_continuous_maxwellian_equilibrium,
- get_moments_of_discrete_maxwellian_equilibrium)
+ get_moments_of_discrete_maxwellian_equilibrium, get_weights)
from lbmpy.methods.abstractlbmethod import RelaxationInfo
from lbmpy.methods.conservedquantitycomputation import DensityVelocityComputation
from lbmpy.methods.cumulantbased import CumulantBasedLbMethod
@@ -388,9 +388,16 @@ def create_mrt_orthogonal(stencil, relaxation_rate_getter=None, maxwellian_momen
moment_to_relaxation_rate_dict = OrderedDict()
if have_same_entries(stencil, get_stencil("D2Q9")):
moments = get_default_moment_set_for_stencil(stencil)
- orthogonal_moments = gram_schmidt(moments, stencil)
+ weights = get_weights(stencil, sp.Rational(1,3))
+ orthogonal_moments = gram_schmidt(moments, stencil, weights)
orthogonal_moments_scaled = [e * common_denominator(e) for e in orthogonal_moments]
nested_moments = list(sort_moments_into_groups_of_same_order(orthogonal_moments_scaled).values())
+ sq = x ** 2 + y ** 2
+ nested_moments[2][0] = 3 * sq - 2
+ nested_moments[2][1] = 2 * x ** 2 - sq
+ nested_moments[3][0] = (3 * sq - 4) * x
+ nested_moments[3][1] = (3 * sq - 4) * y
+ nested_moments[4][0] = 9 * sq ** 2 - 15 * sq + 2
elif have_same_entries(stencil, get_stencil("D3Q15")):
sq = x ** 2 + y ** 2 + z ** 2
nested_moments = [
```Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/15Fluctuating MRT: requires weighted-orthogonal method2019-11-27T16:47:42+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFluctuating MRT: requires weighted-orthogonal methodThis merge request makes sure that one gets an error message if an inappropriate LB method is chosen. Currently, `create_mrt_orthogonal` does not allow for explicitly choosing weighted vs. unweighted orthogonalization (see #5), but I int...This merge request makes sure that one gets an error message if an inappropriate LB method is chosen. Currently, `create_mrt_orthogonal` does not allow for explicitly choosing weighted vs. unweighted orthogonalization (see #5), but I intend to fix that soon.
I still need to talk to Ulf Schiller to learn whether his specific orthogonalization of D3Q19 involved any secret tricks.
Closes #6.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/4Fluctuating LB needs zero mean and unit variance random numbers2019-08-14T10:45:46+02:00Michael Kuronmkuron@icp.uni-stuttgart.deFluctuating LB needs zero mean and unit variance random numbersMartin BauerMartin Bauerhttps://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/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/50Fixed build doc2020-12-21T11:49:29+01:00Markus HolzerFixed build docDue to an update of `sphinxcontrib-bibtex` a .bib file must be specified for the documentation to work.Due to an update of `sphinxcontrib-bibtex` a .bib file must be specified for the documentation to work.Michael Kuronmkuron@icp.uni-stuttgart.deMichael Kuronmkuron@icp.uni-stuttgart.dehttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/42Fix: momentum density calculation2021-03-29T16:31:12+02:00Helen SchottenhammlFix: momentum density calculationFixes the momentum density calculation for compressible methods with force model.
Before the macroscopic velocity shift was used, now we introduce the macroscopic momentum density shift to avoid dividing by the density twice in the force...Fixes the momentum density calculation for compressible methods with force model.
Before the macroscopic velocity shift was used, now we introduce the macroscopic momentum density shift to avoid dividing by the density twice in the force correction step.
Solves issue #14.Markus 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/41Fix: Boundary Index List Tests now also check `single_link=True`2020-10-07T11:53:59+02:00Frederik HennigFix: Boundary Index List Tests now also check `single_link=True`The error fixed by pycodegen/pystencils!169 was allowed to pass because the test cases did not check for the `single_link=True` case.The error fixed by pycodegen/pystencils!169 was allowed to pass because the test cases did not check for the `single_link=True` case.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/59Fix warnings2021-02-04T22:25:28+01:00Markus HolzerFix warningsThis MR should fix some warnings which are shown in the pipelines.This MR should fix some warnings which are shown in the pipelines.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/158Fix uninserted aliases in cumulant collision rules + new test cases2023-11-16T09:07:46+01:00Frederik HennigFix uninserted aliases in cumulant collision rules + new test casesToo few insertion passes where run on the cumulant kernel. Fixed that, and introduced a test case to check for desired simplification behaviour in MRT methods.Too few insertion passes where run on the cumulant kernel. Fixed that, and introduced a test case to check for desired simplification behaviour in MRT methods.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/161Fix Ubuntu CI2024-01-15T15:30:31+01:00Frederik HennigFix Ubuntu CIAfter recent changes to the Ubuntu CI container, the CI config was no longer valid. This MR fixes it.After recent changes to the Ubuntu CI container, the CI config was no longer valid. This MR fixes it.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/32Fix sympy 1.62020-06-15T20:58:14+02:00Markus HolzerFix sympy 1.6fixed bugs caused by upgrading to sympy 1.6fixed bugs caused by upgrading to sympy 1.6https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/33Fix split error2020-06-22T13:48:19+02:00Markus HolzerFix split errorWhen the split algorithm is used in combination with an output field a `KeyError` error was thrown. This error arises because the split simplification is added before the output fields were added to the collision rule. Thus, the simplifi...When the split algorithm is used in combination with an output field a `KeyError` error was thrown. This error arises because the split simplification is added before the output fields were added to the collision rule. Thus, the simplification strategy did not know about the additional assignments.
The error is was fixed by reordering the code in `createfunctions.py`.Helen SchottenhammlHelen Schottenhammlhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/67fix some test problems found on Apple ARM642021-02-22T16:43:14+01:00Michael Kuronmkuron@icp.uni-stuttgart.defix some test problems found on Apple ARM64Problems related to unhashable lists, hard-coded vector instruction sets, and undeclared dependenciesProblems related to unhashable lists, hard-coded vector instruction sets, and undeclared dependenciesMarkus HolzerMarkus Holzer