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
Houman Mirzaalian Dastjerdi
waLBerla
Commits
6fb3881b
Commit
6fb3881b
authored
May 24, 2018
by
Martin Bauer
Browse files
Adapted codegen example file to changes in lbmpy
parent
4b74b16f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/lbm/codegen/SrtWithForceFieldModel.gen.py
View file @
6fb3881b
import
sympy
as
sp
from
lbmpy.boundaries
import
NoSlip
,
UBB
from
lbmpy_walberla
import
Field
,
generate
L
attice
M
odel
F
iles
,
RefinementScaling
from
lbmpy.creationfunctions
import
create
LatticeBoltzmannM
ethod
from
lbmpy_walberla.boundary
import
create
B
oundary
C
lass
from
lbmpy_walberla
import
Field
,
generate
_l
attice
_m
odel
_f
iles
,
RefinementScaling
from
lbmpy.creationfunctions
import
create
_lb_m
ethod
from
lbmpy_walberla.boundary
import
create
_b
oundary
_c
lass
from
pystencils_walberla.cmake_integration
import
codegen
import
pystencils
as
ps
# ------------- Lattice Model ------------------------------
forceField
=
Field
.
createGeneric
(
'force'
,
spatialDimensions
=
3
,
indexDimensions
=
1
,
layout
=
'fzyx'
)
force
=
[
forceField
(
0
),
forceField
(
1
),
forceField
(
2
)]
force_field
=
ps
.
fields
(
"force(3): [3D]"
,
layout
=
'fzyx'
)
omega
=
sp
.
Symbol
(
"omega"
)
scaling
=
RefinementScaling
()
scaling
.
add
S
tandard
R
elaxation
R
ate
S
caling
(
omega
)
scaling
.
add
F
orce
S
caling
(
force
F
ield
)
scaling
.
add
_s
tandard
_r
elaxation
_r
ate
_s
caling
(
omega
)
scaling
.
add
_f
orce
_s
caling
(
force
_f
ield
)
generate
L
attice
M
odel
F
iles
(
class
N
ame
=
'SrtWithForceFieldModel'
,
method
=
'srt'
,
stencil
=
'D3Q19'
,
force
M
odel
=
'guo'
,
force
=
force
,
relaxation
R
ates
=
[
omega
],
refinement
S
caling
=
scaling
)
generate
_l
attice
_m
odel
_f
iles
(
class
_n
ame
=
'SrtWithForceFieldModel'
,
method
=
'srt'
,
stencil
=
'D3Q19'
,
force
_m
odel
=
'guo'
,
force
=
force
_field
.
center_vector
,
relaxation
_r
ates
=
[
omega
],
refinement
_s
caling
=
scaling
)
def
genBoundary
():
boundary
=
UBB
([
0.05
,
0
,
0
],
dim
=
3
,
name
=
"MyUBB"
)
method
=
create
LatticeBoltzmannM
ethod
(
stencil
=
'D3Q19'
,
method
=
'srt'
)
return
create
B
oundary
C
lass
(
boundary
,
method
)
method
=
create
_lb_m
ethod
(
stencil
=
'D3Q19'
,
method
=
'srt'
)
return
create
_b
oundary
_c
lass
(
boundary
,
method
)
def
genNoSlip
():
boundary
=
NoSlip
(
name
=
'MyNoSlip'
)
method
=
create
LatticeBoltzmannM
ethod
(
stencil
=
'D3Q19'
,
method
=
'srt'
)
return
create
B
oundary
C
lass
(
boundary
,
method
)
method
=
create
_lb_m
ethod
(
stencil
=
'D3Q19'
,
method
=
'srt'
)
return
create
_b
oundary
_c
lass
(
boundary
,
method
)
codegen
.
register
([
'MyUBB.h'
,
'MyUBB.cpp'
],
genBoundary
)
codegen
.
register
([
'MyNoSlip.h'
,
'MyNoSlip.cpp'
,],
genNoSlip
)
...
...
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