Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 336 additions and 50 deletions
from .cumulantbasedmethod import CumulantBasedLbMethod from .cumulantbasedmethod import CumulantBasedLbMethod
from .galilean_correction import add_galilean_correction from .galilean_correction import add_galilean_correction
from .fourth_order_correction import add_fourth_order_correction
__all__ = ['CumulantBasedLbMethod', 'add_galilean_correction'] __all__ = ['CumulantBasedLbMethod', 'add_galilean_correction', 'add_fourth_order_correction']
...@@ -16,11 +16,8 @@ def insert_logs(ac, **kwargs): ...@@ -16,11 +16,8 @@ def insert_logs(ac, **kwargs):
def insert_log_products(ac, **kwargs): def insert_log_products(ac, **kwargs):
def callback(asm): def callback(asm):
rhs = asm.rhs rhs = asm.rhs
if isinstance(rhs, sp.log): if rhs.find(sp.log):
return True return True
if isinstance(rhs, sp.Mul):
if any(isinstance(arg, sp.log) for arg in rhs.args):
return True
return False return False
return insert_subexpressions(ac, callback, **kwargs) return insert_subexpressions(ac, callback, **kwargs)
......
...@@ -23,7 +23,7 @@ class CumulantBasedLbMethod(AbstractLbMethod): ...@@ -23,7 +23,7 @@ class CumulantBasedLbMethod(AbstractLbMethod):
This class implements cumulant-based lattice boltzmann methods which relax all the non-conserved quantities This class implements cumulant-based lattice boltzmann methods which relax all the non-conserved quantities
as either monomial or polynomial cumulants. It is mostly inspired by the work presented in :cite:`geier2015`. as either monomial or polynomial cumulants. It is mostly inspired by the work presented in :cite:`geier2015`.
This method is implemented modularily as the transformation from populations to central moments to cumulants This method is implemented modularly as the transformation from populations to central moments to cumulants
is governed by subclasses of :class:`lbmpy.moment_transforms.AbstractMomentTransform` is governed by subclasses of :class:`lbmpy.moment_transforms.AbstractMomentTransform`
which can be specified by constructor argument. This allows the selection of the most efficient transformation which can be specified by constructor argument. This allows the selection of the most efficient transformation
for a given setup. for a given setup.
...@@ -124,7 +124,7 @@ class CumulantBasedLbMethod(AbstractLbMethod): ...@@ -124,7 +124,7 @@ class CumulantBasedLbMethod(AbstractLbMethod):
@property @property
def zeroth_order_equilibrium_moment_symbol(self, ): def zeroth_order_equilibrium_moment_symbol(self, ):
"""Returns a symbol referring to the zeroth-order moment of this method's equilibrium distribution, """Returns a symbol referring to the zeroth-order moment of this method's equilibrium distribution,
which is the area under it's curve which is the area under its curve
(see :attr:`lbmpy.equilibrium.AbstractEquilibrium.zeroth_order_moment_symbol`).""" (see :attr:`lbmpy.equilibrium.AbstractEquilibrium.zeroth_order_moment_symbol`)."""
return self._equilibrium.zeroth_order_moment_symbol return self._equilibrium.zeroth_order_moment_symbol
......
This diff is collapsed.
...@@ -286,7 +286,7 @@ def _get_relaxation_rates(collision_rule): ...@@ -286,7 +286,7 @@ def _get_relaxation_rates(collision_rule):
omega_s = get_shear_relaxation_rate(method) omega_s = get_shear_relaxation_rate(method)
# if the shear relaxation rate is not specified as a symbol look for its symbolic counter part in the subs dict # if the shear relaxation rate is not specified as a symbol look for its symbolic counter part in the subs dict
for symbolic_rr, rr in method.subs_dict_relxation_rate.items(): for symbolic_rr, rr in method.subs_dict_relaxation_rate.items():
if omega_s == rr: if omega_s == rr:
omega_s = symbolic_rr omega_s = symbolic_rr
......
...@@ -67,10 +67,10 @@ class CentralMomentsToCumulantsByGeneratingFunc(AbstractMomentTransform): ...@@ -67,10 +67,10 @@ class CentralMomentsToCumulantsByGeneratingFunc(AbstractMomentTransform):
self.cumulant_exponents = self.moment_exponents self.cumulant_exponents = self.moment_exponents
self.cumulant_polynomials = self.moment_polynomials self.cumulant_polynomials = self.moment_polynomials
if(len(self.cumulant_exponents) != stencil.Q): if len(self.cumulant_exponents) != stencil.Q:
raise ValueError("Number of cumulant exponent tuples must match stencil size.") raise ValueError("Number of cumulant exponent tuples must match stencil size.")
if(len(self.cumulant_polynomials) != stencil.Q): if len(self.cumulant_polynomials) != stencil.Q:
raise ValueError("Number of cumulant polynomials must match stencil size.") raise ValueError("Number of cumulant polynomials must match stencil size.")
self.central_moment_exponents = self.compute_required_central_moments() self.central_moment_exponents = self.compute_required_central_moments()
......
...@@ -86,8 +86,8 @@ def moment_permutations(exponent_tuple): ...@@ -86,8 +86,8 @@ def moment_permutations(exponent_tuple):
def moments_of_order(order, dim=3, include_permutations=True): def moments_of_order(order, dim=3, include_permutations=True):
"""All tuples of length 'dim' which sum equals 'order'""" """All tuples of length 'dim' which sum equals 'order'"""
for item in __fixed_sum_tuples(dim, order, ordered=not include_permutations): for item in __fixed_sum_tuples(dim, order, ordered=not include_permutations):
assert(len(item) == dim) assert len(item) == dim
assert(sum(item) == order) assert sum(item) == order
yield item yield item
......