Commit f68761dc authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Renamed moment symbol bases

parent 84bfe3ac
......@@ -25,7 +25,7 @@ from .cumulant_transform import (
CentralMomentsToCumulantsByGeneratingFunc)
from lbmpy.moment_transforms import (
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT,
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT,
PdfsToCentralMomentsByShiftMatrix)
from lbmpy.methods.centeredcumulant.force_model import CenteredCumulantForceModel
......@@ -53,7 +53,7 @@ def cached_backward_transform(transform_obj, *args, **kwargs):
@disk_cache
def relax_lower_order_central_moments(moment_indices, pre_collision_values,
relaxation_rates, equilibrium_values,
post_collision_base=POST_COLLISION_CENTRAL_MOMENT):
post_collision_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT):
post_collision_symbols = [statistical_quantity_symbol(post_collision_base, i) for i in moment_indices]
equilibrium_vec = sp.Matrix(equilibrium_values)
moment_vec = sp.Matrix(pre_collision_values)
......@@ -381,7 +381,7 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
# 4) Add relaxation rules for lower order moments
lower_order_moments = moments_up_to_order(1, dim=self.dim)
lower_order_moment_symbols = [statistical_quantity_symbol(PRE_COLLISION_CENTRAL_MOMENT, exp)
lower_order_moment_symbols = [statistical_quantity_symbol(PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, exp)
for exp in lower_order_moments]
lower_order_relaxation_infos = [cumulant_to_relaxation_info_dict[exponent_to_polynomial_representation(e)]
......
......@@ -12,7 +12,7 @@ from lbmpy.moments import (
from itertools import product, chain
from lbmpy.moment_transforms import (
AbstractMomentTransform, PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT
AbstractMomentTransform, PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT
)
# ======================= Central Moments <-> Cumulants ==============================================================
......@@ -72,7 +72,7 @@ class CentralMomentsToCumulantsByGeneratingFunc(AbstractMomentTransform):
def forward_transform(self,
cumulant_base=PRE_COLLISION_CUMULANT,
central_moment_base=PRE_COLLISION_CENTRAL_MOMENT,
central_moment_base=PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT,
simplification=True,
subexpression_base='sub_k_to_C'):
simplification = self._get_simp_strategy(simplification)
......@@ -92,7 +92,7 @@ class CentralMomentsToCumulantsByGeneratingFunc(AbstractMomentTransform):
def backward_transform(self,
cumulant_base=POST_COLLISION_CUMULANT,
central_moment_base=POST_COLLISION_CENTRAL_MOMENT,
central_moment_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT,
simplification=True,
omit_conserved_moments=False,
subexpression_base='sub_C_to_k'):
......
......@@ -7,7 +7,7 @@ from pystencils.sympyextensions import subs_additive
from lbmpy.methods.abstractlbmethod import AbstractLbMethod, LbmCollisionRule, RelaxationInfo
from lbmpy.methods.conservedquantitycomputation import AbstractConservedQuantityComputation
from lbmpy.moment_transforms import (FastCentralMomentTransform,
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT)
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT)
from lbmpy.moments import (MOMENT_SYMBOLS, moment_matrix, set_up_shift_matrix,
statistical_quantity_symbol)
......@@ -16,7 +16,7 @@ from lbmpy.moments import (MOMENT_SYMBOLS, moment_matrix, set_up_shift_matrix,
def relax_central_moments(moment_indices, pre_collision_values,
relaxation_rates, equilibrium_values,
force_terms,
post_collision_base=POST_COLLISION_CENTRAL_MOMENT):
post_collision_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT):
post_collision_symbols = [sp.Symbol(f'{post_collision_base}_{"".join(str(i) for i in m)}') for m in moment_indices]
equilibrium_vec = sp.Matrix(equilibrium_values)
moment_vec = sp.Matrix(pre_collision_values)
......@@ -271,7 +271,7 @@ class CentralMomentBasedLbMethod(AbstractLbMethod):
moments_as_exponents = pdfs_to_c_transform.moment_exponents
# 2) Collision
moment_symbols = [statistical_quantity_symbol(PRE_COLLISION_CENTRAL_MOMENT, exp)
moment_symbols = [statistical_quantity_symbol(PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, exp)
for exp in moments_as_exponents]
relaxation_infos = [moment_to_relaxation_info_dict[m] for m in self.moments]
......
from .abstractmomenttransform import (
PRE_COLLISION_RAW_MOMENT, POST_COLLISION_RAW_MOMENT,
PRE_COLLISION_MONOMIAL_RAW_MOMENT, POST_COLLISION_MONOMIAL_RAW_MOMENT,
PRE_COLLISION_MOMENT, POST_COLLISION_MOMENT,
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT
)
from .abstractmomenttransform import AbstractMomentTransform
......@@ -22,7 +22,7 @@ __all__ = [
"PdfsToCentralMomentsByMatrix",
"PdfsToCentralMomentsByShiftMatrix",
"FastCentralMomentTransform",
"PRE_COLLISION_RAW_MOMENT", "POST_COLLISION_RAW_MOMENT",
"PRE_COLLISION_MONOMIAL_RAW_MOMENT", "POST_COLLISION_MONOMIAL_RAW_MOMENT",
"PRE_COLLISION_MOMENT", "POST_COLLISION_MOMENT",
"PRE_COLLISION_CENTRAL_MOMENT", "POST_COLLISION_CENTRAL_MOMENT"
"PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT", "POST_COLLISION_MONOMIAL_CENTRAL_MOMENT"
]
......@@ -6,14 +6,14 @@ from lbmpy.moments import (
exponents_to_polynomial_representations, extract_monomials, exponent_tuple_sort_key)
PRE_COLLISION_RAW_MOMENT = 'm'
POST_COLLISION_RAW_MOMENT = 'm_post'
PRE_COLLISION_MONOMIAL_RAW_MOMENT = 'm'
POST_COLLISION_MONOMIAL_RAW_MOMENT = 'm_post'
PRE_COLLISION_MOMENT = 'M'
POST_COLLISION_MOMENT = 'M_post'
PRE_COLLISION_CENTRAL_MOMENT = 'kappa'
POST_COLLISION_CENTRAL_MOMENT = 'kappa_post'
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT = 'kappa'
POST_COLLISION_MONOMIAL_CENTRAL_MOMENT = 'kappa_post'
class AbstractMomentTransform:
......
......@@ -12,7 +12,7 @@ from lbmpy.moments import statistical_quantity_symbol as sq_sym
from .abstractmomenttransform import (
AbstractMomentTransform,
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT
)
from .momenttransforms import PdfsToMomentsByChimeraTransform
......@@ -23,8 +23,8 @@ class PdfsToCentralMomentsByMatrix(AbstractMomentTransform):
def __init__(self, stencil, moment_polynomials,
equilibrium_density,
equilibrium_velocity,
pre_collision_central_moment_base=PRE_COLLISION_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_CENTRAL_MOMENT,
pre_collision_central_moment_base=PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT,
**kwargs):
assert len(moment_polynomials) == len(stencil), 'Number of moments must match stencil'
......@@ -100,8 +100,8 @@ class FastCentralMomentTransform(AbstractMomentTransform):
equilibrium_density,
equilibrium_velocity,
conserved_quantity_equations=None,
pre_collision_central_moment_base=PRE_COLLISION_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_CENTRAL_MOMENT,
pre_collision_central_moment_base=PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT,
**kwargs):
assert len(moment_polynomials) == len(stencil), 'Number of moments must match stencil'
......@@ -321,8 +321,8 @@ class PdfsToCentralMomentsByShiftMatrix(AbstractMomentTransform):
equilibrium_density,
equilibrium_velocity,
conserved_quantity_equations=None,
pre_collision_central_moment_base=PRE_COLLISION_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_CENTRAL_MOMENT,
pre_collision_central_moment_base=PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT,
post_collision_central_moment_base=POST_COLLISION_MONOMIAL_CENTRAL_MOMENT,
**kwargs):
assert len(moment_polynomials) == len(stencil), 'Number of moments must match stencil'
......
......@@ -12,7 +12,7 @@ from lbmpy.moments import statistical_quantity_symbol as sq_sym
from .abstractmomenttransform import (
AbstractMomentTransform,
PRE_COLLISION_MOMENT, POST_COLLISION_MOMENT,
PRE_COLLISION_RAW_MOMENT, POST_COLLISION_RAW_MOMENT
PRE_COLLISION_MONOMIAL_RAW_MOMENT, POST_COLLISION_MONOMIAL_RAW_MOMENT
)
......@@ -157,8 +157,8 @@ class PdfsToMomentsByChimeraTransform(AbstractMomentTransform):
conserved_quantity_equations=None,
pre_collision_moment_base=PRE_COLLISION_MOMENT,
post_collision_moment_base=POST_COLLISION_MOMENT,
pre_collision_raw_moment_base=PRE_COLLISION_RAW_MOMENT,
post_collision_raw_moment_base=POST_COLLISION_RAW_MOMENT,
pre_collision_raw_moment_base=PRE_COLLISION_MONOMIAL_RAW_MOMENT,
post_collision_raw_moment_base=POST_COLLISION_MONOMIAL_RAW_MOMENT,
**kwargs):
if moment_polynomials:
......
......@@ -7,7 +7,7 @@ import pytest
from lbmpy.stencils import get_stencil
from lbmpy.moment_transforms import (
PdfsToCentralMomentsByMatrix, FastCentralMomentTransform, PdfsToCentralMomentsByShiftMatrix,
PRE_COLLISION_CENTRAL_MOMENT, POST_COLLISION_CENTRAL_MOMENT
PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, POST_COLLISION_MONOMIAL_CENTRAL_MOMENT
)
......@@ -54,7 +54,7 @@ def test_forward_transform(type, stencil):
f_to_k_shift = f_to_k_shift.new_without_subexpressions().main_assignments_dict
for e in moment_exponents:
moment_symbol = statistical_quantity_symbol(PRE_COLLISION_CENTRAL_MOMENT, e)
moment_symbol = statistical_quantity_symbol(PRE_COLLISION_MONOMIAL_CENTRAL_MOMENT, e)
rhs_matrix = f_to_k_matrix[moment_symbol].expand()
rhs_fast = f_to_k_fast[moment_symbol].expand()
rhs_shift = f_to_k_shift[moment_symbol].expand()
......
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