Commit 6fb3881b authored by Martin Bauer's avatar Martin Bauer
Browse files

Adapted codegen example file to changes in lbmpy

parent 4b74b16f
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
import pystencils as ps
# ------------- Lattice Model ------------------------------
forceField = Field.createGeneric('force', spatialDimensions=3, indexDimensions=1, layout='fzyx')
force = [forceField(0), forceField(1), forceField(2)]
force_field = ps.fields("force(3): [3D]", layout='fzyx')
omega = sp.Symbol("omega")
scaling = RefinementScaling()
scaling.addStandardRelaxationRateScaling(omega)
scaling.addForceScaling(forceField)
scaling.add_standard_relaxation_rate_scaling(omega)
scaling.add_force_scaling(force_field)
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_field.center_vector,
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