Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mischa Dombrowski
lbmweights
Commits
24bfe5e9
Commit
24bfe5e9
authored
Sep 07, 2019
by
MischaD
Browse files
TestCases for Supremum + Unwanted Subshell + InitSchemes
parent
21bc458a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_lattice.py
View file @
24bfe5e9
...
...
@@ -71,6 +71,43 @@ class TestReducibleShell(unittest.TestCase):
self
.
assertAlmostEqual
(
sp
.
N
(
interval
.
sup
),
0.9054850
,
places
=
6
)
class
TestSupremum
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
seed
=
20
self
.
lattice
=
Lattice
(
dimension
=
2
,
order
=
4
,
shell_list
=
[
1
,
2
,
4
],
seed
=
self
.
seed
,
boundary
=
"sup"
)
def
testOutput
(
self
):
weights
=
self
.
lattice
.
calculate_weights
()
self
.
assertEqual
(
len
(
weights
),
4
)
self
.
assertEqual
(
self
.
lattice
.
velocities
,
[
"00"
,
"10"
,
"11"
,
"20"
])
self
.
assertEqual
(
self
.
lattice
.
shell_from_type
(
"10"
).
weight
,
0
)
class
TestUnwantedSubshells
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
seed
=
20
self
.
lattice
=
Lattice
(
dimension
=
3
,
order
=
6
,
shell_list
=
[
1
,
2
,
3
,
9
,
16
,
27
],
boundary
=
"sup"
,
unwanted_subshells
=
[
"221"
,
"511"
])
def
testOutput
(
self
):
weights
=
self
.
lattice
.
calculate_weights
()
self
.
assertEqual
(
len
(
weights
),
7
)
interval
=
self
.
lattice
.
_interval
self
.
assertAlmostEqual
(
sp
.
N
(
interval
.
inf
),
0.3500280
,
places
=
6
)
self
.
assertAlmostEqual
(
sp
.
N
(
interval
.
sup
),
0.3675445
,
places
=
6
)
class
TestInitSchemes
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
seed
=
20
self
.
lattice
=
Lattice
(
dimension
=
2
,
order
=
4
,
shell_list
=
[
1
,
2
,
4
],
seed
=
self
.
seed
)
self
.
lattice_from_order
=
Lattice
.
from_order
(
dimension
=
2
,
order
=
4
)
self
.
lattice_from_name
=
Lattice
.
from_name
(
"D2Q9"
)
def
test_lattice_equivalent
(
self
):
self
.
assertTrue
(
self
.
lattice
.
weights
==
self
.
lattice_from_name
.
weights
)
self
.
assertTrue
(
self
.
lattice
.
weights
==
self
.
lattice_from_order
.
weights
)
if
__name__
==
'__main__'
:
logger
.
disabled
=
True
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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