Commit afacbe58 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Merge branch 'ShiftMatrix' of i10git.cs.fau.de:holzer/lbmpy into ShiftMatrix

parents 6f4189b0 87a47bbb
Pipeline #33654 failed with stages
in 11 minutes and 36 seconds
......@@ -56,17 +56,26 @@ Documentation
Read the docs [here](http://pycodegen.pages.i10git.cs.fau.de/lbmpy) and
check out the Jupyter notebooks in `doc/notebooks`.
Authors
Contributing
-------
To see how to open issues, submit bug reports, create feature requests or submit your additions to lbmpy please refer to
[contribution documentation](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/CONTRIBUTING.md) of pystencils since lbmpy is heavily build on pystencils.
Many thanks go to the [contributors](https://i10git.cs.fau.de/pycodegen/lbmpy/-/blob/master/AUTHORS.txt) of lbmpy.
Many thanks go to the [contributors](AUTHORS.txt) of lbmpy.
### Please cite us
If you use lbmpy in a publication, please cite the following articles:
Overview:
- M. Bauer et al, lbmpy: Automatic code generation for efficient parallel lattice Boltzmann methods. Journal of Computational Science, 2021. https://doi.org/10.1016/j.jocs.2020.101269
- M. Bauer et al, lbmpy: Automatic code generation for efficient parallel lattice Boltzmann methods. Journal of Computational Science, 2021. https://doi.org/10.1016/j.jocs.2020.101269 ([Preprint](https://arxiv.org/abs/2001.11806))
Multiphase:
- M. Holzer et al, Highly efficient lattice Boltzmann multiphase simulations of immiscible fluids at high-density ratios on CPUs and GPUs through code generation. The International Journal of High Performance Computing Applications, 2021. https://doi.org/10.1177/10943420211016525
### Further Reading
- F. Hennig et al, Automatic Code Generation for the Cumulant Lattice Boltzmann Method. ICMMES, 2021. [Poster Link](https://www.researchgate.net/publication/353224406_Automatic_Code_Generation_for_the_Cumulant_Lattice_Boltzmann_Method)
......@@ -57,7 +57,8 @@ def create_lbm_kernel(collision_rule, src_field, dst_field=None, accessor=Stream
return result
def create_stream_only_kernel(stencil, src_field, dst_field=None, accessor=StreamPullTwoFieldsAccessor()):
def create_stream_only_kernel(stencil, src_field, dst_field=None, accessor=StreamPullTwoFieldsAccessor(),
write_on_dst_field=False):
"""Creates a stream kernel, without collision.
Args:
......@@ -66,13 +67,19 @@ def create_stream_only_kernel(stencil, src_field, dst_field=None, accessor=Strea
dst_field: field used for writing pdf values if accessor.is_inplace this parameter is ignored
accessor: instance of PdfFieldAccessor, defining where to read and write values
to create e.g. a fused stream-collide kernel See 'fieldaccess.PdfFieldAccessor'
write_on_dst_field: for benchmarking only the streaming pattern without the collision it is necassary to write
on a dst_field even if it is an inplace streaming pattern because otherwise the compiler
will optimise this
Returns:
AssignmentCollection of the stream only update rule
"""
if accessor.is_inplace:
if accessor.is_inplace and not write_on_dst_field:
dst_field = src_field
if write_on_dst_field and dst_field is None:
raise ValueError("Destination field needs to be provides if write_on_dst_field is True")
if not accessor.is_inplace and dst_field is None:
raise ValueError("For two field accessors a destination field has to be provided")
......@@ -82,36 +89,6 @@ def create_stream_only_kernel(stencil, src_field, dst_field=None, accessor=Strea
return AssignmentCollection(main_assignments, subexpressions=subexpressions)
def create_stream_pull_only_kernel(stencil, numpy_arr=None, src_field_name="src", dst_field_name="dst",
generic_layout='numpy', generic_field_type=np.float64):
"""Creates a stream kernel with the pull scheme, without collision.
Args:
stencil: lattice Boltzmann stencil which is used
numpy_arr: numpy array which containes the pdf field data. If no numpy array is provided the symbolic field
accesses are created with 'Field.create_generic'. Otherwise 'Field.create_from_numpy_array' is used.
src_field_name: name of the source field.
dst_field_name: name of the destination field.
generic_layout: data layout. for example 'fzyx' of 'zyxf'.
generic_field_type: field data type.
Returns:
AssignmentCollection of the stream only update rule
"""
warnings.warn("This function is depricated. Please use create_stream_only_kernel. If no PdfFieldAccessor is "
"provided to this function a standard StreamPullTwoFieldsAccessor is used ", DeprecationWarning)
dim = len(stencil[0])
if numpy_arr is None:
src = Field.create_generic(src_field_name, dim, index_shape=(len(stencil),),
layout=generic_layout, dtype=generic_field_type)
dst = Field.create_generic(dst_field_name, dim, index_shape=(len(stencil),),
layout=generic_layout, dtype=generic_field_type)
else:
src = Field.create_from_numpy_array(src_field_name, numpy_arr, index_dimensions=1)
dst = Field.create_from_numpy_array(dst_field_name, numpy_arr, index_dimensions=1)
return create_stream_only_kernel(stencil, src, dst, accessor=StreamPullTwoFieldsAccessor())
def create_stream_pull_with_output_kernel(lb_method, src_field, dst_field=None, output=None,
accessor=StreamPullTwoFieldsAccessor()):
"""Creates a stream kernel, without collision but macroscopic quantaties like density or velocity can be calculated.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment