lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2021-11-02T21:58:04+01:00https://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/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/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/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/96Fix setup dependency2021-09-30T13:44:21+02:00Markus HolzerFix setup dependencyFixes #22Fixes #22Markus 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/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/92Rework force models and central moments transform2021-10-28T13:19:18+02:00Markus HolzerRework force models and central moments transformThis MR provides a complete rework of the force model, so they are functioning in the moment space and the central moment space.
Furthermore, a new implementation for the shift matrix is provided and a rework of the central moment based...This MR provides a complete rework of the force model, so they are functioning in the moment space and the central moment space.
Furthermore, a new implementation for the shift matrix is provided and a rework of the central moment based method.
The central moment transform classes are adapted to be able to work with the changes.
TODOs:
- [x] Test Fixed Density BC when method has a force model
- [x] Forward/Backward Transform for D3Q15
- [x] make cumulants aware of polynomials
- [x] rework cumulants with forceMarkus HolzerMarkus Holzerhttps://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/83Added second order moment getter2021-07-28T22:12:26+02:00itischlerAdded second order moment getterAdded the second order moment getter to calculate the pressure tensor, which is needed for the ESPResSo walberla bridge.Added the second order moment getter to calculate the pressure tensor, which is needed for the ESPResSo walberla bridge.Markus HolzerMarkus Holzerhttps://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/88Add Authors to lbmpy2021-07-05T12:35:50+02:00Markus HolzerAdd Authors to lbmpyAdds authors.txt to lbmpy and citations to the ReadMe. Furthermore, the CI Skript was adapted slightly to have a pre test stage.Adds authors.txt to lbmpy and citations to the ReadMe. Furthermore, the CI Skript was adapted slightly to have a pre test stage.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/71Central moments2021-07-01T14:15:55+02:00Markus HolzerCentral momentsThis MR implements the central moment collision operator. Furthermore, some clean-up in the derivation pipeline is provided.
- [x] derivation of the central moments from the continuous equilibrium
- [x] derivation of the central moments...This MR implements the central moment collision operator. Furthermore, some clean-up in the derivation pipeline is provided.
- [x] derivation of the central moments from the continuous equilibrium
- [x] derivation of the central moments via shift matrix for the discrete equilibrium
- [x] implementation of a central moment class
- [x] finish implementation of the collision
- [x] provide test cases for the operator
- [x] add documentationMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/90Cumulant LBM Minor Fixes2021-07-01T13:10:54+02:00Frederik HennigCumulant LBM Minor Fixes- Fixed incorrect section about forcing in Cumulant Tutorial Notebook
- Made Shift-Matrix based transform the default, since it is more efficient in most situations- Fixed incorrect section about forcing in Cumulant Tutorial Notebook
- Made Shift-Matrix based transform the default, since it is more efficient in most situationshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/87Remove gmpy workaround2021-06-26T15:43:58+02:00Markus HolzerRemove gmpy workaroundRemove pystencils gmpy import because it does not exist anymoreRemove pystencils gmpy import because it does not exist anymoreMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/85Clean-up2021-06-10T14:05:31+02:00Markus HolzerClean-upA little clean-up for lbmpy.A little clean-up for lbmpy.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/81add DiffusionDirichlet boundary condition2021-06-09T17:42:43+02:00Daniel Baueradd DiffusionDirichlet boundary conditionAdd a Dirichlet boundary condition for Advection-Diffusion problems.Add a Dirichlet boundary condition for Advection-Diffusion problems.https://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/80Stream-Only Kernel Fixes2021-06-09T08:00:22+02:00Frederik HennigStream-Only Kernel FixesAmendment to !74. Changed API of `create_stream_only_kernel` to expect fields, instead of field names and/or numpy arrays, to be coherent with `create_lbm_kernel`. Also, stored pre-streaming values in temporary subexpressions - otherwise...Amendment to !74. Changed API of `create_stream_only_kernel` to expect fields, instead of field names and/or numpy arrays, to be coherent with `create_lbm_kernel`. Also, stored pre-streaming values in temporary subexpressions - otherwise values would be overwritten in in-place streaming. Adapted test case to catch this.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/84Use int64 for indexing2021-06-07T15:30:42+02:00Markus HolzerUse int64 for indexingFixes #18
The code is changed in the following way. As an example, a generated UBB boundary is shown. Before the adaption:
```cpp
const int32_t f_in_inv_dir_idx [] = { 0,2,1,4,3,6,5,10,9,8,7,16,15,18,17,12,11,14,13,26,25,24,23,22,2...Fixes #18
The code is changed in the following way. As an example, a generated UBB boundary is shown. Before the adaption:
```cpp
const int32_t f_in_inv_dir_idx [] = { 0,2,1,4,3,6,5,10,9,8,7,16,15,18,17,12,11,14,13,26,25,24,23,22,21,20,19 };
const int32_t f_in_inv_offsets_x [] = { 0,0,0,-1,1,0,0,-1,1,-1,1,0,0,-1,1,0,0,-1,1,1,-1,1,-1,1,-1,1,-1 };
const int32_t f_in_inv_offsets_y [] = { 0,1,-1,0,0,0,0,1,1,-1,-1,1,-1,0,0,1,-1,0,0,1,1,-1,-1,1,1,-1,-1 };
const int32_t f_in_inv_offsets_z [] = { 0,0,0,0,0,1,-1,0,0,0,0,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1 };
const double weights [] = { 0.296296296296296,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963 };
const int32_t neighbour_offset_x [] = { 0,0,0,-1,1,0,0,-1,1,-1,1,0,0,-1,1,0,0,-1,1,1,-1,1,-1,1,-1,1,-1 };
const int32_t neighbour_offset_y [] = { 0,1,-1,0,0,0,0,1,1,-1,-1,1,-1,0,0,1,-1,0,0,1,1,-1,-1,1,1,-1,-1 };
const int32_t neighbour_offset_z [] = { 0,0,0,0,0,1,-1,0,0,0,0,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1 };
for (int64_t ctr_0 = 0; ctr_0 < _size_indexField_0; ctr_0 += 1)
{
const int32_t x = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0]));
const int32_t y = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 4]));
const int32_t z = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 8]));
const int32_t dir = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 12]));
_data_ldc_pdfSrc[x + 452*y + 204304*z + 92345408*f_in_inv_dir_idx[dir] + f_in_inv_offsets_x[dir] + 452*f_in_inv_offsets_y[dir] + 204304*f_in_inv_offsets_z[dir]] = -0.029999999999999999*neighbour_offset_x[dir]*weights[dir] + _data_ldc_pdfSrc[92345408*dir + x + 452*y + 204304*z];
```
After the adaption:
```cpp
const int64_t f_in_inv_dir_idx [] = { 0,2,1,4,3,6,5,10,9,8,7,16,15,18,17,12,11,14,13,26,25,24,23,22,21,20,19 };
const int64_t f_in_inv_offsets_x [] = { 0,0,0,-1,1,0,0,-1,1,-1,1,0,0,-1,1,0,0,-1,1,1,-1,1,-1,1,-1,1,-1 };
const int64_t f_in_inv_offsets_y [] = { 0,1,-1,0,0,0,0,1,1,-1,-1,1,-1,0,0,1,-1,0,0,1,1,-1,-1,1,1,-1,-1 };
const int64_t f_in_inv_offsets_z [] = { 0,0,0,0,0,1,-1,0,0,0,0,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1 };
const double weights [] = { 0.296296296296296,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0740740740740741,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.0185185185185185,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963,0.00462962962962963 };
const int64_t neighbour_offset_x [] = { 0,0,0,-1,1,0,0,-1,1,-1,1,0,0,-1,1,0,0,-1,1,1,-1,1,-1,1,-1,1,-1 };
const int64_t neighbour_offset_y [] = { 0,1,-1,0,0,0,0,1,1,-1,-1,1,-1,0,0,1,-1,0,0,1,1,-1,-1,1,1,-1,-1 };
const int64_t neighbour_offset_z [] = { 0,0,0,0,0,1,-1,0,0,0,0,1,1,1,1,-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1 };
for (int64_t ctr_0 = 0; ctr_0 < _size_indexField_0; ctr_0 += 1)
{
const int64_t x = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0]));
const int64_t y = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 4]));
const int64_t z = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 8]));
const int64_t dir = *((int32_t *)(& _data_indexField[16*_stride_indexField_0*ctr_0 + 12]));
_data_ldc_pdfSrc[x + 452*y + 204304*z + 92345408*f_in_inv_dir_idx[dir] + f_in_inv_offsets_x[dir] + 452*f_in_inv_offsets_y[dir] + 204304*f_in_inv_offsets_z[dir]] = -0.029999999999999999*neighbour_offset_x[dir]*weights[dir] + _data_ldc_pdfSrc[92345408*dir + x + 452*y + 204304*z];
```Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests/82Check if fluctuating LB compiles when vectorized2021-05-27T18:22:35+02:00Michael Kuronmkuron@icp.uni-stuttgart.deCheck if fluctuating LB compiles when vectorized7 of the 8 tests fail until https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/248 is merged.7 of the 8 tests fail until https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/248 is merged.Markus HolzerMarkus Holzer