Skip to content

Add generic refinement scaling for LBM package codegen

This merger changes the generate_lbm_package function of python/lbmpy_walberla/walberla_lbm_package.py to take a userdefined RefinementScaling object, to overwrite default scaling rules. This allows any arbitrary value/symbol to be scaled for refinement. Previous version only allowed parameter scaling for the relaxation rate. Also added scaling on force symbol as a defualt.

from lbmpy_walberla import generate_lbm_package, RefinementScaling


refinement_scaling = RefinementScaling()
refinement_scaling.add_standard_relaxation_rate_scaling(sp.Symbol('omega'))
refinement_scaling.add_scaling(sp.Symbol('dx'), lambda param, factor: param / factor)
refinement_scaling.add_scaling(sp.Symbol('dy'), lambda param, factor: param / factor)
refinement_scaling.add_scaling(sp.Symbol('dz'), lambda param, factor: param / factor)
refinement_scaling.add_force_scaling(sp.Symbol('S'))

 generate_lbm_package(ctx, name=name,
                      collision_rule=collision_rule,
                      lbm_config=lbm_config, lbm_optimisation=lbm_opt, nonuniform=True,
                      refinement_scaling=refinement_scaling, boundaries=[],
                      macroscopic_fields=macroscopic_fields,
                      data_type=data_type, pdfs_data_type=data_type)
Edited by brendan-waters

Merge request reports