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
Markus Holzer
lbmpy
Commits
3cc4797c
Commit
3cc4797c
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
New tr
parent
0290bdbf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#34590
failed
3 years ago
Stage: pretest
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/methods/creationfunctions.py
+4
-6
4 additions, 6 deletions
lbmpy/methods/creationfunctions.py
lbmpy_tests/advanced_streaming/test_advanced_streaming_noslip.py
+23
-23
23 additions, 23 deletions
...ests/advanced_streaming/test_advanced_streaming_noslip.py
with
27 additions
and
29 deletions
lbmpy/methods/creationfunctions.py
+
4
−
6
View file @
3cc4797c
...
@@ -294,9 +294,7 @@ def create_central_moment(stencil, relaxation_rates, nested_moments=None,
...
@@ -294,9 +294,7 @@ def create_central_moment(stencil, relaxation_rates, nested_moments=None,
Args:
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBStenil`
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment
nested_moments: a list of lists of modes, grouped by common relaxation times. This is usually used in
nested_moments: a list of lists of modes, grouped by common relaxation times.
conjunction with `mrt_orthogonal_modes_literature`. If this argument is not provided,
Gram-Schmidt orthogonalization of the default modes is performed.
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments.
used to compute the equilibrium moments.
Returns:
Returns:
...
@@ -408,9 +406,9 @@ def create_mrt_orthogonal(stencil, relaxation_rates, maxwellian_moments=False, w
...
@@ -408,9 +406,9 @@ def create_mrt_orthogonal(stencil, relaxation_rates, maxwellian_moments=False, w
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments
used to compute the equilibrium moments
weighted: whether to use weighted or unweighted orthogonality
weighted: whether to use weighted or unweighted orthogonality
nested_moments: a list of lists of modes, grouped by common relaxation times.
This is usually used in
nested_moments: a list of lists of modes, grouped by common relaxation times.
If this argument is not provided,
conjunction with `mrt_orthogonal_modes_literature`. If this argument is not provided,
Gram-Schmidt orthogonalization of the default modes is performed. The default modes equal the
G
ra
m-Schmid
t orth
ogonaliz
ation of the
default modes is performed
.
ra
w moments excep
t
f
or
th
e separ
ation of the
shear and bulk viscosity
.
"""
"""
if
weighted
:
if
weighted
:
weights
=
get_weights
(
stencil
,
sp
.
Rational
(
1
,
3
))
weights
=
get_weights
(
stencil
,
sp
.
Rational
(
1
,
3
))
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/advanced_streaming/test_advanced_streaming_noslip.py
+
23
−
23
View file @
3cc4797c
import
pytest
import
numpy
as
np
import
numpy
as
np
import
sympy
as
s
p
import
pystencils
as
p
s
from
lbmpy.creationfunctions
import
LBMConfig
from
lbmpy.advanced_streaming
import
Timestep
from
lbmpy.advanced_streaming
import
Timestep
from
lbmpy.boundaries
import
NoSlip
from
lbmpy.boundaries
import
NoSlip
from
lbmpy.boundaries.boundaryhandling
import
create_lattice_boltzmann_boundary_kernel
from
lbmpy.boundaries.boundaryhandling
import
create_lattice_boltzmann_boundary_kernel
from
lbmpy.advanced_streaming.utility
import
even_accessors
,
odd_accessors
,
streaming_patterns
,
inverse_dir_index
,
AccessPdfValues
from
lbmpy.advanced_streaming.utility
import
streaming_patterns
,
inverse_dir_index
,
AccessPdfValues
from
lbmpy.creationfunctions
import
create_lb_method
from
lbmpy.creationfunctions
import
create_lb_method
from
lbmpy.stencils
import
get_stencil
from
lbmpy.enums
import
Method
,
Stencil
from
lbmpy.stencils
import
LBStencil
import
pystencils
as
ps
from
pystencils.boundaries.createindexlist
import
numpy_data_type_for_boundary_object
from
pystencils.boundaries.createindexlist
import
numpy_data_type_for_boundary_object
from
pystencils.data_types
import
TypedSymbol
,
create_type
from
pystencils.data_types
import
TypedSymbol
,
create_type
from
pystencils.field
import
Field
,
FieldType
from
pystencils.field
import
Field
,
FieldType
from
itertools
import
product
import
pytest
@pytest.mark.parametrize
(
"
stencil
"
,
[
'
D2Q9
'
,
'
D3Q19
'
,
'
D3Q27
'
])
@pytest.mark.parametrize
(
"
stencil
"
,
[
Stencil
.
D2Q9
,
Stencil
.
D3Q19
,
Stencil
.
D3Q27
])
@pytest.mark.parametrize
(
"
streaming_pattern
"
,
streaming_patterns
)
@pytest.mark.parametrize
(
"
streaming_pattern
"
,
streaming_patterns
)
@pytest.mark.parametrize
(
"
prev_timestep
"
,
[
Timestep
.
EVEN
,
Timestep
.
ODD
])
@pytest.mark.parametrize
(
"
prev_timestep
"
,
[
Timestep
.
EVEN
,
Timestep
.
ODD
])
def
test_advanced_streaming_noslip_single_cell
(
stencil
,
streaming_pattern
,
prev_timestep
):
def
test_advanced_streaming_noslip_single_cell
(
stencil
,
streaming_pattern
,
prev_timestep
):
...
@@ -26,9 +25,9 @@ def test_advanced_streaming_noslip_single_cell(stencil, streaming_pattern, prev_
...
@@ -26,9 +25,9 @@ def test_advanced_streaming_noslip_single_cell(stencil, streaming_pattern, prev_
Advanced Streaming NoSlip Test
Advanced Streaming NoSlip Test
"""
"""
stencil
=
get_s
tencil
(
stencil
)
stencil
=
LBS
tencil
(
stencil
)
q
=
len
(
stencil
)
q
=
stencil
.
Q
dim
=
len
(
stencil
[
0
])
dim
=
stencil
.
D
pdf_field
=
ps
.
fields
(
f
'
pdfs(
{
q
}
): [
{
dim
}
D]
'
)
pdf_field
=
ps
.
fields
(
f
'
pdfs(
{
q
}
): [
{
dim
}
D]
'
)
prev_pdf_access
=
AccessPdfValues
(
stencil
,
streaming_pattern
,
prev_timestep
,
'
out
'
)
prev_pdf_access
=
AccessPdfValues
(
stencil
,
streaming_pattern
,
prev_timestep
,
'
out
'
)
...
@@ -39,24 +38,25 @@ def test_advanced_streaming_noslip_single_cell(stencil, streaming_pattern, prev_
...
@@ -39,24 +38,25 @@ def test_advanced_streaming_noslip_single_cell(stencil, streaming_pattern, prev_
for
d
in
range
(
q
):
for
d
in
range
(
q
):
prev_pdf_access
.
write_pdf
(
pdfs
,
pos
,
d
,
d
)
prev_pdf_access
.
write_pdf
(
pdfs
,
pos
,
d
,
d
)
lb_method
=
create_lb_method
(
stencil
=
stencil
,
method
=
'
srt
'
)
lbm_config
=
LBMConfig
(
stencil
=
stencil
,
method
=
Method
.
SRT
)
lb_method
=
create_lb_method
(
lbm_config
=
lbm_config
)
noslip
=
NoSlip
()
noslip
=
NoSlip
()
index_struct_dtype
=
numpy_data_type_for_boundary_object
(
noslip
,
dim
)
index_struct_dtype
=
numpy_data_type_for_boundary_object
(
noslip
,
dim
)
index_field
=
Field
(
'
indexVector
'
,
FieldType
.
INDEXED
,
index_struct_dtype
,
layout
=
[
0
],
index_field
=
Field
(
'
indexVector
'
,
FieldType
.
INDEXED
,
index_struct_dtype
,
layout
=
[
0
],
shape
=
(
TypedSymbol
(
"
indexVectorSize
"
,
create_type
(
np
.
int64
)),
1
),
strides
=
(
1
,
1
))
shape
=
(
TypedSymbol
(
"
indexVectorSize
"
,
create_type
(
np
.
int64
)),
1
),
strides
=
(
1
,
1
))
index_vector
=
np
.
array
([
pos
+
(
d
,)
for
d
in
range
(
q
)
],
dtype
=
index_struct_dtype
)
index_vector
=
np
.
array
([
pos
+
(
d
,)
for
d
in
range
(
q
)],
dtype
=
index_struct_dtype
)
ast
=
create_lattice_boltzmann_boundary_kernel
(
pdf_field
,
ast
=
create_lattice_boltzmann_boundary_kernel
(
pdf_field
,
index_field
,
lb_method
,
noslip
,
index_field
,
lb_method
,
noslip
,
prev_timestep
=
prev_timestep
,
prev_timestep
=
prev_timestep
,
streaming_pattern
=
streaming_pattern
)
streaming_pattern
=
streaming_pattern
)
flex_kernel
=
ast
.
compile
()
flex_kernel
=
ast
.
compile
()
flex_kernel
(
pdfs
=
pdfs
,
indexVector
=
index_vector
,
indexVectorSize
=
len
(
index_vector
))
flex_kernel
(
pdfs
=
pdfs
,
indexVector
=
index_vector
,
indexVectorSize
=
len
(
index_vector
))
reflected_pdfs
=
[
next_pdf_access
.
read_pdf
(
pdfs
,
pos
,
d
)
for
d
in
range
(
q
)]
reflected_pdfs
=
[
next_pdf_access
.
read_pdf
(
pdfs
,
pos
,
d
)
for
d
in
range
(
q
)]
inverse_pdfs
=
[
inverse_dir_index
(
stencil
,
d
)
for
d
in
range
(
q
)
]
inverse_pdfs
=
[
inverse_dir_index
(
stencil
,
d
)
for
d
in
range
(
q
)]
assert
reflected_pdfs
==
inverse_pdfs
assert
reflected_pdfs
==
inverse_pdfs
\ 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