diff --git a/lbmpy/macroscopic_value_kernels.py b/lbmpy/macroscopic_value_kernels.py index bcfc9422c22fc3e353cc4bd73bb14eb6344823b5..4ec4f31ae4e44f0468ec58a191ea9843c8072a97 100644 --- a/lbmpy/macroscopic_value_kernels.py +++ b/lbmpy/macroscopic_value_kernels.py @@ -8,11 +8,11 @@ from lbmpy.advanced_streaming.utility import get_accessor, Timestep def pdf_initialization_assignments(lb_method, density, velocity, pdfs, - streaming_pattern='pull', timestep=Timestep.BOTH, + streaming_pattern='pull', previous_timestep=Timestep.BOTH, set_pre_collision_pdfs=False): """Assignments to initialize the pdf field with equilibrium""" if isinstance(pdfs, Field): - accessor = get_accessor(streaming_pattern, timestep) + accessor = get_accessor(streaming_pattern, previous_timestep) if set_pre_collision_pdfs: field_accesses = accessor.read(pdfs, lb_method.stencil) else: @@ -32,10 +32,10 @@ def pdf_initialization_assignments(lb_method, density, velocity, pdfs, def macroscopic_values_getter(lb_method, density, velocity, pdfs, - streaming_pattern='pull', timestep=Timestep.BOTH, + streaming_pattern='pull', previous_timestep=Timestep.BOTH, use_pre_collision_pdfs=False): if isinstance(pdfs, Field): - accessor = get_accessor(streaming_pattern, timestep) + accessor = get_accessor(streaming_pattern, previous_timestep) if use_pre_collision_pdfs: field_accesses = accessor.read(pdfs, lb_method.stencil) else: diff --git a/lbmpy_tests/advanced_streaming/test_fully_periodic_flow.py b/lbmpy_tests/advanced_streaming/test_fully_periodic_flow.py index 4b52a17416ce505889cb1d085c815d38c173bfe8..4dc7b6b1a5fde034c49c59c3d82fcd22f8c89699 100644 --- a/lbmpy_tests/advanced_streaming/test_fully_periodic_flow.py +++ b/lbmpy_tests/advanced_streaming/test_fully_periodic_flow.py @@ -105,14 +105,14 @@ def test_fully_periodic_flow(target, stencil, streaming_pattern): setter = macroscopic_values_setter( lb_method, density, velocity, pdfs, - streaming_pattern=streaming_pattern, timestep=zeroth_timestep) + streaming_pattern=streaming_pattern, previous_timestep=zeroth_timestep) setter_kernel = create_kernel(setter, ghost_layers=1, target=target).compile() getter_kernels = [] for t in timesteps: getter = macroscopic_values_getter( lb_method, density_field, velocity_field, pdfs, - streaming_pattern=streaming_pattern, timestep=t) + streaming_pattern=streaming_pattern, previous_timestep=t) getter_kernels.append(create_kernel(getter, ghost_layers=1, target=target).compile()) # Periodicity diff --git a/lbmpy_tests/advanced_streaming/test_periodic_pipe_with_force.py b/lbmpy_tests/advanced_streaming/test_periodic_pipe_with_force.py index 1cc3526386d1db65b6e5416e7bd02a06045139c2..cafd293b2ddb34e44fbe06f22aca35c05ac167b6 100644 --- a/lbmpy_tests/advanced_streaming/test_periodic_pipe_with_force.py +++ b/lbmpy_tests/advanced_streaming/test_periodic_pipe_with_force.py @@ -106,14 +106,14 @@ class PeriodicPipeFlow: setter = macroscopic_values_setter( self.lb_method, self.density, self.velocity, self.pdfs, - streaming_pattern=self.streaming_pattern, timestep=self.zeroth_timestep) + streaming_pattern=self.streaming_pattern, previous_timestep=self.zeroth_timestep) self.init_kernel = create_kernel(setter, ghost_layers=1, target=self.target).compile() self.getter_kernels = [] for t in self.timesteps: getter = macroscopic_values_getter( self.lb_method, self.density_field, self.velocity_field, self.pdfs, - streaming_pattern=self.streaming_pattern, timestep=t) + streaming_pattern=self.streaming_pattern, previous_timestep=t) self.getter_kernels.append(create_kernel(getter, ghost_layers=1, target=self.target).compile()) # Periodicity diff --git a/lbmpy_tests/centeredcumulant/test_flow_around_sphere.py b/lbmpy_tests/centeredcumulant/test_flow_around_sphere.py index beb2d3db62db48ef7328815909913b449a9112fd..686eb0f60e14fc3c88098b30d143f910aab8c84f 100644 --- a/lbmpy_tests/centeredcumulant/test_flow_around_sphere.py +++ b/lbmpy_tests/centeredcumulant/test_flow_around_sphere.py @@ -104,7 +104,7 @@ def flow_around_sphere(stencil, galilean_correction, L_LU, total_steps): init_eqs = pdf_initialization_assignments(lb_method, 1.0, initial_velocity, pdf_field, streaming_pattern=streaming_pattern, - timestep=timesteps[0]) + previous_timestep=timesteps[0]) init_kernel = create_kernel(init_eqs, target=target).compile() output = { diff --git a/lbmpy_tests/centeredcumulant/test_periodic_pipe_flow.ipynb b/lbmpy_tests/centeredcumulant/test_periodic_pipe_flow.ipynb index eb5562c460dd46558353b7bc7b43ebb485c9cab3..8076fdd2cdc9de4588dc54b8b8359bbfd234ebc6 100644 --- a/lbmpy_tests/centeredcumulant/test_periodic_pipe_flow.ipynb +++ b/lbmpy_tests/centeredcumulant/test_periodic_pipe_flow.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "source": [ "import pytest\n", "pytest.importorskip('pycuda')" @@ -16,33 +16,24 @@ ] }, "metadata": {}, - "execution_count": 7 + "execution_count": 1 } ], "metadata": {} }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "source": [ "%load_ext autoreload\n", "%autoreload 2" ], - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "The autoreload extension is already loaded. To reload it, use:\n", - " %reload_ext autoreload\n" - ] - } - ], + "outputs": [], "metadata": {} }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "source": [ "import sympy as sp\n", "import numpy as np\n", @@ -70,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "source": [ "class PeriodicPipeFlow:\n", " def __init__(self, method_params, optimization=dict()):\n", @@ -132,14 +123,14 @@ "\n", " setter = macroscopic_values_setter(\n", " self.lb_method, self.density, self.velocity, self.pdfs,\n", - " streaming_pattern=self.streaming_pattern, timestep=self.zeroth_timestep)\n", + " streaming_pattern=self.streaming_pattern, previous_timestep=self.zeroth_timestep)\n", " self.init_kernel = create_kernel(setter, ghost_layers=1, target=self.target).compile()\n", "\n", " self.getter_kernels = []\n", " for t in self.timesteps:\n", " getter = macroscopic_values_getter(\n", " self.lb_method, self.density_field, self.velocity_field, self.pdfs,\n", - " streaming_pattern=self.streaming_pattern, timestep=t)\n", + " streaming_pattern=self.streaming_pattern, previous_timestep=t)\n", " self.getter_kernels.append(create_kernel(getter, ghost_layers=1, target=self.target).compile())\n", "\n", " # Periodicity\n", @@ -219,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 5, "source": [ "stencil = get_stencil('D3Q19')\n", "dim = len(stencil[0])\n", @@ -243,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 6, "source": [ "srt_params = {\n", " 'stencil': stencil,\n", @@ -263,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "source": [ "srt_u = srt_flow.get_trimmed_velocity_array()\n", "ps.plot.vector_field_magnitude(srt_u[30,:,:,:])\n", @@ -274,11 +265,11 @@ "output_type": "execute_result", "data": { "text/plain": [ - "<matplotlib.colorbar.Colorbar at 0x7faa51244c40>" + "<matplotlib.colorbar.Colorbar at 0x7fd9a51311c0>" ] }, "metadata": {}, - "execution_count": 13 + "execution_count": 7 }, { "output_type": "display_data", @@ -310,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 8, "source": [ "cm_method_params = {\n", " 'method' : 'monomial_cumulant',\n", @@ -333,7 +324,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 9, "source": [ "lb_method = cm_impl_f_flow.lb_method\n", "assert all(rr == 2 for rr in lb_method.relaxation_rates[1:4])\n", @@ -344,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "source": [ "cm_impl_f_flow.init()\n", "cm_impl_f_flow.run(400)" @@ -354,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 11, "source": [ "cm_impl_f_u = cm_impl_f_flow.get_trimmed_velocity_array()\n", "ps.plot.vector_field_magnitude(cm_impl_f_u[30,:,:,:])\n", @@ -365,11 +356,11 @@ "output_type": "execute_result", "data": { "text/plain": [ - "<matplotlib.colorbar.Colorbar at 0x7faa5077ed30>" + "<matplotlib.colorbar.Colorbar at 0x7fd9a40bd5e0>" ] }, "metadata": {}, - "execution_count": 17 + "execution_count": 11 }, { "output_type": "display_data", @@ -388,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 12, "source": [ "assert_allclose(cm_impl_f_u, srt_u, rtol=1, atol=1e-4)" ], @@ -404,7 +395,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 13, "source": [ "from lbmpy.forcemodels import Simple\n", "\n", @@ -429,7 +420,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 14, "source": [ "lb_method = cm_expl_f_flow.lb_method\n", "assert all(rr == 0 for rr in lb_method.relaxation_rates[1:4])\n", @@ -440,7 +431,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 15, "source": [ "cm_expl_f_flow.init()\n", "cm_expl_f_flow.run(400)" @@ -450,7 +441,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 16, "source": [ "cm_expl_f_u = cm_expl_f_flow.get_trimmed_velocity_array()\n", "ps.plot.vector_field_magnitude(cm_expl_f_u[30,:,:,:])\n", @@ -461,11 +452,11 @@ "output_type": "execute_result", "data": { "text/plain": [ - "<matplotlib.colorbar.Colorbar at 0x7faa506476a0>" + "<matplotlib.colorbar.Colorbar at 0x7fd99ddf0e20>" ] }, "metadata": {}, - "execution_count": 22 + "execution_count": 16 }, { "output_type": "display_data", @@ -484,7 +475,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 17, "source": [ "assert_allclose(cm_expl_f_u, srt_u, rtol=1, atol=1e-4)\n", "assert_allclose(cm_expl_f_u, cm_impl_f_u, rtol=1, atol=1e-4)" diff --git a/lbmpy_tests/test_compiled_in_boundaries.ipynb b/lbmpy_tests/test_compiled_in_boundaries.ipynb index 3ea3e793df5ad8b371c39515e4968d09369197b3..97a0cbfd822c08941b3f9ed6bd093c169391064a 100644 --- a/lbmpy_tests/test_compiled_in_boundaries.ipynb +++ b/lbmpy_tests/test_compiled_in_boundaries.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 5, + "execution_count": 8, "source": [ "from lbmpy.session import *\n", "from lbmpy.boundaries.boundaries_in_kernel import update_rule_with_push_boundaries\n", @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "source": [ "domain_size = (32, 32, 32)\n", "relaxation_rate = 1.8\n", @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "source": [ "dh = create_data_handling(domain_size, default_target='cpu')\n", "pdfs = dh.add_array('pdfs', values_per_cell=19)\n", @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "source": [ "boundaries = OrderedDict((\n", " ((0, 1, 0), UBB([lid_velocity, 0, 0])), \n", @@ -65,7 +65,7 @@ "getter_assignments = macroscopic_values_getter(update_rule_aa_even.method, velocity=u.center_vector,\n", " pdfs=pdfs, density=None,\n", " streaming_pattern=streaming_pattern, \n", - " timestep=Timestep.EVEN)\n", + " previous_timestep=Timestep.EVEN)\n", "\n", "getter_kernel = ps.create_kernel(getter_assignments, target=dh.default_target).compile()\n", "even_kernel = ps.create_kernel(update_rule_aa_even, target=dh.default_target, ghost_layers=1).compile()\n", @@ -76,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "source": [ "def init():\n", " dh.fill(pdfs.name, 0, ghost_layers=True)\n", @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 13, "source": [ "init()\n", "aa_time_loop(time_steps)\n", @@ -108,11 +108,11 @@ "output_type": "execute_result", "data": { "text/plain": [ - "<matplotlib.colorbar.Colorbar at 0x7f7c316778e0>" + "<matplotlib.colorbar.Colorbar at 0x7f0cfc8f5b50>" ] }, "metadata": {}, - "execution_count": 10 + "execution_count": 13 }, { "output_type": "display_data", @@ -138,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "source": [ "ldc = create_lid_driven_cavity(domain_size, relaxation_rate=relaxation_rate, lid_velocity=lid_velocity)\n", "ldc.run(time_steps)\n", @@ -152,11 +152,11 @@ "output_type": "execute_result", "data": { "text/plain": [ - "<matplotlib.colorbar.Colorbar at 0x7f7c30fd9d60>" + "<matplotlib.colorbar.Colorbar at 0x7f0cfca3ceb0>" ] }, "metadata": {}, - "execution_count": 11 + "execution_count": 14 }, { "output_type": "display_data",