Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Markus Holzer
lbmpy
Commits
b41e8378
Commit
b41e8378
authored
2 years ago
by
Frederik Hennig
Committed by
Markus Holzer
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixed extraction of common srt eq term
parent
19c4e7bc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/methods/momentbased/momentbasedsimplifications.py
+7
-2
7 additions, 2 deletions
lbmpy/methods/momentbased/momentbasedsimplifications.py
lbmpy_tests/test_srt_trt_simplifications.py
+18
-4
18 additions, 4 deletions
lbmpy_tests/test_srt_trt_simplifications.py
with
25 additions
and
6 deletions
lbmpy/methods/momentbased/momentbasedsimplifications.py
+
7
−
2
View file @
b41e8378
...
...
@@ -43,7 +43,7 @@ def factor_relaxation_rates(cr: LbmCollisionRule):
"""
sh
=
cr
.
simplification_hints
assert
'
relaxation_rates
'
in
sh
,
"
Needs simplification hint
'
relaxation_rates
'
: Sequence of relaxation rates
"
if
len
(
sh
[
'
relaxation_rates
'
])
>
19
:
# heuristics, works well if there is a small number of relaxation rates
if
len
(
set
(
sh
[
'
relaxation_rates
'
])
)
>
19
:
# heuristics, works well if there is a small number of relaxation rates
return
cr
relaxation_rates
=
sp
.
Matrix
(
sh
[
'
relaxation_rates
'
]).
atoms
(
sp
.
Symbol
)
...
...
@@ -385,10 +385,15 @@ def __get_common_quadratic_and_constant_terms(cr: LbmCollisionRule):
t
=
t
.
subs
({
ft
:
0
for
ft
in
sh
[
'
force_terms
'
]})
weight
=
t
weight
=
weight
.
subs
(
sh
[
'
density_deviation
'
],
1
)
weight
=
weight
.
subs
(
sh
[
'
density
'
],
1
)
for
u
in
sh
[
'
velocity
'
]:
weight
=
weight
.
subs
(
u
,
0
)
weight
=
weight
/
sh
[
'
density
'
]
#
weight = weight / sh['density']
if
weight
==
0
:
return
None
# t = t.subs(sh['density_deviation'], 0)
return
t
/
weight
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_srt_trt_simplifications.py
+
18
−
4
View file @
b41e8378
...
...
@@ -31,20 +31,34 @@ def check_method(method, limits_default, limits_cse):
assert
ops_cse
[
'
divs
'
]
<=
limits_cse
[
2
]
def
test_simplifications_srt_d2q9_incompressible
():
def
test_simplifications_srt_d2q9_incompressible
_regular
():
omega
=
sp
.
symbols
(
'
omega
'
)
method
=
create_srt
(
LBStencil
(
Stencil
.
D2Q9
),
omega
,
compressible
=
False
,
equilibrium_order
=
2
)
check_method
(
method
,
[
53
,
46
,
0
],
[
57
,
38
,
0
])
zero_centered
=
False
,
equilibrium_order
=
2
)
check_method
(
method
,
[
53
,
46
,
0
],
[
53
,
38
,
0
])
def
test_simplifications_srt_d2q9_incompressible_zc
():
omega
=
sp
.
symbols
(
'
omega
'
)
method
=
create_srt
(
LBStencil
(
Stencil
.
D2Q9
),
omega
,
compressible
=
False
,
zero_centered
=
True
,
delta_equilibrium
=
True
,
equilibrium_order
=
2
)
check_method
(
method
,
[
53
,
46
,
0
],
[
53
,
38
,
0
])
def
test_simplifications_srt_d2q9_compressible
():
def
test_simplifications_srt_d2q9_compressible
_regular
():
omega
=
sp
.
symbols
(
'
omega
'
)
method
=
create_srt
(
LBStencil
(
Stencil
.
D2Q9
),
omega
,
compressible
=
True
,
equilibrium_order
=
2
)
check_method
(
method
,
[
53
,
58
,
1
],
[
53
,
42
,
1
])
def
test_simplifications_srt_d2q9_compressible_zc
():
omega
=
sp
.
symbols
(
'
omega
'
)
method
=
create_srt
(
LBStencil
(
Stencil
.
D2Q9
),
omega
,
compressible
=
True
,
zero_centered
=
True
,
delta_equilibrium
=
True
,
equilibrium_order
=
2
)
check_method
(
method
,
[
54
,
58
,
1
],
[
54
,
42
,
1
])
def
test_simplifications_trt_d2q9_incompressible
():
o1
,
o2
=
sp
.
symbols
(
"
omega_1 omega_2
"
)
method
=
create_trt
(
LBStencil
(
Stencil
.
D2Q9
),
o1
,
o2
,
compressible
=
False
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment