Advanced Streaming Extensions
This patch extends lbmpy's support for advanced streaming patterns. In particular, the Push-Collide-Stream, AA-Pattern and Esoteric Twist are considered.
-
Boundary Handling: The LBM boundary implementations are overhauled completely. A new framework for defining and generating boundary kernels is introduced, which makes the symbolic definition independent of the streaming pattern. Boundaries can now be defined symbolically using the proxy fields
f_out
for accessing populations streaming out of a cell, andf_in
for populations streaming in to a cell. Those are replaced during the code generation process according to the streaming pattern. The classBetweenTimestepsIndexing
used herein can also be used to generate other kernels that run on the PDF-field in-between collision steps. -
Periodicity Handling: The build-in periodicity synchronization of pystencil's
DataHandling
does not work for advanced LBM streaming. The new classLBMPeriodicityHandling
extends theSerialDataHandling
to handle periodicity correctly. -
Utility: The patch introduces a few utility functions for the work with advanced streaming patterns.
Merge request reports
Activity
- lbmpy/advanced_streaming/indexing.py 0 → 100644
72 inward_accesses = ( 73 even_accessor if odd_to_even else odd_accessor).read(pdf_field, stencil) 74 75 self.outward_accesses = outward_accesses 76 self.inward_accesses = inward_accesses 77 78 self.pdf_field = pdf_field 79 self.stencil = stencil 80 self.directions = ['x', 'y', 'z'][:len(stencil[0])] 81 82 # Collection of translation arrays required in generated code 83 self.required_arrays = set() 84 85 def _index_array_symbol(self, f_dir, inverse, dir_symbol): 86 assert f_dir in ['in', 'out'] 87 name = "f_{d}{inv}_dir_idx".format(d=f_dir, inv='_inv' if inverse else '') We're trying to switch to f-strings where possible. You can automatically convert your code with flynt: https://github.com/ikamensh/flynt
Edited by Stephan Seitzchanged this line in version 2 of the diff
added 2 commits
added 1 commit
- 21122ee0 - Complete and partially tested code for boundary indexing
added 1 commit
- ab28a143 - Added boundary kernel creation. Fixed a few other things.
20 quantities_to_set={'density': density_input_field, 21 'velocity': velocity_input_field}, ) 22 setter(pdf_arr) 16 accessors = [StreamPullTwoFieldsAccessor, 17 StreamPushTwoFieldsAccessor, 18 AAEvenTimeStepAccessor, 19 AAOddTimeStepAccessor, 20 EsoTwistEvenTimeStepAccessor, 21 EsoTwistOddTimeStepAccessor] 22 23 stencils = ['D2Q9', 'D3Q19'] 24 force_models = ['guo', 'luo', 'none'] 25 compressibilities = [True, False] 26 27 28 @pytest.mark.parametrize('stencil,force_model,compressible,accessor', product(stencils, force_models, compressibilities, accessors)) this works but you can also decorate the function multiple times to get the product. You can leave it as it is. Just FYI.
@pytest.mark.parametrize('force_models', ['guo', 'luo', None]) @pytest.mark.parametrize('stencil', ['D2Q9', 'D3Q19']) @pytest.mark.parametrize('compressibilities', ['compressible', False]) # using a string for true yields a nicer test description of the test in CI output
Does force_models='none' work? Or should it be
None
Edited by Stephan Seitzchanged this line in version 10 of the diff
added 1 commit
- a6c4c41d - Introduced utility file and refactored tests
added 1 commit
- 28a9823b - refactored kernel_type to streaming_pattern, + code style fixes
added 1 commit
- 06aeddba - Completed advanced periodicity handling and added fully periodic test scenario
added 1 commit
- 231adc92 - Fixed the order of steps in the periodic pipe test case