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
ff68674d
Commit
ff68674d
authored
3 years ago
by
Markus Holzer
Committed by
Helen Schottenhamml
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Relaxation rates should be floats
parent
c49363ff
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!105
Relaxation rates should be floats
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/methods/abstractlbmethod.py
+5
-0
5 additions, 0 deletions
lbmpy/methods/abstractlbmethod.py
lbmpy/methods/creationfunctions.py
+3
-3
3 additions, 3 deletions
lbmpy/methods/creationfunctions.py
with
8 additions
and
3 deletions
lbmpy/methods/abstractlbmethod.py
+
5
−
0
View file @
ff68674d
...
...
@@ -2,6 +2,7 @@ import abc
from
collections
import
namedtuple
import
sympy
as
sp
from
sympy.core.numbers
import
Zero
from
pystencils
import
Assignment
,
AssignmentCollection
...
...
@@ -52,6 +53,7 @@ class AbstractLbMethod(abc.ABC):
"""
Returns a qxq diagonal matrix which contains the relaxation rate for each moment on the diagonal
"""
d
=
sp
.
zeros
(
len
(
self
.
relaxation_rates
))
for
i
in
range
(
0
,
len
(
self
.
relaxation_rates
)):
# note that 0.0 is converted to sp.Zero here. It is not possible to prevent this.
d
[
i
,
i
]
=
self
.
relaxation_rates
[
i
]
return
d
...
...
@@ -104,6 +106,9 @@ class AbstractLbMethod(abc.ABC):
for
relaxation_rate
in
rr
:
if
relaxation_rate
not
in
unique_relaxation_rates
:
relaxation_rate
=
sp
.
sympify
(
relaxation_rate
)
# special treatment for zero, sp.Zero would be an integer ..
if
isinstance
(
relaxation_rate
,
Zero
):
relaxation_rate
=
0.0
if
not
isinstance
(
relaxation_rate
,
sp
.
Symbol
):
rt_symbol
=
sp
.
Symbol
(
f
"
rr_
{
len
(
subexpressions
)
}
"
)
subexpressions
[
relaxation_rate
]
=
rt_symbol
...
...
This diff is collapsed.
Click to expand it.
lbmpy/methods/creationfunctions.py
+
3
−
3
View file @
ff68674d
...
...
@@ -605,11 +605,11 @@ def _get_relaxation_info_dict(relaxation_rates, nested_moments, dim):
for
group
in
nested_moments
:
for
moment
in
group
:
if
get_order
(
moment
)
<=
1
:
result
[
moment
]
=
0
result
[
moment
]
=
0
.0
elif
is_shear_moment
(
moment
,
dim
):
result
[
moment
]
=
relaxation_rates
[
0
]
else
:
result
[
moment
]
=
1
result
[
moment
]
=
1
.0
# if relaxation rate for each moment is specified they are all used
if
len
(
relaxation_rates
)
==
number_of_moments
:
...
...
@@ -634,7 +634,7 @@ def _get_relaxation_info_dict(relaxation_rates, nested_moments, dim):
next_rr
=
False
for
moment
in
group
:
if
get_order
(
moment
)
<=
1
:
result
[
moment
]
=
0
result
[
moment
]
=
0
.0
elif
is_shear_moment
(
moment
,
dim
):
result
[
moment
]
=
shear_rr
elif
is_bulk_moment
(
moment
,
dim
):
...
...
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