Skip to content
Snippets Groups Projects

Cumulant LBM

Merged Frederik Hennig requested to merge da15siwa/lbmpy:mr_cumulant_lbm into master
Viewing commit d17f8e41
Show latest version
1 file
+ 29
4
Preferences
Compare changes
@@ -12,7 +12,7 @@ from lbmpy.methods.conservedquantitycomputation import AbstractConservedQuantity
@@ -12,7 +12,7 @@ from lbmpy.methods.conservedquantitycomputation import AbstractConservedQuantity
from lbmpy.moments import (
from lbmpy.moments import (
moments_up_to_order, get_order,
moments_up_to_order, get_order,
monomial_to_polynomial_transformation_matrix,
monomial_to_polynomial_transformation_matrix,
moment_sort_key, exponent_to_polynomial_representation, extract_monomials
moment_sort_key, exponent_to_polynomial_representation, extract_monomials, MOMENT_SYMBOLS
)
)
# Local Imports
# Local Imports
@@ -143,6 +143,14 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
@@ -143,6 +143,14 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
self._cumulant_transform_class = cumulant_transform_class
self._cumulant_transform_class = cumulant_transform_class
self._central_moment_transform_class = central_moment_transform_class
self._central_moment_transform_class = central_moment_transform_class
 
@property
 
def force_model(self):
 
return self._force_model
 
 
@property
 
def relaxation_info_dict(self):
 
return self._cumulant_to_relaxation_info_dict
 
@property
@property
def zeroth_order_equilibrium_moment_symbol(self, ):
def zeroth_order_equilibrium_moment_symbol(self, ):
return self._conserved_quantity_computation.zeroth_order_moment_symbol
return self._conserved_quantity_computation.zeroth_order_moment_symbol
@@ -151,14 +159,27 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
@@ -151,14 +159,27 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
def first_order_equilibrium_moment_symbols(self, ):
def first_order_equilibrium_moment_symbols(self, ):
return self._conserved_quantity_computation.first_order_moment_symbols
return self._conserved_quantity_computation.first_order_moment_symbols
@property
def set_first_moment_relaxation_rate(self, relaxation_rate):
def force_model(self):
for e in MOMENT_SYMBOLS[:self.dim]:
return self._force_model
assert e in self._cumulant_to_relaxation_info_dict, \
 
"First cumulants are not relaxed separately by this method"
 
for e in MOMENT_SYMBOLS[:self.dim]:
 
prev_entry = self._cumulant_to_relaxation_info_dict[e]
 
new_entry = RelaxationInfo(prev_entry[0], relaxation_rate)
 
self._cumulant_to_relaxation_info_dict[e] = new_entry
@property
@property
def cumulants(self):
def cumulants(self):
return sorted(self._cumulant_to_relaxation_info_dict.keys(), key=moment_sort_key)
return sorted(self._cumulant_to_relaxation_info_dict.keys(), key=moment_sort_key)
 
@property
 
def cumulant_equilibrium_values(self):
 
return tuple([e.equilibrium_value for e in self._cumulant_to_relaxation_info_dict.values()])
 
 
@property
 
def relaxation_rates(self):
 
return tuple([e.relaxation_rate for e in self._cumulant_to_relaxation_info_dict.values()])
 
def _repr_html_(self):
def _repr_html_(self):
table = """
table = """
<table style="border:none; width: 100%">
<table style="border:none; width: 100%">
@@ -215,6 +236,10 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
@@ -215,6 +236,10 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
else:
else:
return ac
return ac
 
def get_equilibrium_terms(self):
 
equilibrium = self.get_equilibrium()
 
return sp.Matrix([eq.rhs for eq in equilibrium.main_assignments])
 
def get_collision_rule(self, pre_simplification=False):
def get_collision_rule(self, pre_simplification=False):
"""Returns an LbmCollisionRule i.e. an equation collection with a reference to the method.
"""Returns an LbmCollisionRule i.e. an equation collection with a reference to the method.
This collision rule defines the collision operator."""
This collision rule defines the collision operator."""