aboutsummaryrefslogtreecommitdiff
path: root/lbm_d2q9.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-12 21:01:42 +0200
committerAdrian Kummerlaender2019-06-12 21:01:42 +0200
commit9cf82f641b8982df526107b99d883545ee02fe20 (patch)
treedb2374c187047713d19be62c4b1862b9af5065f9 /lbm_d2q9.py
parent835824b80e82f471dc7ea6d22dedf485ad44c654 (diff)
downloadsymlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar.gz
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar.bz2
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar.lz
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar.xz
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.tar.zst
symlbm_playground-9cf82f641b8982df526107b99d883545ee02fe20.zip
Restructuring
Diffstat (limited to 'lbm_d2q9.py')
-rw-r--r--lbm_d2q9.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/lbm_d2q9.py b/lbm_d2q9.py
deleted file mode 100644
index a3c2503..0000000
--- a/lbm_d2q9.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from sympy import *
-from sympy.codegen.ast import Assignment
-
-q = 9
-d = 2
-
-c = [ Matrix(x) for x in [(-1, 1), ( 0, 1), ( 1, 1), (-1, 0), ( 0, 0), ( 1, 0), (-1,-1), ( 0, -1), ( 1, -1)] ]
-w = [ Rational(*x) for x in [(1,36), (1,9), (1,36), (1,9), (4,9), (1,9), (1,36), (1,9), (1,36)] ]
-
-c_s = sqrt(Rational(1,3))
-
-rho, tau = symbols('rho tau')
-
-f_next = symarray('f_next', q)
-f_curr = symarray('f_curr', q)
-
-u = Matrix(symarray('u', d))
-
-moments = [ Assignment(rho, sum(f_curr)) ]
-
-for i, u_i in enumerate(u):
- moments.append(Assignment(u_i, sum([ (c_j*f_curr[j])[i] for j, c_j in enumerate(c) ]) / sum(f_curr)))
-
-moments_opt = cse(moments, optimizations='basic', symbols=numbered_symbols(prefix='m'))
-
-f_eq = []
-
-for i, c_i in enumerate(c):
- f_eq_i = w[i] * rho * ( 1
- + c_i.dot(u) / c_s**2
- + c_i.dot(u)**2 / (2*c_s**4)
- - u.dot(u) / (2*c_s**2) )
- f_eq.append(f_eq_i)
-
-collide = [ Assignment(f_next[i], f_curr[i] + 1/tau * ( f_eq_i - f_curr[i] )) for i, f_eq_i in enumerate(f_eq) ]
-
-collide_opt = cse(collide, optimizations='basic')