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
d3049429
Commit
d3049429
authored
7 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Bugfixes in lbmpy boundary handling
parent
09e5e075
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
boundaries/boundaryhandling.py
+3
-2
3 additions, 2 deletions
boundaries/boundaryhandling.py
boundaries/periodicityhandling.py
+6
-3
6 additions, 3 deletions
boundaries/periodicityhandling.py
scenarios.py
+6
-6
6 additions, 6 deletions
scenarios.py
with
15 additions
and
11 deletions
boundaries/boundaryhandling.py
+
3
−
2
View file @
d3049429
...
...
@@ -3,14 +3,14 @@ from lbmpy.boundaries.handlinginterface import GenericBoundaryHandling, FlagFiel
from
lbmpy.boundaries.periodicityhandling
import
PeriodicityHandling
class
BoundaryHandling
(
GenericBoundaryHandling
,
PeriodicityHandling
):
class
BoundaryHandling
(
PeriodicityHandling
,
GenericBoundaryHandling
):
# important: first periodicity, then boundary
def
__init__
(
self
,
pdfField
,
domainShape
,
lbMethod
,
ghostLayers
=
1
,
target
=
'
cpu
'
,
openMP
=
True
,
flagDtype
=
np
.
uint32
):
shapeWithGl
=
[
a
+
2
*
ghostLayers
for
a
in
domainShape
]
flagFieldInterface
=
NumpyFlagFieldInterface
(
shapeWithGl
,
flagDtype
)
GenericBoundaryHandling
.
__init__
(
self
,
flagFieldInterface
,
pdfField
,
lbMethod
,
ghostLayers
,
target
,
openMP
)
PeriodicityHandling
.
__init__
(
self
,
domainShape
)
PeriodicityHandling
.
__init__
(
self
,
list
(
domainShape
)
+
[
len
(
lbMethod
.
stencil
)])
def
setBoundary
(
self
,
boundaryObject
,
indexExpr
=
None
,
maskCallback
=
None
,
sliceNormalizationGhostLayers
=
1
):
mask
=
None
...
...
@@ -65,3 +65,4 @@ class NumpyFlagFieldInterface(FlagFieldInterface):
self
.
_boundaryObjectToName
=
{}
self
.
_boundaryObjectToFlag
=
{
'
fluid
'
:
np
.
dtype
(
self
.
_array
.
dtype
)(
2
**
0
)}
self
.
_nextFreeExponent
=
1
This diff is collapsed.
Click to expand it.
boundaries/periodicityhandling.py
+
6
−
3
View file @
d3049429
...
...
@@ -6,7 +6,7 @@ class PeriodicityHandling(object):
self
.
_spatialShape
=
fieldShape
[:
-
1
]
self
.
_indexShape
=
fieldShape
[
-
1
]
self
.
_periodicity
=
list
(
periodicity
)
self
.
_
d
irty
=
False
self
.
_
periodicityD
irty
=
False
self
.
_periodicityKernels
=
[]
@property
...
...
@@ -20,13 +20,16 @@ class PeriodicityHandling(object):
assert
isinstance
(
d
,
bool
)
self
.
_periodicity
=
[
x
,
y
,
z
]
self
.
_
d
irty
=
True
self
.
_
periodicityD
irty
=
True
def
__call__
(
self
,
**
kwargs
):
for
k
in
self
.
_periodicityKernels
:
k
(
**
kwargs
)
def
prepare
(
self
):
if
not
self
.
_periodicityDirty
:
return
self
.
_periodicityKernels
=
[]
dim
=
len
(
self
.
flagField
.
shape
)
if
dim
==
2
:
...
...
@@ -60,5 +63,5 @@ class PeriodicityHandling(object):
else
:
assert
False
self
.
_
d
irty
=
False
self
.
_
periodicityD
irty
=
False
This diff is collapsed.
Click to expand it.
scenarios.py
+
6
−
6
View file @
d3049429
...
...
@@ -141,12 +141,12 @@ def createForceDrivenChannel(force=1e-6, domainSize=None, dim=2, radius=None, le
boundaryHandling
.
setBoundary
(
wallBoundary
,
sliceFromDirection
(
direction
,
dim
))
elif
dim
==
3
:
if
roundChannel
:
wallIdx
=
boundaryHandling
.
addBoundary
(
wallBoundary
)
ff
=
boundaryHandling
.
flagField
y
Mid
=
ff
.
shape
[
1
]
//
2
zMid
=
ff
.
shape
[
2
]
//
2
y
,
z
=
np
.
meshgrid
(
range
(
ff
.
shape
[
1
]),
range
(
ff
.
shape
[
2
]))
ff
[(
y
-
yMid
)
**
2
+
(
z
-
zMid
)
**
2
>
radius
**
2
]
=
wallIdx
def
circleMaskCb
(
x
,
y
,
z
):
yMid
=
np
.
max
(
y
)
//
2
z
Mid
=
np
.
max
(
z
)
//
2
return
(
y
-
yMid
)
**
2
+
(
z
-
zMid
)
**
2
>
radius
**
2
boundaryHandling
.
setBoundary
(
wallBoundary
,
maskCallback
=
circleMaskCb
)
else
:
for
direction
in
(
'
N
'
,
'
S
'
,
'
T
'
,
'
B
'
):
boundaryHandling
.
setBoundary
(
wallBoundary
,
sliceFromDirection
(
direction
,
dim
))
...
...
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