lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2019-08-14T10:45:46+02:00https://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/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/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/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/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/98Generalisation of Relaxation rate setter2021-10-27T23:34:18+02:00Markus HolzerGeneralisation of Relaxation rate setterAll methods that have a high number of free relaxation rates have different logic for how the list of relaxation rates is set. First of all, this causes a lot of confusing and unnecessary code and second it is confusing for the user.
In...All methods that have a high number of free relaxation rates have different logic for how the list of relaxation rates is set. First of all, this causes a lot of confusing and unnecessary code and second it is confusing for the user.
In this MR the logic for setting the relaxation rate is generalised and then used in all methods.
- If only one relaxation rate is given by the user it is set as the shear relaxation rate.
- If a relaxation rate for all moments is defined they are just used.
- Otherwise, the conserved moments are relaxed with zero, the next two relaxation rates in the list are used for bulk and shear viscosity and the remaining ones are used to relax a complete group of the same order. If too many relaxation rates are given the list is just cut and the remaining ones have no influence.Markus HolzerMarkus Holzerhttps://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/23Ignore walberla_scenario_setup if waLBerla is not installed2020-01-23T20:22:22+01:00Stephan SeitzIgnore walberla_scenario_setup if waLBerla is not installedThis file directly imports waLBerla.This file directly imports waLBerla.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/6implemented the phase_field model of Abas Fakhari2019-09-23T10:58:39+02:00Markus Holzerimplemented the phase_field model of Abas Fakharihttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/7implemented unconventional D3Q27 stencil by Abbas Fakhari2019-10-01T16:04:03+02:00Markus Holzerimplemented unconventional D3Q27 stencil by Abbas FakhariIn the paper [3D phase-field](https://www.sciencedirect.com/science/article/abs/pii/S0301932217309369) is written :
> As for the discrete velocity set of the D3Q27 lattice used for the hydro-
dynamics, a slightly unconventional orderin...In the paper [3D phase-field](https://www.sciencedirect.com/science/article/abs/pii/S0301932217309369) is written :
> As for the discrete velocity set of the D3Q27 lattice used for the hydro-
dynamics, a slightly unconventional ordering was used in order to align the
first 15 velocity directions with the D3Q15 model.
Therefore I also implemented this stencil with the name fakhari.
For the D3Q15 stencil they used: *premnath*https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/91Improved Moment-Based Method2021-08-05T20:33:29+02:00Frederik HennigImproved Moment-Based MethodRemade collision rule derivation for the moment-based method. Instead of bunching moment matrix multiplication, moment-wise relaxation and backward transformation into one equation, these steps are now split:
- Pre-collision moments are...Remade collision rule derivation for the moment-based method. Instead of bunching moment matrix multiplication, moment-wise relaxation and backward transformation into one equation, these steps are now split:
- Pre-collision moments are computed from populations by a chimera transform (or, optionally, matrix-vector-multiplication) and stored as subexpressions. This step also simplifies the conserved quantity equations by expressing them in terms of raw moments.
- Relaxation and forces are applied in moment space. Post-collision moments are stored as subexpressions. To this end, a `moment_space_forcing` interface was added to common force models.
- Post-collision populations are computed from post-collision moments by matrix-vector-multiplication with splitting of symmetric and asymmetric parts.
- If moment-space forcing is not available, force terms are added in populations space.
The new derivation process yields MRT collision rules with much fewer FLOPs than previously obtained within lbmpy. For D3Q27 compressible orthogonal weighted MRT, only 441 operations are counted, where previously 750-780 FLOPs were counted. The old derivation method is still available and used by default for SRT and TRT, still yielding the most efficient equations in population space.
Requires functionality introduced in pycodegen/pystencils!258.
To Do:
- [x] Documentation and Tutorial Notebookshttps://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/49Lees Edwards boundary conditions2021-01-22T16:47:22+01:00Sebastian Bindgen Lees Edwards boundary conditionsThis notebook shows how to implement use Lees-Edwards boundary conditions to set up a sheared fluid in lbmpy.
Depends on https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/198
Fixes #7This notebook shows how to implement use Lees-Edwards boundary conditions to set up a sheared fluid in lbmpy.
Depends on https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/198
Fixes #7Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/53Link-Wise Extrapolation Outflow2021-01-20T16:56:41+01:00Frederik HennigLink-Wise Extrapolation OutflowThe ExtrapolationOutflow Boundary is reworked to a link-wise implementation because the current implementation causes problems in conjunction with MPI communication in waLBerla.The ExtrapolationOutflow Boundary is reworked to a link-wise implementation because the current implementation causes problems in conjunction with MPI communication in waLBerla.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/3Magic block offset symbols for Walberla2019-08-12T16:53:58+02:00Michael Kuronmkuron@icp.uni-stuttgart.deMagic block offset symbols for WalberlaFor https://i10git.cs.fau.de/pycodegen/lbmpy_walberla/merge_requests/1.
Fixes https://i10git.cs.fau.de/pycodegen/lbmpy/issues/2.For https://i10git.cs.fau.de/pycodegen/lbmpy_walberla/merge_requests/1.
Fixes https://i10git.cs.fau.de/pycodegen/lbmpy/issues/2.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/28Mention `opencl` option in README.md2020-06-03T08:52:24+02:00Stephan SeitzMention `opencl` option in README.mdhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/21minor documentation fix for Shan-Chen2019-12-19T23:28:41+01:00Michael Kuronmkuron@icp.uni-stuttgart.deminor documentation fix for Shan-ChenThis sum counts over the number of lattice vectors, which is not necessarily (and not in this 2-dimensional test) 19.This sum counts over the number of lattice vectors, which is not necessarily (and not in this 2-dimensional test) 19.Martin BauerMartin Bauerhttps://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/132More tests for fluctuating LB2022-10-25T16:13:12+02:00Markus HolzerMore tests for fluctuating LBDue to Issue 188 in waLBerla, this MR introduces more test cases for the fluctuating LB to make sure it works as intendedDue to Issue 188 in waLBerla, this MR introduces more test cases for the fluctuating LB to make sure it works as intendedMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/52Move special fd stencils to lbmpy2021-01-11T18:35:37+01:00Markus HolzerMove special fd stencils to lbmpyMarkus HolzerMarkus Holzer