Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Markus Holzer
lbmpy
Commits
ca1041b6
Commit
ca1041b6
authored
Jul 06, 2018
by
Martin Bauer
Browse files
Bugfix: entropic methods now work with CSE
- CSE has to be done after dynamic relaxation rate adaption
parent
724c9552
Changes
3
Hide whitespace changes
Inline
Side-by-side
creationfunctions.py
View file @
ca1041b6
...
...
@@ -266,11 +266,8 @@ def create_lb_collision_rule(lb_method=None, optimization={}, **kwargs):
lb_method
=
create_lb_method
(
**
params
)
split_inner_loop
=
'split'
in
opt_params
and
opt_params
[
'split'
]
dir_cse
=
'cse_pdfs'
cse_pdfs
=
False
if
dir_cse
not
in
opt_params
else
opt_params
[
dir_cse
]
cse_global
=
False
if
'cse_global'
not
in
opt_params
else
opt_params
[
'cse_global'
]
simplification
=
create_simplification_strategy
(
lb_method
,
cse_pdfs
,
cse_global
,
split_inner_loop
)
simplification
=
create_simplification_strategy
(
lb_method
,
cse_pdfs
=
False
,
cse_global
=
False
,
split_inner_loop
=
split_inner_loop
)
cqc
=
lb_method
.
conserved_quantity_computation
if
params
[
'velocity_input'
]
is
not
None
:
...
...
@@ -303,6 +300,15 @@ def create_lb_collision_rule(lb_method=None, optimization={}, **kwargs):
if
'split_groups'
in
collision_rule
.
simplification_hints
:
collision_rule
.
simplification_hints
[
'split_groups'
][
0
].
append
(
sp
.
Symbol
(
"smagorinsky_omega"
))
cse_pdfs
=
False
if
'cse_pdfs'
not
in
opt_params
else
opt_params
[
'cse_pdfs'
]
cse_global
=
False
if
'cse_global'
not
in
opt_params
else
opt_params
[
'cse_global'
]
if
cse_pdfs
:
from
lbmpy.methods.momentbasedsimplifications
import
cse_in_opposing_directions
collision_rule
=
cse_in_opposing_directions
(
collision_rule
)
if
cse_global
:
from
pystencils.simp
import
sympy_cse
collision_rule
=
sympy_cse
(
collision_rule
)
return
collision_rule
...
...
methods/entropic_eq_srt.py
View file @
ca1041b6
...
...
@@ -65,8 +65,9 @@ class EntropicEquilibriumSRT(AbstractLbMethod):
all_subexpressions
+=
force_subexpressions
collision_eqs
=
[
Assignment
(
eq
.
lhs
,
eq
.
rhs
+
force_term_symbol
)
for
eq
,
force_term_symbol
in
zip
(
collision_eqs
,
force_term_symbols
)]
return
LbmCollisionRule
(
self
,
collision_eqs
,
all_subexpressions
)
cr
=
LbmCollisionRule
(
self
,
collision_eqs
,
all_subexpressions
)
cr
.
simplification_hints
[
'relaxation_rates'
]
=
[]
return
cr
def
get_collision_rule
(
self
):
return
self
.
_get_collision_rule_with_relaxation_rate
(
self
.
_relaxationRate
)
...
...
methods/momentbasedsimplifications.py
View file @
ca1041b6
...
...
@@ -147,9 +147,12 @@ def cse_in_opposing_directions(cr: LbmCollisionRule):
"""
sh
=
cr
.
simplification_hints
assert
'relaxation_rates'
in
sh
,
"Needs simplification hint 'relaxation_rates': Sequence of relaxation rates"
update_rules
=
cr
.
main_assignments
stencil
=
cr
.
method
.
stencil
if
not
sh
[
'relaxation_rates'
]:
return
cr
relaxation_rates
=
sp
.
Matrix
(
sh
[
'relaxation_rates'
]).
atoms
(
sp
.
Symbol
)
replacement_symbol_generator
=
cr
.
subexpression_symbol_generator
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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