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 RefinementScaling object, rather than a boolean. This allows any arbitrary value to be scaled for refinement. Previous version only allowed parameter scaling for the relaxation rate.

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,
                      refinement_scaling=refinement_scaling, boundaries=[],
                      macroscopic_fields=macroscopic_fields,
                      data_type=data_type, pdfs_data_type=data_type)

Merge request reports