Commit 6374f339 authored by Helen Schottenhamml's avatar Helen Schottenhamml
Browse files

Merge branch 'Cumulant' into 'master'

Corrected gallilean correction

See merge request pycodegen/lbmpy!58
parents e0566616 ed71a777
......@@ -86,6 +86,8 @@ ubuntu:
- $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu
script:
- pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
- pip3 install `grep -Eo 'numpy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
- mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc
- pip3 install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
......
......@@ -29,8 +29,6 @@ from lbmpy.methods.momentbased.moment_transforms import (
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT,
FastCentralMomentTransform)
from lbmpy.methods.centeredcumulant.simplification import insert_aliases, insert_zeros
from lbmpy.methods.centeredcumulant.force_model import CenteredCumulantForceModel
from lbmpy.methods.centeredcumulant.galilean_correction import (
contains_corrected_polynomials,
......@@ -413,12 +411,5 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
main_assignments = [Assignment(eq.lhs, eq.rhs + force_term_symbol)
for eq, force_term_symbol in zip(main_assignments, force_term_symbols)]
# 9) Clean up the subexpression tree
ac = AssignmentCollection(main_assignments, subexpressions)
if pre_simplification and pre_simplification != 'none':
ac = insert_aliases(insert_zeros(ac))
ac = ac.new_without_unused_subexpressions()
# Aaaaaand we're done.
return LbmCollisionRule(self, ac.main_assignments, ac.subexpressions)
return LbmCollisionRule(self, main_assignments, subexpressions)
......@@ -11,7 +11,7 @@ corrected_polynomials = [x**2 - y**2, x**2 - z**2, x**2 + y**2 + z**2]
def contains_corrected_polynomials(polynomials):
return all(polynomials.containts(p) for p in corrected_polynomials)
return all(cp in polynomials for cp in corrected_polynomials)
def add_galilean_correction(poly_relaxation_eqs, polynomials, correction_terms):
......
......@@ -2,6 +2,8 @@ import sympy as sp
from lbmpy.innerloopsplit import create_lbm_split_groups
from lbmpy.methods.momentbased.momentbasedmethod import MomentBasedLbMethod
from lbmpy.methods.centeredcumulant import CenteredCumulantBasedLbMethod
from lbmpy.methods.centeredcumulant.simplification import insert_aliases, insert_zeros
from lbmpy.methods.momentbased.momentbasedsimplifications import (
factor_density_after_factoring_relaxation_times, factor_relaxation_rates,
replace_common_quadratic_and_constant_term, replace_density_and_velocity, replace_second_order_velocity_products)
......@@ -31,4 +33,8 @@ def create_simplification_strategy(lb_method, split_inner_loop=False):
s.add(subexpression_substitution_in_main_assignments)
if split_inner_loop:
s.add(create_lbm_split_groups)
elif isinstance(lb_method, CenteredCumulantBasedLbMethod):
s.add(insert_zeros)
s.add(insert_aliases)
s.add(lambda ac: ac.new_without_unused_subexpressions())
return s
......@@ -20,6 +20,8 @@ def frobenius_norm(matrix, factor=1):
def add_smagorinsky_model(collision_rule, smagorinsky_constant, omega_output_field=None):
method = collision_rule.method
omega_s = get_shear_relaxation_rate(method)
if isinstance(omega_s, float) or isinstance(omega_s, int):
raise ValueError("For the smagorinsky model the shear relaxation rate has to be a symbol")
f_neq = sp.Matrix(method.pre_collision_pdf_symbols) - method.get_equilibrium_terms()
tau_0 = sp.Symbol("tau_0_")
......
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