Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
lbmpy_walberla
Commits
b4f97ca3
Commit
b4f97ca3
authored
Jul 29, 2019
by
Martin Bauer
Browse files
Adapted tests to new API
parent
569cc1d8
Pipeline
#16804
passed with stage
in 1 minute and 1 second
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
lbmpy_walberla_tests/test_walberla_codegen.py
View file @
b4f97ca3
...
...
@@ -4,7 +4,7 @@ import sympy as sp
import
pystencils
as
ps
from
lbmpy.boundaries
import
UBB
,
NoSlip
from
lbmpy.creationfunctions
import
create_lb_method
,
create_lb_update_rule
from
lbmpy.creationfunctions
import
create_lb_method
,
create_lb_update_rule
,
create_lb_collision_rule
from
lbmpy_walberla
import
RefinementScaling
,
generate_boundary
,
generate_lattice_model
from
lbmpy_walberla.sparse
import
ListLbGenerator
from
pystencils_walberla
import
generate_pack_info_for_field
,
generate_pack_info_from_kernel
...
...
@@ -19,17 +19,16 @@ class WalberlaLbmpyCodegenTest(unittest.TestCase):
force_field
=
ps
.
fields
(
"force(3): [3D]"
,
layout
=
'fzyx'
)
omega
=
sp
.
Symbol
(
"omega"
)
lb_method
=
create_lb_
method
(
stencil
=
'D3Q19'
,
method
=
'srt'
,
relaxation_rates
=
[
omega
],
compressible
=
True
,
force_model
=
'guo'
,
force
=
force_field
.
center_vector
)
cr
=
create_lb_
collision_rule
(
stencil
=
'D3Q19'
,
method
=
'srt'
,
relaxation_rates
=
[
omega
],
compressible
=
True
,
force_model
=
'guo'
,
force
=
force_field
.
center_vector
)
scaling
=
RefinementScaling
()
scaling
.
add_standard_relaxation_rate_scaling
(
omega
)
scaling
.
add_force_scaling
(
force_field
)
generate_lattice_model
(
ctx
,
'SrtWithForceFieldModel'
,
lb_method
,
refinement_scaling
=
scaling
,
update_rule_params
=
{
'compressible'
:
True
})
generate_boundary
(
ctx
,
'MyUBB'
,
UBB
([
0.05
,
0
,
0
]),
lb_method
)
generate_boundary
(
ctx
,
'MyNoSlip'
,
NoSlip
(),
lb_method
)
generate_lattice_model
(
ctx
,
'SrtWithForceFieldModel'
,
cr
,
refinement_scaling
=
scaling
)
generate_boundary
(
ctx
,
'MyUBB'
,
UBB
([
0.05
,
0
,
0
]),
cr
.
method
)
generate_boundary
(
ctx
,
'MyNoSlip'
,
NoSlip
(),
cr
.
method
)
assert
'static const bool compressible = true;'
in
ctx
.
files
[
'SrtWithForceFieldModel.h'
]
@
staticmethod
...
...
@@ -58,8 +57,8 @@ class WalberlaLbmpyCodegenTest(unittest.TestCase):
with
ManualCodeGenerationContext
()
as
ctx
:
omega
=
sp
.
Symbol
(
"omega"
)
lb_method
=
create_lb_
method
(
stencil
=
'D3Q19'
,
method
=
'srt'
,
relaxation_rates
=
[
omega
],
compressible
=
False
)
generate_lattice_model
(
ctx
,
'Model'
,
lb_method
,
update_rule_params
=
{
'compressible'
:
False
}
)
cr
=
create_lb_
collision_rule
(
stencil
=
'D3Q19'
,
method
=
'srt'
,
relaxation_rates
=
[
omega
],
compressible
=
False
)
generate_lattice_model
(
ctx
,
'Model'
,
cr
)
assert
'static const bool compressible = false;'
in
ctx
.
files
[
'Model.h'
]
@
staticmethod
...
...
@@ -73,8 +72,8 @@ class WalberlaLbmpyCodegenTest(unittest.TestCase):
'entropic'
:
True
,
'omega_output_field'
:
omega_field
,
}
lb_method
=
create_lb_
method
(
**
parameters
)
generate_lattice_model
(
ctx
,
'Model'
,
lb_method
,
update_rule_params
=
parameters
)
cr
=
create_lb_
collision_rule
(
**
parameters
)
generate_lattice_model
(
ctx
,
'Model'
,
cr
)
@
staticmethod
def
test_boundary
():
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment