aboutsummaryrefslogtreecommitdiff
path: root/lid_driven_cavity.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-13 21:19:49 +0200
committerAdrian Kummerlaender2019-06-13 21:19:49 +0200
commit61cd3b6bc53c151863bd99fb2a03b29157a876ca (patch)
treea50eef491e1b2fdfac1b80635664cfbd62175771 /lid_driven_cavity.py
parent5f98308e2035edff2719ba852d5cc74ab449528f (diff)
downloadsymlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar.gz
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar.bz2
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar.lz
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar.xz
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.tar.zst
symlbm_playground-61cd3b6bc53c151863bd99fb2a03b29157a876ca.zip
Tidy up symbolic kernel generation
Diffstat (limited to 'lid_driven_cavity.py')
-rw-r--r--lid_driven_cavity.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lid_driven_cavity.py b/lid_driven_cavity.py
index db51e73..a4de67d 100644
--- a/lid_driven_cavity.py
+++ b/lid_driven_cavity.py
@@ -7,6 +7,8 @@ matplotlib.use('AGG')
from D2Q9 import Lattice
+import symbolic.D2Q9 as D2Q9
+
def MLUPS(cells, steps, time):
return cells * steps / time * 1e-6
@@ -23,7 +25,7 @@ def generate_moment_plots(lattice, moments):
plt.imshow(velocity, origin='lower', cmap=plt.get_cmap('seismic'))
plt.savefig("result/velocity_" + str(i) + ".png", bbox_inches='tight', pad_inches=0)
-def box(nX, nY, x, y):
+def cavity(nX, nY, x, y):
if x == 1 or y == 1 or x == nX-2:
return 2
elif y == nY-2:
@@ -49,7 +51,12 @@ moments = []
print("Initializing simulation...\n")
-lattice = Lattice(nX = 256, nY = 256, tau = 0.56, geometry = box, boundary_src = boundary)
+lattice = Lattice(
+ nX = 256, nY = 256,
+ geometry = cavity,
+ moments = D2Q9.moments(optimize = False),
+ collide = D2Q9.bgk(tau = 0.56),
+ boundary_src = boundary)
print("Starting simulation using %d cells...\n" % lattice.nCells)