Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itischler
lbmpy
Commits
098e09aa
Commit
098e09aa
authored
Jun 26, 2020
by
Michael Kuron
Browse files
Change tests from Guo to Luo if they don’t use SRT
parent
d63fcb72
Changes
8
Hide whitespace changes
Inline
Side-by-side
doc/notebooks/05_tutorial_modifying_method_smagorinsky.ipynb
View file @
098e09aa
...
...
@@ -242,11 +242,11 @@
%% Cell type:code id: tags:
```
python
method
=
create_lb_method
(
method
=
'mrt'
,
weighted
=
True
,
stencil
=
'D2Q9'
,
force
=
(
1e-6
,
0
),
relaxation_rates
=
[
0
,
0
,
ω
,
1.9
,
1.9
])
force_model
=
'luo'
,
relaxation_rates
=
[
0
,
0
,
ω
,
1.9
,
1.9
])
method
```
%%%% Output: execute_result
...
...
doc/sphinx/lbmpy.bib
View file @
098e09aa
...
...
@@ -41,6 +41,13 @@
publisher
=
{APS}
}
@phdthesis
{
schiller2008thermal
,
title
=
{Thermal fluctuations and boundary conditions in the lattice Boltzmann method}
,
author
=
{Schiller, Ulf Daniel}
,
year
=
{2008}
,
school
=
{Johannes Gutenberg Universit{\"a}t Mainz}
}
@article
{
Wohrwag2018
,
archivePrefix
=
{arXiv}
,
...
...
lbmpy/forcemodels.py
View file @
098e09aa
...
...
@@ -201,6 +201,7 @@ class Buick:
simple
=
Simple
(
self
.
_force
)
shear_relaxation_rate
=
get_shear_relaxation_rate
(
lb_method
)
assert
len
(
set
(
lb_method
.
relaxation_rates
))
==
1
,
"Buick only works for SRT"
correction_factor
=
(
1
-
sp
.
Rational
(
1
,
2
)
*
shear_relaxation_rate
)
return
[
correction_factor
*
t
for
t
in
simple
(
lb_method
)]
...
...
lbmpy_tests/test_entropic.py
View file @
098e09aa
...
...
@@ -10,13 +10,13 @@ from lbmpy.stencils import get_stencil
def
test_entropic_methods
():
sc_kbc
=
create_lid_driven_cavity
((
20
,
20
),
method
=
'trt-kbc-n4'
,
relaxation_rate
=
1.9999
,
entropic_newton_iterations
=
3
,
entropic
=
True
,
compressible
=
True
,
force
=
(
-
1e-10
,
0
))
force
=
(
-
1e-10
,
0
)
,
force_model
=
"luo"
)
sc_srt
=
create_lid_driven_cavity
((
40
,
40
),
relaxation_rate
=
1.9999
,
lid_velocity
=
0.05
,
compressible
=
True
,
force
=
(
-
1e-10
,
0
))
force
=
(
-
1e-10
,
0
)
,
force_model
=
"luo"
)
sc_entropic
=
create_lid_driven_cavity
((
40
,
40
),
method
=
'entropic-srt'
,
relaxation_rate
=
1.9999
,
lid_velocity
=
0.05
,
compressible
=
True
,
force
=
(
-
1e-10
,
0
))
lid_velocity
=
0.05
,
compressible
=
True
,
force
=
(
-
1e-10
,
0
)
,
force_model
=
"luo"
)
sc_srt
.
run
(
1000
)
sc_kbc
.
run
(
1000
)
...
...
lbmpy_tests/test_fluctuation.py
View file @
098e09aa
...
...
@@ -5,7 +5,7 @@ from lbmpy.scenarios import create_channel
def
test_fluctuating_generation_pipeline
():
ch
=
create_channel
((
10
,
10
),
stencil
=
'D2Q9'
,
method
=
'mrt'
,
weighted
=
True
,
relaxation_rates
=
[
1.5
]
*
5
,
force
=
1e-5
,
fluctuating
=
{
'temperature'
:
1e-9
},
kernel_params
=
{
'time_step'
:
1
,
'seed'
:
312
},
force_model
=
'luo'
,
fluctuating
=
{
'temperature'
:
1e-9
},
kernel_params
=
{
'time_step'
:
1
,
'seed'
:
312
},
optimization
=
{
'cse_global'
:
True
})
ch
.
run
(
10
)
...
...
lbmpy_tests/test_force.py
View file @
098e09aa
from
pystencils.session
import
*
from
lbmpy.session
import
*
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
import
pytest
import
lbmpy.forcemodels
import
pytest
from
contextlib
import
ExitStack
as
does_not_raise
force_models
=
[
fm
.
lower
()
for
fm
in
dir
(
lbmpy
.
forcemodels
)
if
fm
[
0
].
isupper
()]
...
...
@@ -25,14 +27,22 @@ def test_total_momentum(method, force_model, omega):
ρ
=
dh
.
add_array
(
'rho'
)
u
=
dh
.
add_array
(
'u'
,
values_per_cell
=
dh
.
dim
)
collision
=
create_lb_update_rule
(
method
=
method
,
stencil
=
stencil
,
relaxation_rate
=
omega
,
compressible
=
True
,
force_model
=
force_model
,
force
=
F
,
kernel_type
=
'collide_only'
,
optimization
=
{
'symbolic_field'
:
src
})
expectation
=
does_not_raise
()
skip
=
False
if
force_model
in
[
'guo'
,
'buick'
]
and
method
!=
'srt'
:
expectation
=
pytest
.
raises
(
AssertionError
)
skip
=
True
with
expectation
:
collision
=
create_lb_update_rule
(
method
=
method
,
stencil
=
stencil
,
relaxation_rate
=
omega
,
compressible
=
True
,
force_model
=
force_model
,
force
=
F
,
kernel_type
=
'collide_only'
,
optimization
=
{
'symbolic_field'
:
src
})
if
skip
:
return
stream
=
create_stream_pull_with_output_kernel
(
collision
.
method
,
src
,
dst
,
{
'density'
:
ρ
,
'velocity'
:
u
})
...
...
lbmpy_tests/test_split_optimization.py
View file @
098e09aa
...
...
@@ -16,6 +16,7 @@ def test_split_number_of_operations():
common_params
=
{
'stencil'
:
stencil
,
'method'
:
method
,
'compressible'
:
compressible
,
'force_model'
:
'luo'
,
'force'
:
(
1e-6
,
1e-5
,
1e-7
)
}
ast_with_splitting
=
create_lb_ast
(
optimization
=
{
'split'
:
True
},
**
common_params
)
...
...
lbmpy_tests/test_srt_trt_simplifications.py
View file @
098e09aa
...
...
@@ -4,7 +4,7 @@ known acceptable values.
"""
import
sympy
as
sp
from
lbmpy.forcemodels
import
G
uo
from
lbmpy.forcemodels
import
L
uo
from
lbmpy.methods
import
create_srt
,
create_trt
,
create_trt_with_magic_number
from
lbmpy.methods.momentbasedsimplifications
import
cse_in_opposing_directions
from
lbmpy.simplificationfactory
import
create_simplification_strategy
...
...
@@ -55,13 +55,13 @@ def test_simplifications_trt_d2q9_compressible():
def
test_simplifications_trt_d3q19_force_incompressible
():
o1
,
o2
=
sp
.
symbols
(
"omega_1 omega_2"
)
force_model
=
G
uo
([
sp
.
Rational
(
1
,
3
),
sp
.
Rational
(
1
,
2
),
sp
.
Rational
(
1
,
5
)])
force_model
=
L
uo
([
sp
.
Rational
(
1
,
3
),
sp
.
Rational
(
1
,
2
),
sp
.
Rational
(
1
,
5
)])
method
=
create_trt
(
get_stencil
(
"D3Q19"
),
o1
,
o2
,
compressible
=
False
,
force_model
=
force_model
)
check_method
(
method
,
[
268
,
281
,
0
],
[
241
,
175
,
1
])
def
test_simplifications_trt_d3q19_force_compressible
():
o1
,
o2
=
sp
.
symbols
(
"omega_1 omega_2"
)
force_model
=
G
uo
([
sp
.
Rational
(
1
,
3
),
sp
.
Rational
(
1
,
2
),
sp
.
Rational
(
1
,
5
)])
force_model
=
L
uo
([
sp
.
Rational
(
1
,
3
),
sp
.
Rational
(
1
,
2
),
sp
.
Rational
(
1
,
5
)])
method
=
create_trt_with_magic_number
(
get_stencil
(
"D3Q19"
),
o1
,
compressible
=
False
,
force_model
=
force_model
)
check_method
(
method
,
[
270
,
283
,
1
],
[
243
,
177
,
1
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment