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
28de45b8
Commit
28de45b8
authored
8 months ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fix PSM
parent
9fecfe2d
No related branches found
No related tags found
1 merge request
!180
[FIX] PSM generation
Pipeline
#69403
passed
8 months ago
Stage: pretest
Stage: test
Stage: docs
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lbmpy/methods/abstractlbmethod.py
+3
-2
3 additions, 2 deletions
src/lbmpy/methods/abstractlbmethod.py
tests/test_psm.py
+23
-0
23 additions, 0 deletions
tests/test_psm.py
with
26 additions
and
2 deletions
src/lbmpy/methods/abstractlbmethod.py
+
3
−
2
View file @
28de45b8
...
...
@@ -124,7 +124,8 @@ class AbstractLbMethod(abc.ABC):
substitutions
=
[
Assignment
(
e
[
1
],
e
[
0
])
for
e
in
subexpressions
.
items
()]
if
relaxation_rates_modifier
is
not
None
:
symbolic_relaxation_rates
=
[
r
*
relaxation_rates_modifier
for
r
in
symbolic_relaxation_rates
]
for
srr
in
symbolic_relaxation_rates
:
assert
isinstance
(
srr
,
sp
.
Symbol
)
else
:
for
srr
in
symbolic_relaxation_rates
:
assert
isinstance
(
srr
,
sp
.
Symbol
)
return
substitutions
,
sp
.
diag
(
*
symbolic_relaxation_rates
)
This diff is collapsed.
Click to expand it.
tests/test_psm.py
0 → 100644
+
23
−
0
View file @
28de45b8
import
pytest
from
pystencils
import
fields
,
CreateKernelConfig
,
Target
,
create_kernel
,
get_code_str
from
lbmpy
import
LBMConfig
,
Stencil
,
Method
,
LBStencil
,
create_lb_method
,
create_lb_collision_rule
from
lbmpy.partially_saturated_cells
import
PSMConfig
@pytest.mark.parametrize
(
'
stencil
'
,
[
Stencil
.
D2Q9
,
Stencil
.
D3Q15
,
Stencil
.
D3Q19
,
Stencil
.
D3Q27
])
def
test_psm_integration
(
stencil
):
stencil
=
LBStencil
(
stencil
)
fraction_field
=
fields
(
"
fraction_field: double[66, 18, 18]
"
,
layout
=
(
2
,
1
,
0
))
object_vel
=
fields
(
"
object_vel(3): double[66, 18, 18]
"
,
layout
=
(
3
,
2
,
1
,
0
))
psm_config
=
PSMConfig
(
fraction_field
=
fraction_field
,
object_velocity_field
=
object_vel
)
lbm_config
=
LBMConfig
(
stencil
=
stencil
,
method
=
Method
.
SRT
,
relaxation_rate
=
1.5
,
psm_config
=
psm_config
)
config
=
CreateKernelConfig
(
target
=
Target
.
CPU
)
method
=
create_lb_method
(
lbm_config
)
collision_rule
=
create_lb_collision_rule
(
method
)
ast
=
create_kernel
(
collision_rule
,
config
=
config
)
code_str
=
get_code_str
(
ast
)
\ No newline at end of file
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