lbmpy merge requestshttps://i10git.cs.fau.de/pycodegen/lbmpy/-/merge_requests2021-10-28T10:27:17+02:00https://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/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/96Fix setup dependency2021-09-30T13:44:21+02:00Markus HolzerFix setup dependencyFixes #22Fixes #22Markus 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/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/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/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/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/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/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/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 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/79Extend and fix documentation2021-05-12T17:51:22+02:00Markus HolzerExtend and fix documentationSome parts of the documentation were not referenced properly. Since we ran `sphinx` twice and one time without warnings as error treatment these warnings got unnoticed. This hack was necessary due to a new sphinx version. However, it see...Some parts of the documentation were not referenced properly. Since we ran `sphinx` twice and one time without warnings as error treatment these warnings got unnoticed. This hack was necessary due to a new sphinx version. However, it seems like we don`t need it anymore.
Furthermore, the documentation is extended a little bit and corrected in some parts.Markus HolzerMarkus Holzer