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
Mischa Dombrowski
lbmweights
Commits
21bc458a
Commit
21bc458a
authored
Sep 07, 2019
by
MischaD
Browse files
Shell from type
parent
b50d3e74
Changes
3
Hide whitespace changes
Inline
Side-by-side
cli.py
View file @
21bc458a
...
...
@@ -24,7 +24,13 @@ def lbmweights(dimension, order, shells, seed):
#lattice2 = Lattice.from_order(dimension=2, order=6)
#lattice3 = Lattice(dimension=3, order=4, shell_list=[1,2,4])
lattice
=
Lattice
(
2
,
4
,[
1
,
2
,
4
],
boundary
=
"sup"
)
lattice
.
calculate_weights
()
print
(
lattice
.
velocities
)
print
(
lattice
.
weights
)
cssq
,
w
,
u
=
lattice
.
velocity_set
()
print
(
w
)
print
(
u
)
lattice
=
Lattice
.
from_name
(
"D3Q41-ZOT"
)
lattice
.
calculate_weights
()
cs
,
weights
,
velocities
=
lattice
.
velocity_set
()
...
...
lbmweights/lattice.py
View file @
21bc458a
...
...
@@ -127,6 +127,8 @@ class Lattice:
@
property
def
velocities
(
self
):
"""Get a list of all types of velocities. Velocities with zero weight are included
For D2O9 this equals [00, 10, 11, 20]"""
if
not
self
.
_discrete_velocities
and
self
.
_shells
:
self
.
_discrete_velocities
=
[
shell
.
type
for
shell
in
self
.
_shells
]
return
self
.
_discrete_velocities
...
...
@@ -137,6 +139,11 @@ class Lattice:
return
self
.
_weights
return
self
.
calculate_weights
()
def
shell_from_type
(
self
,
type
):
for
shell
in
self
.
_shells
:
if
shell
.
type
==
type
:
return
shell
def
calculate_velocity_vectors
(
self
):
velocity_vectors
=
[]
...
...
@@ -360,6 +367,8 @@ class Lattice:
a list of the velocity values their corresponding weights and the value for the speed of sound.
:return: (c_s_sq, weights, velocities): c_s_sq
"""
if
not
self
.
weights
:
self
.
calculate_weights
()
weights
=
[]
for
shell
in
self
.
shells
:
...
...
lbmweights/shell.py
View file @
21bc458a
...
...
@@ -19,8 +19,6 @@ class Shell:
@
property
def
weight
(
self
):
if
self
.
_weight
is
None
:
logger
.
warning
(
"Weight of shell uninitialized. Calculate it first"
)
return
self
.
_weight
def
set_weight
(
self
,
c_s_sq
,
weight
):
...
...
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