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
6b1145e7
Commit
6b1145e7
authored
4 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Added assertions for boundary test case
parent
2504b1bb
No related branches found
No related tags found
1 merge request
!40
Advanced Streaming Extensions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lbmpy_tests/test_boundary_handling.py
+66
-2
66 additions, 2 deletions
lbmpy_tests/test_boundary_handling.py
with
66 additions
and
2 deletions
lbmpy_tests/test_boundary_handling.py
+
66
−
2
View file @
6b1145e7
...
...
@@ -19,8 +19,14 @@ def test_simple(target):
pytest
.
importorskip
(
'
pyopencl
'
)
import
pystencils.opencl.autoinit
dh
=
create_data_handling
((
10
,
5
),
parallel
=
False
,
default_target
=
target
)
dh
=
create_data_handling
((
4
,
4
),
parallel
=
False
,
default_target
=
target
)
dh
.
add_array
(
'
pdfs
'
,
values_per_cell
=
9
,
cpu
=
True
,
gpu
=
target
!=
'
cpu
'
)
for
i
in
range
(
9
):
dh
.
fill
(
"
pdfs
"
,
i
,
value_idx
=
i
,
ghost_layers
=
True
)
if
target
==
'
gpu
'
:
dh
.
all_to_gpu
()
lb_func
=
create_lb_function
(
stencil
=
'
D2Q9
'
,
compressible
=
False
,
relaxation_rate
=
1.8
,
...
...
@@ -29,7 +35,7 @@ def test_simple(target):
bh
=
LatticeBoltzmannBoundaryHandling
(
lb_func
.
method
,
dh
,
'
pdfs
'
,
target
=
target
)
wall
=
NoSlip
()
moving_wall
=
UBB
((
0.00
1
,
0
))
moving_wall
=
UBB
((
1
,
0
))
bh
.
set_boundary
(
wall
,
make_slice
[
0
,
:])
bh
.
set_boundary
(
wall
,
make_slice
[
-
1
,
:])
bh
.
set_boundary
(
wall
,
make_slice
[:,
0
])
...
...
@@ -38,6 +44,64 @@ def test_simple(target):
bh
.
prepare
()
bh
()
if
target
==
'
gpu
'
:
dh
.
all_to_cpu
()
# left lower corner
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
0
,
6
]
==
7
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
1
,
4
]
==
3
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
1
,
6
]
==
7
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
1
,
0
,
1
]
==
2
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
1
,
0
,
6
]
==
7
)
# left side
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
4
]
==
3
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
6
]
==
7
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
5
]
==
5
))
# left upper corner
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
4
,
4
]
==
3
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
4
,
8
]
==
5
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
5
,
8
]
==
5
+
6
/
36
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
1
,
5
,
8
]
==
5
+
6
/
36
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
1
,
5
,
2
]
==
1
)
# top side
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
2
:
4
,
5
,
2
]
==
1
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
2
:
4
,
5
,
7
]
==
6
-
6
/
36
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
2
:
4
,
5
,
8
]
==
5
+
6
/
36
))
# right upper corner
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
4
,
5
,
2
]
==
1
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
4
,
5
,
7
]
==
6
-
6
/
36
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
5
,
7
]
==
6
-
6
/
36
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
4
,
3
]
==
4
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
4
,
7
]
==
6
)
# right side
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
2
:
4
,
3
]
==
4
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
2
:
4
,
5
]
==
8
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
2
:
4
,
7
]
==
6
))
# right lower corner
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
1
,
3
]
==
4
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
1
,
5
]
==
8
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
5
,
0
,
5
]
==
8
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
4
,
0
,
1
]
==
2
)
assert
(
dh
.
cpu_arrays
[
'
pdfs
'
][
4
,
0
,
5
]
==
8
)
# lower side
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
4
]
==
3
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
6
]
==
7
))
assert
(
all
(
dh
.
cpu_arrays
[
'
pdfs
'
][
0
,
2
:
4
,
8
]
==
5
))
def
test_exotic_boundaries
():
step
=
LatticeBoltzmannStep
((
50
,
50
),
relaxation_rate
=
1.8
,
compressible
=
False
,
periodicity
=
False
)
...
...
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