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
fbf20204
Commit
fbf20204
authored
8 months ago
by
Helen Schottenhamml
Browse files
Options
Downloads
Plain Diff
Merge branch 'FixNightly' into 'master'
[Fix] nightly-sympy pipeline See merge request
!176
parents
c6fc87d8
0eb5958e
No related branches found
No related tags found
1 merge request
!176
[Fix] nightly-sympy pipeline
Pipeline
#69202
passed
8 months ago
Stage: pretest
Stage: test
Stage: docs
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lbmpy/methods/abstractlbmethod.py
+14
-10
14 additions, 10 deletions
src/lbmpy/methods/abstractlbmethod.py
with
14 additions
and
10 deletions
src/lbmpy/methods/abstractlbmethod.py
+
14
−
10
View file @
fbf20204
...
...
@@ -105,22 +105,26 @@ class AbstractLbMethod(abc.ABC):
the subexpressions, that assign the number to the newly introduced symbol
"""
rr
=
relaxation_rates
if
relaxation_rates
is
not
None
else
self
.
relaxation_rates
unique_relaxation_rates
=
set
()
subexpressions
=
{}
symbolic_relaxation_rates
=
list
()
for
relaxation_rate
in
rr
:
relaxation_rate
=
sp
.
sympify
(
relaxation_rate
)
if
relaxation_rate
not
in
unique_relaxation_rates
:
# special treatment for zero, sp.Zero would be an integer ..
if
isinstance
(
relaxation_rate
,
sp
.
Symbol
):
symbolic_relaxation_rate
=
relaxation_rate
else
:
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
unique_relaxation_rates
.
add
(
relaxation_rate
)
if
relaxation_rate
in
subexpressions
:
symbolic_relaxation_rate
=
subexpressions
[
relaxation_rate
]
else
:
symbolic_relaxation_rate
=
sp
.
Symbol
(
f
"
rr_
{
len
(
subexpressions
)
}
"
)
subexpressions
[
relaxation_rate
]
=
symbolic_relaxation_rate
symbolic_relaxation_rates
.
append
(
symbolic_relaxation_rate
)
new_rr
=
[
subexpressions
[
sp
.
sympify
(
e
)]
if
sp
.
sympify
(
e
)
in
subexpressions
else
e
for
e
in
rr
]
substitutions
=
[
Assignment
(
e
[
1
],
e
[
0
])
for
e
in
subexpressions
.
items
()]
if
relaxation_rates_modifier
is
not
None
:
new_rr
=
[
r
*
relaxation_rates_modifier
for
r
in
new_rr
]
symbolic_relaxation_rates
=
[
r
*
relaxation_rates_modifier
for
r
in
symbolic_relaxation_rates
]
for
srr
in
symbolic_relaxation_rates
:
assert
isinstance
(
srr
,
sp
.
Symbol
)
return
substitutions
,
sp
.
diag
(
*
new_rr
)
return
substitutions
,
sp
.
diag
(
*
symbolic_relaxation_rates
)
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