Commit 5f0d61a5 authored by Jan Hönig's avatar Jan Hönig

Adapted codegen files according to changes in pystencils.

parent e8f1f091
Pipeline #8685 passed with stage
in 306 minutes and 40 seconds
from pystencils_walberla.sweep import Sweep
from pystencils_walberla.cmake_integration import codegen
def jacobi2D(sweep):
def jacobi2D(sweep, s):
src = sweep.field("f1")
dst = sweep.temporaryField(src)
dst = sweep.temporary_field(src)
dst[0, 0] @= (src[1, 0] + src[-1, 0] + src[0, 1] + src[0, -1]) / (4 * S.h ** 2)
dst[0, 0] @= (src[1, 0] + src[-1, 0] + src[0, 1] + src[0, -1]) / (4 * s.h ** 2)
def jacobi3D(sweep):
def jacobi3D(sweep, s):
src = sweep.field("f1")
dst = sweep.temporaryField(src)
dst = sweep.temporary_field(src)
dst[0,0,0] @= (src[1,0,0] + src[-1,0,0] + src[0,1,0] + src[0, -1, 0] + src[0, 0, 1] + src[0, 0 , -1] ) / (6 * S.h**2)
dst[0,0,0] @= (src[1,0,0] + src[-1,0,0] + src[0,1,0] + src[0, -1, 0] + src[0, 0, 1] + src[0, 0 , -1] ) / (6 * s.h**2)
Sweep.generate('CudaJacobiKernel2D', jacobi2D, dim=2, target='gpu')
Sweep.generate('CudaJacobiKernel3D', jacobi3D, dim=3, target='gpu')
\ No newline at end of file
Sweep.generate('CudaJacobiKernel3D', jacobi3D, dim=3, target='gpu')
import sympy as sp
from lbmpy.boundaries import NoSlip, UBB
from lbmpy_walberla import Field, generateLatticeModelFiles, RefinementScaling
from lbmpy.creationfunctions import createLatticeBoltzmannMethod
from lbmpy_walberla.boundary import createBoundaryClass
from lbmpy_walberla import Field, generate_lattice_model_files, RefinementScaling
from lbmpy.creationfunctions import create_lb_method
from lbmpy_walberla.boundary import create_boundary_class
from pystencils_walberla.cmake_integration import codegen
# ------------- Lattice Model ------------------------------
forceField = Field.createGeneric('force', spatialDimensions=3, indexDimensions=1, layout='fzyx')
forceField = Field.create_generic('force', spatial_dimensions=3, index_dimensions=1, layout='fzyx')
force = [forceField(0), forceField(1), forceField(2)]
omega = sp.Symbol("omega")
scaling = RefinementScaling()
scaling.addStandardRelaxationRateScaling(omega)
scaling.addForceScaling(forceField)
scaling.add_standard_relaxation_rate_scaling(omega)
scaling.add_force_scaling(forceField)
generateLatticeModelFiles(className='SrtWithForceFieldModel',
method='srt', stencil='D3Q19', forceModel='guo', force=force,
relaxationRates=[omega], refinementScaling=scaling)
generate_lattice_model_files(class_name='SrtWithForceFieldModel',
method='srt', stencil='D3Q19', force_model='guo', force=force,
relaxation_rates=[omega], refinement_scaling=scaling)
def genBoundary():
boundary = UBB([0.05, 0, 0], dim=3, name="MyUBB")
method = createLatticeBoltzmannMethod(stencil='D3Q19', method='srt')
return createBoundaryClass(boundary, method)
method = create_lb_method(stencil='D3Q19', method='srt')
return create_boundary_class(boundary, method)
def genNoSlip():
boundary = NoSlip(name='MyNoSlip')
method = createLatticeBoltzmannMethod(stencil='D3Q19', method='srt')
return createBoundaryClass(boundary, method)
method = create_lb_method(stencil='D3Q19', method='srt')
return create_boundary_class(boundary, method)
codegen.register(['MyUBB.h', 'MyUBB.cpp'], genBoundary)
codegen.register(['MyNoSlip.h', 'MyNoSlip.cpp',], genNoSlip)
......
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