Commit 2bfdfe0f authored by Michael Kuron's avatar Michael Kuron
Browse files

Merge branch 'FixSmagorinsky' into 'master'

Fix smagorinsky

See merge request pycodegen/lbmpy!94
parents d52eb84c 95834204
Pipeline #34437 passed with stages
in 38 minutes and 41 seconds
......@@ -638,14 +638,14 @@ class LBMConfig:
entropic_newton_iterations: int = None
omega_output_field: Field = None
smagorinsky: bool = False
fluctuating: bool = False
fluctuating: dict = False
temperature: Any = None
output: dict = field(default_factory=dict)
velocity_input: Field = None
density_input: Field = None
kernel_type: str = 'default_stream_collide'
kernel_type: Union[str, PdfFieldAccessor] = 'default_stream_collide'
streaming_pattern: str = 'pull'
timestep: lbmpy.advanced_streaming.Timestep = Timestep.BOTH
......
......@@ -44,8 +44,9 @@ def add_smagorinsky_model(collision_rule, smagorinsky_constant, omega_output_fie
method = collision_rule.method
omega_s = get_shear_relaxation_rate(method)
found_symbolic_shear_relaxation = False
found_symbolic_shear_relaxation = True
if isinstance(omega_s, float) or isinstance(omega_s, int):
found_symbolic_shear_relaxation = False
for eq in collision_rule.all_assignments:
if eq.rhs == omega_s:
found_symbolic_shear_relaxation = True
......
import sympy as sp
from pystencils.simp.subexpression_insertion import insert_constants
from lbmpy import create_lb_collision_rule, LBMConfig, LBStencil, Stencil, Method
def test_smagorinsky_with_constant_omega():
stencil = LBStencil(Stencil.D2Q9)
config = LBMConfig(stencil=stencil, method=Method.SRT, smagorinsky=True, relaxation_rate=sp.Symbol("omega"))
collision_rule = create_lb_collision_rule(lbm_config=config)
config = LBMConfig(stencil=stencil, method=Method.SRT, smagorinsky=True, relaxation_rate=1.5)
collision_rule2 = create_lb_collision_rule(lbm_config=config)
collision_rule = collision_rule.subs({sp.Symbol("omega"): 1.5})
collision_rule = insert_constants(collision_rule)
assert collision_rule == collision_rule2
\ No newline at end of file
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