Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Markus Holzer
lbmpy
Commits
01253c94
Commit
01253c94
authored
Aug 22, 2021
by
Frederik Hennig
Browse files
Fixed forcing subexpressions
parent
a759b049
Pipeline
#33896
failed with stages
in 12 minutes and 47 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lbmpy/methods/centeredcumulant/centeredcumulantmethod.py
View file @
01253c94
...
@@ -17,6 +17,8 @@ from lbmpy.moments import (moments_up_to_order, get_order,
...
@@ -17,6 +17,8 @@ from lbmpy.moments import (moments_up_to_order, get_order,
exponent_to_polynomial_representation
,
extract_monomials
,
MOMENT_SYMBOLS
,
exponent_to_polynomial_representation
,
extract_monomials
,
MOMENT_SYMBOLS
,
statistical_quantity_symbol
)
statistical_quantity_symbol
)
from
lbmpy.forcemodels
import
Luo
,
Simple
# Local Imports
# Local Imports
from
.cumulant_transform
import
(
from
.cumulant_transform
import
(
...
@@ -141,6 +143,11 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
...
@@ -141,6 +143,11 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
AbstractConservedQuantityComputation
)
AbstractConservedQuantityComputation
)
super
(
CenteredCumulantBasedLbMethod
,
self
).
__init__
(
stencil
)
super
(
CenteredCumulantBasedLbMethod
,
self
).
__init__
(
stencil
)
if
force_model
is
not
None
:
assert
(
isinstance
(
force_model
,
CenteredCumulantForceModel
)
or
isinstance
(
force_model
,
Simple
)
or
isinstance
(
force_model
,
Luo
)),
"Given force model currently not supported."
for
m
in
moments_up_to_order
(
1
,
dim
=
self
.
dim
):
for
m
in
moments_up_to_order
(
1
,
dim
=
self
.
dim
):
if
exponent_to_polynomial_representation
(
m
)
not
in
cumulant_to_relaxation_info_dict
.
keys
():
if
exponent_to_polynomial_representation
(
m
)
not
in
cumulant_to_relaxation_info_dict
.
keys
():
raise
ValueError
(
f
'No relaxation info given for conserved cumulant
{
m
}
!'
)
raise
ValueError
(
f
'No relaxation info given for conserved cumulant
{
m
}
!'
)
...
@@ -231,6 +238,9 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
...
@@ -231,6 +238,9 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
self
.
set_first_moment_relaxation_rate
(
relaxation_rate
)
self
.
set_first_moment_relaxation_rate
(
relaxation_rate
)
def
set_force_model
(
self
,
force_model
):
def
set_force_model
(
self
,
force_model
):
assert
(
isinstance
(
force_model
,
CenteredCumulantForceModel
)
or
isinstance
(
force_model
,
Simple
)
or
isinstance
(
force_model
,
Luo
)),
"Given force model currently not supported."
self
.
_force_model
=
force_model
self
.
_force_model
=
force_model
def
_repr_html_
(
self
):
def
_repr_html_
(
self
):
...
@@ -370,7 +380,7 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
...
@@ -370,7 +380,7 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
cqe
=
self
.
_conserved_quantity_computation
.
equilibrium_input_equations_from_pdfs
(
f
,
False
)
cqe
=
self
.
_conserved_quantity_computation
.
equilibrium_input_equations_from_pdfs
(
f
,
False
)
forcing_subexpressions
=
AssignmentCollection
([])
forcing_subexpressions
=
AssignmentCollection
([])
if
include_force_terms
and
self
.
_force_model
is
not
None
:
if
self
.
_force_model
is
not
None
:
forcing_subexpressions
=
AssignmentCollection
(
self
.
_force_model
.
subs_dict_force
)
forcing_subexpressions
=
AssignmentCollection
(
self
.
_force_model
.
subs_dict_force
)
# 1) Extract Monomial Cumulants for the higher-order polynomials
# 1) Extract Monomial Cumulants for the higher-order polynomials
...
...
lbmpy/methods/momentbased/centralmomentbasedmethod.py
View file @
01253c94
...
@@ -262,15 +262,14 @@ class CentralMomentBasedLbMethod(AbstractLbMethod):
...
@@ -262,15 +262,14 @@ class CentralMomentBasedLbMethod(AbstractLbMethod):
if
cqe
is
None
:
if
cqe
is
None
:
cqe
=
self
.
_conserved_quantity_computation
.
equilibrium_input_equations_from_pdfs
(
f
,
False
)
cqe
=
self
.
_conserved_quantity_computation
.
equilibrium_input_equations_from_pdfs
(
f
,
False
)
if
self
.
_force_model
is
None
:
include_force_terms
=
False
moment_space_forcing
=
False
forcing_subexpressions
=
AssignmentCollection
([])
forcing_subexpressions
=
AssignmentCollection
([])
if
include_force_terms
:
moment_space_forcing
=
False
moment_space_forcing
=
self
.
force_model
.
has_central_moment_space_forcing
if
self
.
_force_model
is
not
None
:
if
include_force_terms
:
moment_space_forcing
=
self
.
force_model
.
has_central_moment_space_forcing
forcing_subexpressions
=
AssignmentCollection
(
self
.
_force_model
.
subs_dict_force
)
forcing_subexpressions
=
AssignmentCollection
(
self
.
_force_model
.
subs_dict_force
)
else
:
include_force_terms
=
False
# 1) Get Forward Transformation from PDFs to central moments
# 1) Get Forward Transformation from PDFs to central moments
pdfs_to_c_transform
=
self
.
central_moment_transform_class
(
pdfs_to_c_transform
=
self
.
central_moment_transform_class
(
...
...
lbmpy/methods/momentbased/momentbasedmethod.py
View file @
01253c94
...
@@ -239,7 +239,7 @@ class MomentBasedLbMethod(AbstractLbMethod):
...
@@ -239,7 +239,7 @@ class MomentBasedLbMethod(AbstractLbMethod):
moment_space_forcing
=
self
.
_forceModel
.
has_moment_space_forcing
moment_space_forcing
=
self
.
_forceModel
.
has_moment_space_forcing
forcing_subexpressions
=
[]
forcing_subexpressions
=
[]
if
include_force_terms
:
if
self
.
_forceModel
is
not
None
:
forcing_subexpressions
=
AssignmentCollection
(
self
.
_forceModel
.
subs_dict_force
).
all_assignments
forcing_subexpressions
=
AssignmentCollection
(
self
.
_forceModel
.
subs_dict_force
).
all_assignments
rho
=
self
.
zeroth_order_equilibrium_moment_symbol
rho
=
self
.
zeroth_order_equilibrium_moment_symbol
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment