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
95ebb815
Commit
95ebb815
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Started with wall law boundary
parent
c49363ff
No related branches found
No related tags found
1 merge request
!106
Draft: Wall law
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/boundaries/__init__.py
+3
-1
3 additions, 1 deletion
lbmpy/boundaries/__init__.py
lbmpy/boundaries/wall_models.py
+47
-0
47 additions, 0 deletions
lbmpy/boundaries/wall_models.py
with
50 additions
and
1 deletion
lbmpy/boundaries/__init__.py
+
3
−
1
View file @
95ebb815
...
...
@@ -2,7 +2,9 @@ from lbmpy.boundaries.boundaryconditions import (
UBB
,
FixedDensity
,
DiffusionDirichlet
,
SimpleExtrapolationOutflow
,
ExtrapolationOutflow
,
NeumannByCopy
,
NoSlip
,
StreamInConstant
,
FreeSlip
)
from
lbmpy.boundaries.boundaryhandling
import
LatticeBoltzmannBoundaryHandling
from
lbmpy.boundaries.wall_models
import
WallFunctionBounce
__all__
=
[
'
NoSlip
'
,
'
FreeSlip
'
,
'
UBB
'
,
'
SimpleExtrapolationOutflow
'
,
'
ExtrapolationOutflow
'
,
'
FixedDensity
'
,
'
DiffusionDirichlet
'
,
'
NeumannByCopy
'
,
'
LatticeBoltzmannBoundaryHandling
'
,
'
StreamInConstant
'
]
'
LatticeBoltzmannBoundaryHandling
'
,
'
StreamInConstant
'
,
'
WallFunctionBounce
'
]
This diff is collapsed.
Click to expand it.
lbmpy/boundaries/wall_models.py
0 → 100644
+
47
−
0
View file @
95ebb815
import
sympy
as
sp
from
pystencils
import
Assignment
from
pystencils.stencil
import
offset_to_direction_string
from
lbmpy.advanced_streaming.indexing
import
MirroredStencilDirections
from
lbmpy.boundaries.boundaryconditions
import
LbBoundary
class
WallFunctionBounce
(
LbBoundary
):
"""
Wall function based on the bounce back idea.
Args:
stencil: LBM stencil which is used for the simulation
normal_direction: optional normal direction. If the Free slip boundary is applied to a certain side in the
domain it is not necessary to calculate the normal direction since it can be stated for all
boundary cells. This reduces the memory space for the index array significantly.
name: optional name of the boundary.
"""
def
__init__
(
self
,
stencil
,
normal_direction
,
name
=
None
):
"""
Set an optional name here, to mark boundaries, for example for force evaluations
"""
self
.
stencil
=
stencil
if
len
(
normal_direction
)
-
normal_direction
.
count
(
0
)
!=
1
:
raise
ValueError
(
"
Only normal directions for straight walls are supported for example (0, 1, 0) for
"
"
a WallFunctionBounce applied to the southern boundary of the domain
"
)
self
.
mirror_axis
=
normal_direction
.
index
(
*
[
dir
for
dir
in
normal_direction
if
dir
!=
0
])
self
.
normal_direction
=
normal_direction
self
.
dim
=
len
(
stencil
[
0
])
if
name
is
None
:
name
=
f
"
WFB :
{
offset_to_direction_string
([
-
x
for
x
in
normal_direction
])
}
"
super
(
WallFunctionBounce
,
self
).
__init__
(
name
)
def
get_additional_code_nodes
(
self
,
lb_method
):
return
[
MirroredStencilDirections
(
self
.
stencil
,
self
.
mirror_axis
)]
def
__call__
(
self
,
f_out
,
f_in
,
dir_symbol
,
inv_dir
,
lb_method
,
index_field
):
normal_direction
=
self
.
normal_direction
mirrored_stencil_symbol
=
MirroredStencilDirections
.
_mirrored_symbol
(
self
.
mirror_axis
)
mirrored_direction
=
inv_dir
[
sp
.
IndexedBase
(
mirrored_stencil_symbol
,
shape
=
(
1
,))[
dir_symbol
]]
return
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
f_in
[
normal_direction
](
mirrored_direction
))
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