Skip to content
Snippets Groups Projects
Commit 8c4c9f11 authored by Markus Holzer's avatar Markus Holzer
Browse files

Tried push scheme

parent d605d248
Branches
No related tags found
No related merge requests found
Pipeline #34758 failed
...@@ -5,9 +5,11 @@ add_subdirectory( HeatConduction ) ...@@ -5,9 +5,11 @@ add_subdirectory( HeatConduction )
add_subdirectory( LightRisingParticleInFluidAMR ) add_subdirectory( LightRisingParticleInFluidAMR )
add_subdirectory( Mixer ) add_subdirectory( Mixer )
add_subdirectory( PegIntoSphereBed ) add_subdirectory( PegIntoSphereBed )
if ( WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_PYTHON ) if ( WALBERLA_BUILD_WITH_CODEGEN )
add_subdirectory( PhaseFieldAllenCahn ) if (WALBERLA_BUILD_WITH_PYTHON)
add_subdirectory( LeesEdwards ) add_subdirectory( PhaseFieldAllenCahn )
endif()
add_subdirectory( LeesEdwards )
endif() endif()
if ( WALBERLA_BUILD_WITH_CODEGEN AND NOT WALBERLA_BUILD_WITH_OPENMP) if ( WALBERLA_BUILD_WITH_CODEGEN AND NOT WALBERLA_BUILD_WITH_OPENMP)
add_subdirectory( PorousMedia ) add_subdirectory( PorousMedia )
......
...@@ -128,7 +128,7 @@ int main(int argc, char** argv) ...@@ -128,7 +128,7 @@ int main(int argc, char** argv)
parameters.getParameter< double >("remainingTimeLoggerFrequency", 3.0); // in seconds parameters.getParameter< double >("remainingTimeLoggerFrequency", 3.0); // in seconds
// create fields // create fields
BlockDataID pdfFieldID = field::addToStorage< PdfField_T >(blocks, "PDFs", real_t(1.0), field::fzyx); BlockDataID pdfFieldID = field::addToStorage< PdfField_T >(blocks, "PDFs", real_t(0.0), field::fzyx);
BlockDataID velFieldID = field::addToStorage< VectorField_T >(blocks, "velocity", real_t(0), field::fzyx); BlockDataID velFieldID = field::addToStorage< VectorField_T >(blocks, "velocity", real_t(0), field::fzyx);
BlockDataID forceFieldID = field::addToStorage< VectorField_T >(blocks, "force", real_t(0), field::fzyx); BlockDataID forceFieldID = field::addToStorage< VectorField_T >(blocks, "force", real_t(0), field::fzyx);
BlockDataID densityFieldID = field::addToStorage< ScalarField_T >(blocks, "density", real_t(1.0), field::fzyx); BlockDataID densityFieldID = field::addToStorage< ScalarField_T >(blocks, "density", real_t(1.0), field::fzyx);
...@@ -149,9 +149,7 @@ int main(int argc, char** argv) ...@@ -149,9 +149,7 @@ int main(int argc, char** argv)
// add LBM sweep and communication to time loop // add LBM sweep and communication to time loop
timeloop.add() << Sweep(CollisionSweep, "collision"); timeloop.add() << Sweep(CollisionSweep, "collision");
timeloop.add() << BeforeFunction(communication, "communication") timeloop.add() << Sweep(StreamSweep, "stream") << AfterFunction(communication, "communication");
<< Sweep(LeesEdwardsUpdate(blocks, pdfFieldID, offset), "Lees Edwards");
timeloop.add() << Sweep(StreamSweep, "stream");
// log remaining time // log remaining time
timeloop.addFuncAfterTimeStep(timing::RemainingTimeLogger(timeloop.getNrOfTimeSteps(), remainingTimeLoggerFrequency), timeloop.addFuncAfterTimeStep(timing::RemainingTimeLogger(timeloop.getNrOfTimeSteps(), remainingTimeLoggerFrequency),
......
...@@ -3,8 +3,9 @@ from pystencils.field import fields ...@@ -3,8 +3,9 @@ from pystencils.field import fields
from pystencils.data_types import type_all_numbers from pystencils.data_types import type_all_numbers
from pystencils import Assignment from pystencils import Assignment
from lbmpy import LBMConfig, LBStencil, LBMOptimisation, Stencil, Method, ForceModel
from lbmpy.advanced_streaming.utility import get_accessor, Timestep
from lbmpy.creationfunctions import create_lb_update_rule from lbmpy.creationfunctions import create_lb_update_rule
from lbmpy.stencils import get_stencil
from lbmpy.updatekernels import create_stream_pull_with_output_kernel from lbmpy.updatekernels import create_stream_pull_with_output_kernel
from lbmpy.macroscopic_value_kernels import macroscopic_values_setter from lbmpy.macroscopic_value_kernels import macroscopic_values_setter
from pystencils_walberla import CodeGeneration, generate_sweep, generate_info_header from pystencils_walberla import CodeGeneration, generate_sweep, generate_info_header
...@@ -12,14 +13,21 @@ from lbmpy_walberla import RefinementScaling, generate_boundary, generate_lb_pac ...@@ -12,14 +13,21 @@ from lbmpy_walberla import RefinementScaling, generate_boundary, generate_lb_pac
import sympy as sp import sympy as sp
# For advanced streaming patterns (AA, EsoTwist) the timestep is seperated into Odd and Even steps. In each of these
# steps a different streaming is executed. For more common two population methods this is not the case.
# In lbmpy we indicate this with Timestep.BOTH
streaming_pattern = "push"
accessor = get_accessor(streaming_pattern, Timestep.BOTH)
omega = 1.0 # relaxation rate of first component omega = 1.0 # relaxation rate of first component
shear_velocity = 0.5 # shear velocity shear_velocity = 0.5 # shear velocity
shear_dir = 0 # direction of shear flow shear_dir = 0 # direction of shear flow
shear_dir_normal = 1 # direction normal to shear plane, for interpolation shear_dir_normal = 1 # direction normal to shear plane, for interpolation
stencil = get_stencil("D2Q9") stencil = LBStencil(Stencil.D2Q9)
q = len(stencil) q = stencil.Q
dim = len(stencil[0]) dim = stencil.D
pdfs, pdfs_tmp = fields(f"pdfs({q}), pdfs_tmp({q}): double[{dim}D]", layout='fzyx') pdfs, pdfs_tmp = fields(f"pdfs({q}), pdfs_tmp({q}): double[{dim}D]", layout='fzyx')
velocity_field, force_field, density_field = fields(f"velocity({dim}), force({dim}), density(1) : double[{dim}D]", velocity_field, force_field, density_field = fields(f"velocity({dim}), force({dim}), density(1) : double[{dim}D]",
...@@ -33,15 +41,13 @@ u_p = sp.Piecewise((1, sp.And(type_all_numbers(counters[1] <= 0, 'int'), points_ ...@@ -33,15 +41,13 @@ u_p = sp.Piecewise((1, sp.And(type_all_numbers(counters[1] <= 0, 'int'), points_
(-1, sp.And(type_all_numbers(counters[1] >= 63, 'int'), points_up)), (-1, sp.And(type_all_numbers(counters[1] >= 63, 'int'), points_up)),
(0, True)) * shear_velocity (0, True)) * shear_velocity
collision = create_lb_update_rule(stencil=stencil, lb_config = LBMConfig(stencil=stencil, method=Method.SRT, relaxation_rate=omega, compressible=True,
relaxation_rate=omega, velocity_input=velocity_field.center_vector + sp.Matrix([u_p, 0]),
compressible=True, density_input=density_field, force_model=ForceModel.GUO,
velocity_input=velocity_field.center_vector + sp.Matrix([u_p, 0]), force=force_field.center_vector, kernel_type='collide_only')
density_input=density_field, lbm_opt = LBMOptimisation(symbolic_field=pdfs)
force_model='luo',
force=force_field.center_vector, collision = create_lb_update_rule(lbm_config=lb_config, lbm_optimisation=lbm_opt)
kernel_type='collide_only',
optimization={'symbolic_field': pdfs})
to_insert = [s.lhs for s in collision.subexpressions to_insert = [s.lhs for s in collision.subexpressions
if collision.method.first_order_equilibrium_moment_symbols[shear_dir] if collision.method.first_order_equilibrium_moment_symbols[shear_dir]
...@@ -62,10 +68,12 @@ for a, c in zip(collision.main_assignments, collision.method.stencil): ...@@ -62,10 +68,12 @@ for a, c in zip(collision.main_assignments, collision.method.stencil):
collision.main_assignments = ma collision.main_assignments = ma
stream = create_stream_pull_with_output_kernel(collision.method, pdfs, pdfs_tmp, stream = create_stream_pull_with_output_kernel(collision.method, pdfs, pdfs_tmp,
{'density': density_field, 'velocity': velocity_field}) {'density': density_field, 'velocity': velocity_field},
accessor=accessor)
init = macroscopic_values_setter(collision.method, velocity=(0, 0), init = macroscopic_values_setter(collision.method, velocity=(0, 0),
pdfs=pdfs.center_vector, density=density_field.center) pdfs=pdfs, density=density_field.center,
streaming_pattern=streaming_pattern)
stencil_typedefs = {'Stencil_T': stencil} stencil_typedefs = {'Stencil_T': stencil}
field_typedefs = {'PdfField_T': pdfs, field_typedefs = {'PdfField_T': pdfs,
...@@ -79,7 +87,7 @@ with CodeGeneration() as ctx: ...@@ -79,7 +87,7 @@ with CodeGeneration() as ctx:
generate_sweep(ctx, 'LeesEdwards_Setter', init) generate_sweep(ctx, 'LeesEdwards_Setter', init)
# communication # communication
generate_lb_pack_info(ctx, 'LeesEdwards_PackInfo', stencil, pdfs) generate_lb_pack_info(ctx, 'LeesEdwards_PackInfo', stencil, pdfs, streaming_pattern=streaming_pattern)
# Info header containing correct template definitions for stencil and field # Info header containing correct template definitions for stencil and field
generate_info_header(ctx, 'LeesEdwards_InfoHeader', generate_info_header(ctx, 'LeesEdwards_InfoHeader',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment