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
Markus Holzer
lbmpy
Commits
932cb492
Commit
932cb492
authored
Jun 10, 2021
by
Markus Holzer
Browse files
clean up
parent
c30e6e5a
Pipeline
#32592
passed with stage
in 11 minutes and 5 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lbmpy/boundaries/boundaryconditions.py
View file @
932cb492
...
...
@@ -79,6 +79,14 @@ class LbBoundary:
def
name
(
self
,
new_value
):
self
.
_name
=
new_value
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
type
(
self
)):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class Boundary
...
...
@@ -99,15 +107,6 @@ class NoSlip(LbBoundary):
def
__call__
(
self
,
f_out
,
f_in
,
dir_symbol
,
inv_dir
,
lb_method
,
index_field
):
return
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
f_out
(
dir_symbol
))
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
NoSlip
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class NoSlip
...
...
@@ -213,15 +212,6 @@ class UBB(LbBoundary):
return
[
Assignment
(
f_in
(
inv_dir
[
direction
]),
f_out
(
direction
)
-
vel_term
)]
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
UBB
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class UBB
...
...
@@ -269,15 +259,6 @@ class SimpleExtrapolationOutflow(LbBoundary):
return
Assignment
(
f_in
.
center
(
inv_dir
[
dir_symbol
]),
f_out
[
tangential_offset
](
inv_dir
[
dir_symbol
]))
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
SimpleExtrapolationOutflow
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class SimpleExtrapolationOutflow
...
...
@@ -425,15 +406,6 @@ class ExtrapolationOutflow(LbBoundary):
return
AssignmentCollection
(
boundary_assignments
,
subexpressions
=
subexpressions
)
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
ExtrapolationOutflow
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class ExtrapolationOutflow
...
...
@@ -487,15 +459,6 @@ class FixedDensity(LbBoundary):
return
subexpressions
+
[
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
2
*
eq_component
-
f_out
(
dir_symbol
))]
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
FixedDensity
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class FixedDensity
...
...
@@ -530,15 +493,6 @@ class DiffusionDirichlet(LbBoundary):
return
[
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
2
*
w_dir
*
self
.
concentration
-
f_out
(
dir_symbol
))]
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
DiffusionDirichlet
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class DiffusionDirichlet
...
...
@@ -562,15 +516,6 @@ class NeumannByCopy(LbBoundary):
return
[
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
f_out
(
inv_dir
[
dir_symbol
])),
Assignment
(
f_out
[
neighbour_offset
](
dir_symbol
),
f_out
(
dir_symbol
))]
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
NeumannByCopy
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class NeumannByCopy
...
...
@@ -603,12 +548,4 @@ class StreamInConstant(LbBoundary):
return
[
Assignment
(
f_in
(
inv_dir
[
dir_symbol
]),
self
.
constant
),
Assignment
(
f_out
[
neighbour_offset
](
dir_symbol
),
self
.
constant
)]
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
StreamInConstant
):
return
False
return
self
.
__dict__
==
other
.
__dict__
# end class StreamInConstant
lbmpy_tests/test_boundary_handling.py
View file @
932cb492
...
...
@@ -120,33 +120,45 @@ def test_boundary_utility_functions():
noslip
=
NoSlip
(
"noslip"
)
assert
noslip
==
NoSlip
(
"noslip"
)
assert
not
noslip
==
NoSlip
(
"test"
)
assert
not
noslip
==
UBB
((
0
,
0
),
name
=
"ubb"
)
assert
noslip
.
name
==
"noslip"
noslip
.
name
=
"test name setter"
assert
noslip
.
name
==
"test name setter"
ubb
=
UBB
((
0
,
0
),
name
=
"ubb"
)
assert
ubb
==
UBB
((
0
,
0
),
name
=
"ubb"
)
assert
not
noslip
==
UBB
((
0
,
0
),
name
=
"test"
)
assert
not
ubb
==
NoSlip
(
"noslip"
)
simple_extrapolation
=
SimpleExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
stencil
=
stencil
,
name
=
"simple"
)
assert
simple_extrapolation
==
SimpleExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
stencil
=
stencil
,
name
=
"simple"
)
assert
not
simple_extrapolation
==
SimpleExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
stencil
=
stencil
,
name
=
"test"
)
assert
not
simple_extrapolation
==
NoSlip
(
"noslip"
)
outflow
=
ExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
lb_method
=
method
,
name
=
"outflow"
)
assert
outflow
==
ExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
lb_method
=
method
,
name
=
"outflow"
)
assert
not
outflow
==
ExtrapolationOutflow
(
normal_direction
=
stencil
[
4
],
lb_method
=
method
,
name
=
"test"
)
assert
not
outflow
==
simple_extrapolation
density
=
FixedDensity
(
density
=
1.0
,
name
=
"fixedDensity"
)
assert
density
==
FixedDensity
(
density
=
1.0
,
name
=
"fixedDensity"
)
assert
not
density
==
FixedDensity
(
density
=
1.0
,
name
=
"test"
)
assert
not
density
==
UBB
((
0
,
0
),
name
=
"ubb"
)
diffusion
=
DiffusionDirichlet
(
concentration
=
1.0
,
name
=
"diffusion"
)
assert
diffusion
==
DiffusionDirichlet
(
concentration
=
1.0
,
name
=
"diffusion"
)
assert
not
diffusion
==
DiffusionDirichlet
(
concentration
=
1.0
,
name
=
"test"
)
assert
not
diffusion
==
density
neumann
=
NeumannByCopy
(
name
=
"Neumann"
)
assert
neumann
==
NeumannByCopy
(
name
=
"Neumann"
)
assert
not
neumann
==
NeumannByCopy
(
name
=
"test"
)
assert
not
neumann
==
diffusion
stream
=
StreamInConstant
(
constant
=
1.0
,
name
=
"stream"
)
assert
stream
==
StreamInConstant
(
constant
=
1.0
,
name
=
"stream"
)
assert
not
stream
==
StreamInConstant
(
constant
=
1.0
,
name
=
"test"
)
assert
not
stream
==
noslip
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