Skip to content
Snippets Groups Projects

Cumulant LBM

Merged Frederik Hennig requested to merge da15siwa/lbmpy:mr_cumulant_lbm into master
Viewing commit cdc61152
Show latest version
1 file
+ 7
7
Preferences
Compare changes
@@ -31,7 +31,7 @@ def add_galilean_correction(poly_relaxation_eqs, polynomials, correction_terms):
@@ -31,7 +31,7 @@ def add_galilean_correction(poly_relaxation_eqs, polynomials, correction_terms):
def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vector,
def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vector,
pre_collision_cumulant_base=PRE_COLLISION_CUMULANT):
pre_collision_cumulant_base=PRE_COLLISION_CUMULANT):
PC1 = x**2 - y**2
PC1 = x**2 - y**2
PC2 = x**2 - z**2
PC2 = x**2 - z**2
@@ -40,7 +40,7 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
@@ -40,7 +40,7 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
try:
try:
omega_1 = cumulant_to_relaxation_info_dict[PC1].relaxation_rate
omega_1 = cumulant_to_relaxation_info_dict[PC1].relaxation_rate
assert omega_1 == cumulant_to_relaxation_info_dict[PC2].relaxation_rate, \
assert omega_1 == cumulant_to_relaxation_info_dict[PC2].relaxation_rate, \
"Cumulants (x^2 - y^2) and (x^2 - z^2) must have the same relaxation rate"
"Cumulants (x^2 - y^2) and (x^2 - z^2) must have the same relaxation rate"
omega_2 = cumulant_to_relaxation_info_dict[PC3].relaxation_rate
omega_2 = cumulant_to_relaxation_info_dict[PC3].relaxation_rate
except IndexError:
except IndexError:
raise ValueError("For the galilean correction, all three polynomial cumulants"
raise ValueError("For the galilean correction, all three polynomial cumulants"
@@ -55,8 +55,8 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
@@ -55,8 +55,8 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
# Derivative Approximations
# Derivative Approximations
subexpressions = [
subexpressions = [
Assignment(Dx, - omega_1 / (2 * rho) * (2 * Cxx - Cyy - Czz) -
Assignment(Dx, - omega_1 / (2 * rho) * (2 * Cxx - Cyy - Czz)
omega_2 / (2 * rho) * (Cxx + Cyy + Czz - rho)),
- omega_2 / (2 * rho) * (Cxx + Cyy + Czz - rho)),
Assignment(Dy, Dx + (3 * omega_1) / (2 * rho) * (Cxx - Cyy)),
Assignment(Dy, Dx + (3 * omega_1) / (2 * rho) * (Cxx - Cyy)),
Assignment(Dz, Dx + (3 * omega_1) / (2 * rho) * (Cxx - Czz)),
Assignment(Dz, Dx + (3 * omega_1) / (2 * rho) * (Cxx - Czz)),
]
]
@@ -65,7 +65,7 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
@@ -65,7 +65,7 @@ def get_galilean_correction_terms(cumulant_to_relaxation_info_dict, rho, u_vecto
main_assignments = [
main_assignments = [
Assignment(cor1, - 3 * rho * (1 - omega_1 / 2) * (u_vector[0]**2 * Dx - u_vector[1]**2 * Dy)),
Assignment(cor1, - 3 * rho * (1 - omega_1 / 2) * (u_vector[0]**2 * Dx - u_vector[1]**2 * Dy)),
Assignment(cor2, - 3 * rho * (1 - omega_1 / 2) * (u_vector[0]**2 * Dx - u_vector[2]**2 * Dz)),
Assignment(cor2, - 3 * rho * (1 - omega_1 / 2) * (u_vector[0]**2 * Dx - u_vector[2]**2 * Dz)),
Assignment(cor3, - 3 * rho * (1 - omega_2 / 2) *
Assignment(cor3, - 3 * rho * (1 - omega_2 / 2)
(u_vector[0]**2 * Dx + u_vector[1]**2 * Dy + u_vector[2]**2 * Dz)),
* (u_vector[0]**2 * Dx + u_vector[1]**2 * Dy + u_vector[2]**2 * Dz)),
]
]
return AssignmentCollection(main_assignments=main_assignments, subexpressions=subexpressions)
return AssignmentCollection(main_assignments=main_assignments, subexpressions=subexpressions)
\ No newline at end of file