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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Sebastian Bindgen
lbmpy
Commits
46415911
Commit
46415911
authored
4 years ago
by
Michael Kuron
Browse files
Options
Downloads
Patches
Plain Diff
fix force test
parent
c3dbce3c
No related branches found
No related tags found
No related merge requests found
Changes
2
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
+6
-2
6 additions, 2 deletions
lbmpy_tests/test_force.py
with
7 additions
and
3 deletions
lbmpy/forcemodels.py
+
1
−
1
View file @
46415911
...
@@ -174,7 +174,7 @@ class Schiller:
...
@@ -174,7 +174,7 @@ class Schiller:
uf
=
u
.
dot
(
force
)
*
sp
.
eye
(
len
(
force
))
uf
=
u
.
dot
(
force
)
*
sp
.
eye
(
len
(
force
))
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
,
3
))
*
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
,
3
)
*
(
2
+
omega_bulk
)
(
2
+
omega
)
+
uf
*
sp
.
Rational
(
1
,
3
)
*
(
2
+
omega_bulk
)
result
=
[]
result
=
[]
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_force.py
+
6
−
2
View file @
46415911
...
@@ -2,6 +2,7 @@ from pystencils.session import *
...
@@ -2,6 +2,7 @@ from pystencils.session import *
from
lbmpy.session
import
*
from
lbmpy.session
import
*
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
import
lbmpy.forcemodels
import
lbmpy.forcemodels
from
lbmpy.moments
import
is_bulk_moment
import
pytest
import
pytest
from
contextlib
import
ExitStack
as
does_not_raise
from
contextlib
import
ExitStack
as
does_not_raise
...
@@ -103,7 +104,7 @@ def test_stress(stencil):
...
@@ -103,7 +104,7 @@ def test_stress(stencil):
force_moments
=
sp
.
simplify
(
method
.
moment_matrix
*
sp
.
Matrix
(
method
.
force_model
(
method
)))
force_moments
=
sp
.
simplify
(
method
.
moment_matrix
*
sp
.
Matrix
(
method
.
force_model
(
method
)))
# The momentum modes should contain the force
# The momentum modes should contain the force
assert
force_moments
[
1
:
dim
+
1
]
==
F
assert
list
(
force_moments
[
1
:
dim
+
1
]
)
==
F
# The stress modes should match eq. 47 from https://doi.org/10.1023/A:1010414013942
# The stress modes 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
...
@@ -121,4 +122,7 @@ def test_stress(stencil):
...
@@ -121,4 +122,7 @@ def test_stress(stencil):
method
.
moments
[
dim
+
1
:
dim
+
1
+
num_stresses
]):
method
.
moments
[
dim
+
1
:
dim
+
1
+
num_stresses
]):
ref
=
moment
.
subs
(
subs
)
ref
=
moment
.
subs
(
subs
)
diff
=
sp
.
simplify
(
ref
-
force_moment
)
diff
=
sp
.
simplify
(
ref
-
force_moment
)
assert
diff
==
0
or
isinstance
(
diff
,
sp
.
Rational
)
# difference should be zero or a constant
if
is_bulk_moment
(
moment
,
dim
):
assert
diff
==
0
or
isinstance
(
diff
,
sp
.
Rational
)
# difference should be zero or a constant
else
:
assert
diff
==
0
# difference should be zero
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