Commit 21bc458a authored by MischaD's avatar MischaD
Browse files

Shell from type

parent b50d3e74
......@@ -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")
cssq, w, u = lattice.velocity_set()
lattice = Lattice.from_name("D3Q41-ZOT")
cs, weights, velocities = lattice.velocity_set()
......@@ -127,6 +127,8 @@ class Lattice:
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:
weights = []
for shell in self.shells:
......@@ -19,8 +19,6 @@ class Shell:
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):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment