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
pycodegen
lbmpy
Commits
47e9a1a9
Commit
47e9a1a9
authored
4 years ago
by
Michael Kuron
Browse files
Options
Downloads
Patches
Plain Diff
Fix sign error in Schiller force model
parent
4c83f435
No related branches found
No related tags found
1 merge request
!34
Schiller force model to be used instead of Guo on non-SRT
Pipeline
#26562
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/forcemodels.py
+1
-1
1 addition, 1 deletion
lbmpy/forcemodels.py
lbmpy_tests/test_force.py
+5
-4
5 additions, 4 deletions
lbmpy_tests/test_force.py
with
6 additions
and
5 deletions
lbmpy/forcemodels.py
+
1
−
1
View file @
47e9a1a9
...
@@ -175,7 +175,7 @@ class Schiller:
...
@@ -175,7 +175,7 @@ class Schiller:
omega
=
get_shear_relaxation_rate
(
lb_method
)
omega
=
get_shear_relaxation_rate
(
lb_method
)
omega_bulk
=
get_bulk_relaxation_rate
(
lb_method
)
omega_bulk
=
get_bulk_relaxation_rate
(
lb_method
)
G
=
(
u
*
force
.
transpose
()
+
force
*
u
.
transpose
()
-
uf
*
sp
.
Rational
(
2
,
lb_method
.
dim
))
*
sp
.
Rational
(
1
,
2
)
*
\
G
=
(
u
*
force
.
transpose
()
+
force
*
u
.
transpose
()
-
uf
*
sp
.
Rational
(
2
,
lb_method
.
dim
))
*
sp
.
Rational
(
1
,
2
)
*
\
(
2
+
omega
)
+
uf
*
sp
.
Rational
(
1
,
lb_method
.
dim
)
*
(
2
+
omega_bulk
)
(
2
-
omega
)
+
uf
*
sp
.
Rational
(
1
,
lb_method
.
dim
)
*
(
2
-
omega_bulk
)
result
=
[]
result
=
[]
for
direction
,
w_i
in
zip
(
lb_method
.
stencil
,
lb_method
.
weights
):
for
direction
,
w_i
in
zip
(
lb_method
.
stencil
,
lb_method
.
weights
):
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_force.py
+
5
−
4
View file @
47e9a1a9
...
@@ -112,15 +112,16 @@ def test_modes(stencil, force_model):
...
@@ -112,15 +112,16 @@ def test_modes(stencil, force_model):
if
force_model
==
"
schiller
"
:
if
force_model
==
"
schiller
"
:
num_stresses
=
(
dim
*
dim
-
dim
)
//
2
+
dim
num_stresses
=
(
dim
*
dim
-
dim
)
//
2
+
dim
lambda_s
,
lambda_b
=
-
omega_s
,
-
omega_b
# The stress moments should match eq. 47 from https://doi.org/10.1023/A:1010414013942
# The stress moments should match eq. 47 from https://doi.org/10.1023/A:1010414013942
u
=
method
.
first_order_equilibrium_moment_symbols
u
=
method
.
first_order_equilibrium_moment_symbols
def
traceless
(
m
):
def
traceless
(
m
):
tr
=
sp
.
simplify
(
sp
.
Trace
(
m
))
tr
=
sp
.
simplify
(
sp
.
Trace
(
m
))
return
m
-
tr
/
m
.
shape
[
0
]
*
sp
.
eye
(
m
.
shape
[
0
])
return
m
-
tr
/
m
.
shape
[
0
]
*
sp
.
eye
(
m
.
shape
[
0
])
C
=
sp
.
Rational
(
1
,
2
)
*
(
2
+
omeg
a_s
)
*
(
traceless
(
sp
.
Matrix
(
u
)
*
sp
.
Matrix
(
F
).
transpose
())
+
\
C
=
sp
.
Rational
(
1
,
2
)
*
(
2
+
lambd
a_s
)
*
(
traceless
(
sp
.
Matrix
(
u
)
*
sp
.
Matrix
(
F
).
transpose
())
+
\
traceless
(
sp
.
Matrix
(
F
)
*
sp
.
Matrix
(
u
).
transpose
()))
+
\
traceless
(
sp
.
Matrix
(
F
)
*
sp
.
Matrix
(
u
).
transpose
()))
+
\
sp
.
Rational
(
1
,
method
.
dim
)
*
(
2
+
omeg
a_b
)
*
sp
.
Matrix
(
u
).
dot
(
F
)
*
sp
.
eye
(
method
.
dim
)
sp
.
Rational
(
1
,
method
.
dim
)
*
(
2
+
lambd
a_b
)
*
sp
.
Matrix
(
u
).
dot
(
F
)
*
sp
.
eye
(
method
.
dim
)
subs
=
{
sp
.
Symbol
(
chr
(
ord
(
"
x
"
)
+
i
))
*
sp
.
Symbol
(
chr
(
ord
(
"
x
"
)
+
j
))
:
C
[
i
,
j
]
subs
=
{
sp
.
Symbol
(
chr
(
ord
(
"
x
"
)
+
i
))
*
sp
.
Symbol
(
chr
(
ord
(
"
x
"
)
+
j
))
:
C
[
i
,
j
]
for
i
in
range
(
dim
)
for
j
in
range
(
dim
)}
for
i
in
range
(
dim
)
for
j
in
range
(
dim
)}
...
@@ -139,7 +140,7 @@ def test_modes(stencil, force_model):
...
@@ -139,7 +140,7 @@ def test_modes(stencil, force_model):
# Check eq. 4.53b from schiller2008thermal
# Check eq. 4.53b from schiller2008thermal
assert
[
sp
.
simplify
(
sum
(
ff
[
i
]
*
stencil
[
i
][
j
]
for
i
in
range
(
len
(
stencil
))))
for
j
in
range
(
dim
)]
==
F
assert
[
sp
.
simplify
(
sum
(
ff
[
i
]
*
stencil
[
i
][
j
]
for
i
in
range
(
len
(
stencil
))))
for
j
in
range
(
dim
)]
==
F
# Check eq. 4.61a from schiller2008thermal
# Check eq. 4.61a from schiller2008thermal
ref
=
(
2
+
omeg
a_s
)
/
2
*
(
traceless
(
sp
.
Matrix
(
u
)
*
sp
.
Matrix
(
F
).
transpose
())
+
\
ref
=
(
2
+
lambd
a_s
)
/
2
*
(
traceless
(
sp
.
Matrix
(
u
)
*
sp
.
Matrix
(
F
).
transpose
())
+
\
traceless
(
sp
.
Matrix
(
F
)
*
sp
.
Matrix
(
u
).
transpose
()))
traceless
(
sp
.
Matrix
(
F
)
*
sp
.
Matrix
(
u
).
transpose
()))
s
=
sp
.
zeros
(
dim
)
s
=
sp
.
zeros
(
dim
)
for
i
in
range
(
0
,
len
(
stencil
)):
for
i
in
range
(
0
,
len
(
stencil
)):
...
@@ -147,7 +148,7 @@ def test_modes(stencil, force_model):
...
@@ -147,7 +148,7 @@ def test_modes(stencil, force_model):
assert
sp
.
simplify
(
s
-
ref
)
==
sp
.
zeros
(
dim
)
assert
sp
.
simplify
(
s
-
ref
)
==
sp
.
zeros
(
dim
)
# Check eq. 4.61b from schiller2008thermal
# Check eq. 4.61b from schiller2008thermal
assert
sp
.
simplify
(
sum
(
ff
[
i
]
*
stencil
[
i
][
a
]
**
2
for
i
in
range
(
len
(
stencil
))
for
a
in
range
(
dim
))
assert
sp
.
simplify
(
sum
(
ff
[
i
]
*
stencil
[
i
][
a
]
**
2
for
i
in
range
(
len
(
stencil
))
for
a
in
range
(
dim
))
-
(
2
+
omeg
a_b
)
*
sp
.
Matrix
(
u
).
dot
(
F
))
==
0
-
(
2
+
lambd
a_b
)
*
sp
.
Matrix
(
u
).
dot
(
F
))
==
0
# All other moments should be zero
# All other moments should be zero
assert
list
(
force_moments
[
dim
+
1
+
num_stresses
:])
==
[
0
]
*
(
len
(
stencil
)
-
(
dim
+
1
+
num_stresses
))
assert
list
(
force_moments
[
dim
+
1
+
num_stresses
:])
==
[
0
]
*
(
len
(
stencil
)
-
(
dim
+
1
+
num_stresses
))
...
...
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