Commit 9b77d485 authored by Frederik Hennig's avatar Frederik Hennig Committed by Markus Holzer
Browse files

A few minor fixes:

- Now applying pre-simplification on CQE, too
- Added zero and alias insertion
- Bugfix
parent d6bde7f7
This diff is collapsed.
......@@ -21,11 +21,11 @@ class MomentBasedLbMethod(AbstractLbMethod):
Args:
stencil: see :func:`lbmpy.stencils.get_stencil`
moment_to_relaxation_info_dict: a dictionary mapping moments in either tuple or polynomial formulation
to a RelaxationInfo, which consists of the corresponding equilibrium moment
and a relaxation rate
to a RelaxationInfo, which consists of the corresponding equilibrium moment
and a relaxation rate
conserved_quantity_computation: instance of :class:`lbmpy.methods.AbstractConservedQuantityComputation`.
This determines how conserved quantities are computed, and defines
the symbols used in the equilibrium moments like e.g. density and velocity
This determines how conserved quantities are computed, and defines
the symbols used in the equilibrium moments like e.g. density and velocity
force_model: force model instance, or None if no forcing terms are required
"""
assert isinstance(conserved_quantity_computation, AbstractConservedQuantityComputation)
......@@ -88,9 +88,9 @@ class MomentBasedLbMethod(AbstractLbMethod):
equilibrium = self.get_equilibrium()
return sp.Matrix([eq.rhs for eq in equilibrium.main_assignments])
def get_collision_rule(self, conserved_quantity_equations=None, keep_rrs_symbolic=True):
def get_collision_rule(self, conserved_quantity_equations=None, pre_simplification=True):
d = self.relaxation_matrix
relaxation_rate_sub_expressions, d = self._generate_relaxation_matrix(d, keep_rrs_symbolic)
relaxation_rate_sub_expressions, d = self._generate_relaxation_matrix(d, pre_simplification)
ac = self._collision_rule_with_relaxation_matrix(d, relaxation_rate_sub_expressions,
True, conserved_quantity_equations)
return ac
......
This diff is collapsed.
import sympy as sp
from lbmpy.innerloopsplit import create_lbm_split_groups
from lbmpy.methods.cumulantbased import CumulantBasedLbMethod
from lbmpy.methods.momentbased import MomentBasedLbMethod
from lbmpy.methods.momentbasedsimplifications import (
from lbmpy.methods.momentbased.momentbasedmethod import MomentBasedLbMethod
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)
from pystencils.simp import (
......@@ -32,9 +31,4 @@ 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, CumulantBasedLbMethod):
s.add(expand)
s.add(factor_relaxation_rates)
s.add(add_subexpressions_for_divisions)
return s
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@ import numpy as np
import sympy as sp
from lbmpy.forcemodels import Guo
from lbmpy.methods.entropic_eq_srt import create_srt_entropic
from lbmpy.methods.momentbased.entropic_eq_srt import create_srt_entropic
from lbmpy.scenarios import create_lid_driven_cavity
from lbmpy.stencils import get_stencil
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ import sympy as sp
from lbmpy.forcemodels import Luo
from lbmpy.methods import create_srt, create_trt, create_trt_with_magic_number
from lbmpy.methods.momentbasedsimplifications import cse_in_opposing_directions
from lbmpy.methods.momentbased.momentbasedsimplifications import cse_in_opposing_directions
from lbmpy.simplificationfactory import create_simplification_strategy
from lbmpy.stencils import get_stencil
......
This diff is collapsed.
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