aboutsummaryrefslogtreecommitdiff
path: root/symbolic/characteristics.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-07-02 20:35:44 +0200
committerAdrian Kummerlaender2019-07-02 20:35:44 +0200
commit55fb5b62ab3381327d4b04cf1c5ab095874d29cc (patch)
tree1c64f3a3ac3e6ab4961f59d6adba6ee2e8d4495c /symbolic/characteristics.py
parent7ee1ca337f25ab6ead86ead28c10df520cff1b63 (diff)
downloadsymlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar.gz
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar.bz2
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar.lz
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar.xz
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.tar.zst
symlbm_playground-55fb5b62ab3381327d4b04cf1c5ab095874d29cc.zip
Determine lattice speed of sound
Diffstat (limited to 'symbolic/characteristics.py')
-rw-r--r--symbolic/characteristics.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/symbolic/characteristics.py b/symbolic/characteristics.py
index ca3904e..b68afeb 100644
--- a/symbolic/characteristics.py
+++ b/symbolic/characteristics.py
@@ -19,3 +19,9 @@ def gauss_hermite(n):
def weights(d, c):
_, omegas = gauss_hermite(3)
return list(map(lambda c_i: Mul(*[ omegas[1+c_i[iDim]] for iDim in range(0,d) ]) / pi**(d/2), c))
+
+# determine lattice speed of sound using directions and their weights
+def c_s(d, c, w):
+ speeds = set([ sqrt(sum([ w[i] * c_i[j]**2 for i, c_i in enumerate(c) ])) for j in range(0,d) ])
+ assert len(speeds) == 1 # verify isotropy
+ return speeds.pop()