Changes for compatibility with pystencils 2.0
Patch lbmpy for compatibility with pystencils 2.0:
- Adapt code paths and naming to work with both pystencils 1.3.7 and 2.0 where possible
- Introduce (temporary) duplicate code paths where necessary
- Disable features and tests that are not yet available with pystencils 2.0
- Improve and adapt the testsuite, CI config, and packaging along the way
Changes
Compatibility Code Paths
Introduce a module lbmpy._compat that facilitates compatibility between the divergent APIs of pystencils 1.3 and 2.0.
Mask out code paths using the IS_PYSTENCILS_2 flag where necessary.
API and Internal Changes
-
Lookup Tables: The
lbmpy.custom_code_nodesmodule will be replaced by a newlbmpy.lookup_tables, utilizing the novel capability of pystencils 2.0 to treat SymPy tuples as arrays - Boundary Conditions: Introduce explicit type casts at various points as pystencils 2.0 does not allow implicit type conversions
- Fluctuating LB: Adapted to novel API of symbolic random number generators
Testing & CI
- Introduce nox to orchestrate environments and testing
- Adapt CI to use nox sessions where applicable
- Remove
minimal_condaandubuntuCI tasks- Since the
pycodegen/ubuntudocker image is based on a CUDA image, and using a virtual environment for Python, theubuntutask effectively does the same as the Nox+CUDA task
- Since the
- Introduce nox session and CI task to test against pystencils/v2.0-dev
Unavailable Features
The following features will be temporarily unavailable until the underlying systems are either reintroduced in pystencils 2.0, or they can be reimplemented on top of 2.0's novel APIs:
- Loop Splitting (not supported by 2.0 yet)
- In-kernel-boundaries (depend on conditional branches, which have no representation in the 2.0 frontend yet)
- PSM Update Rule with Conditionals (same, depends on conditional branches)
- Oldroyd-B (uses staggered fields, which cannot be handled by the 2.0 backend yet)
- Allen-Cahn contact angle computation (needs conditionals)
Status
-
Fix field duplication in create_lb_update_rule: Remove the workaround once field duplication is fixed in pystencils -
Data types in boundary handling: LatticeBoltzmannBoundaryHandlingdoes not allow to specify a data type and always usesfloat64. This leads to type errors when combined with LB fields withfloat32dtype. -
Mixed precision: Need to explicitly insert casts at field reads/writes when computing and storing PDFs in different float formats -
Test failures with fluctuating LB and sparse LB: Fixed with pystencils!481 (merged) and pystencils!482 (merged), respectively
Edited by Frederik Hennig