Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (6)
......@@ -97,7 +97,7 @@ pycodegen-integration:
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
stage: test
when: manual
allow_failure: false
allow_failure: true
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pycodegen.git
- cd pycodegen
......@@ -149,7 +149,8 @@ build-documentation:
- export PYTHONPATH=`pwd`
- pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
- mkdir html_doc
- sphinx-build -W -b html doc html_doc
- sphinx-build -b html doc html_doc
- sphinx-build -W -b html doc html_doc
tags:
- docker
- cuda11
......
......@@ -54,6 +54,7 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3.6', None),
}
autodoc_member_order = 'bysource'
bibtex_bibfiles = ['sphinx/lbmpy.bib']
project = 'lbmpy'
html_logo = "img/logo.png"
......@@ -260,16 +260,3 @@ class StreamInConstant(LbBoundary):
def __eq__(self, other):
return type(other) == StreamInConstant
# end class StreamInConstant
# ------------------------- Old, Deprecated Implementation -------------------------
class Boundary(LbBoundary):
def __init__(self, name=None):
from lbmpy.boundaries.boundaryhandling import deprecation_message
deprecation_message()
self._name = name
def __call__(self, pdf_field, direction_symbol, lb_method, index_field):
raise NotImplementedError("Boundary class has to overwrite __call__")
......@@ -65,7 +65,7 @@ class LatticeBoltzmannBoundaryHandling(BoundaryHandling):
return create_lattice_boltzmann_boundary_kernel(
symbolic_field, symbolic_index_field, self._lb_method, boundary_obj,
prev_timestep=prev_timestep, streaming_pattern=self._streaming_pattern,
target=self._target, openmp=self._openmp)
target=self._target, cpu_openmp=self._openmp)
class InplaceStreamingBoundaryInfo(object):
......@@ -175,11 +175,7 @@ class LbmWeightInfo(CustomCodeNode):
def create_lattice_boltzmann_boundary_kernel(pdf_field, index_field, lb_method, boundary_functor,
prev_timestep=Timestep.BOTH, streaming_pattern='pull',
target='cpu', openmp=True, **kernel_creation_args):
from lbmpy.boundaries.boundaryconditions import Boundary as OldBoundary
if isinstance(boundary_functor, OldBoundary):
return create_lattice_boltzmann_boundary_kernel_old(pdf_field, index_field, lb_method, boundary_functor,
target=target, openmp=openmp, **kernel_creation_args)
target='cpu', **kernel_creation_args):
index_dtype = index_field.dtype.numpy_dtype.fields['dir'][0]
offsets_dtype = index_field.dtype.numpy_dtype.fields['x'][0]
......@@ -197,7 +193,7 @@ def create_lattice_boltzmann_boundary_kernel(pdf_field, index_field, lb_method,
elements = [Assignment(dir_symbol, index_field[0]('dir'))]
elements += boundary_assignments.all_assignments
kernel = create_indexed_kernel(elements, [index_field], target=target, cpu_openmp=openmp, **kernel_creation_args)
kernel = create_indexed_kernel(elements, [index_field], target=target, **kernel_creation_args)
# Code Elements ahead of the loop
index_arrs_node = indexing.create_code_node()
......@@ -205,28 +201,3 @@ def create_lattice_boltzmann_boundary_kernel(pdf_field, index_field, lb_method,
kernel.body.insert_front(node)
kernel.body.insert_front(index_arrs_node)
return kernel
# ----------------------------- Old, Deprecated Implementation -----------------------
def deprecation_message():
import warnings
deprecation_message = "The old code generation scheme for LB boundaries has been deprecated. " \
+ "Please update your boundary implementation to derive from ``LbBoundary`` " \
+ "and use the new implementation scheme based on `BetweenTimestepsIndexing`."
warnings.simplefilter('always', DeprecationWarning)
warnings.warn(deprecation_message, DeprecationWarning, stacklevel=2)
warnings.simplefilter('default', DeprecationWarning)
def create_lattice_boltzmann_boundary_kernel_old(pdf_field, index_field, lb_method, boundary_functor,
target='cpu', openmp=True, **kernel_creation_args):
deprecation_message()
from pystencils.boundaries.boundaryhandling import BoundaryOffsetInfo
elements = [BoundaryOffsetInfo(lb_method.stencil), LbmWeightInfo(lb_method)]
index_arr_dtype = index_field.dtype.numpy_dtype
dir_symbol = TypedSymbol("dir", index_arr_dtype.fields['dir'][0])
elements += [Assignment(dir_symbol, index_field[0]('dir'))]
elements += boundary_functor(pdf_field=pdf_field, direction_symbol=dir_symbol,
lb_method=lb_method, index_field=index_field)
return create_indexed_kernel(elements, [index_field], target=target, cpu_openmp=openmp, **kernel_creation_args)
......@@ -453,10 +453,10 @@ def extract_monomials(sequence_of_polynomials, dim=3):
dim: length of returned exponent tuples
>>> x, y, z = MOMENT_SYMBOLS
>>> extract_monomials([x**2 + y**2 + y, y + y**2])
{(0, 2, 0), (0, 1, 0), (2, 0, 0)}
>>> extract_monomials([x**2 + y**2 + y, y + y**2], dim=2)
{(0, 1), (0, 2), (2, 0)}
>>> extract_monomials([x**2 + y**2 + y, y + y**2]) == {(0, 1, 0),(0, 2, 0),(2, 0, 0)}
True
>>> extract_monomials([x**2 + y**2 + y, y + y**2], dim=2) == {(0, 1), (0, 2), (2, 0)}
True
"""
monomials = set()
for polynomial in sequence_of_polynomials:
......@@ -477,10 +477,11 @@ def monomial_to_polynomial_transformation_matrix(monomials, polynomials):
>>> polys = [7 * x**2 + 3 * x + 2 * y **2, \
9 * x**2 - 5 * x]
>>> mons = list(extract_monomials(polys, dim=2))
>>> mons.sort()
>>> monomial_to_polynomial_transformation_matrix(mons, polys)
Matrix([
[ 3, 2, 7],
[-5, 0, 9]])
[2, 3, 7],
[0, -5, 9]])
"""
dim = len(monomials[0])
......
......@@ -117,7 +117,7 @@ def test_modes(stencil, force_model):
# The stress moments should match eq. 47 from https://doi.org/10.1023/A:1010414013942
u = method.first_order_equilibrium_moment_symbols
def traceless(m):
tr = sp.simplify(sp.Trace(m))
tr = sp.simplify(sum([m[i,i] for i in range(dim)]))
return m - tr/m.shape[0]*sp.eye(m.shape[0])
C = sp.Rational(1,2) * (2 + lambda_s) * (traceless(sp.Matrix(u) * sp.Matrix(F).transpose()) + \
traceless(sp.Matrix(F) * sp.Matrix(u).transpose())) + \
......