aboutsummaryrefslogtreecommitdiff
path: root/implosion.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-12 22:20:51 +0200
committerAdrian Kummerlaender2019-06-12 22:20:51 +0200
commitd4dab626ea25c088e2a5c7256e17d115d4f80478 (patch)
tree5f8628a21d5eb00b96f71ba131e51230879d8c17 /implosion.py
parent9cf82f641b8982df526107b99d883545ee02fe20 (diff)
downloadsymlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar.gz
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar.bz2
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar.lz
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar.xz
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.tar.zst
symlbm_playground-d4dab626ea25c088e2a5c7256e17d115d4f80478.zip
Make it easier to exchange initial equilibration logic
Diffstat (limited to 'implosion.py')
-rw-r--r--implosion.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/implosion.py b/implosion.py
index 75e9640..d2754c2 100644
--- a/implosion.py
+++ b/implosion.py
@@ -29,14 +29,27 @@ def box(nX, nY, x, y):
else:
return 1
-nUpdates = 1000
+pop_eq = """
+ if ( sqrt(pow(get_global_id(0) - ${nX//2}.f, 2.f) + pow(get_global_id(1) - ${nY//2}.f, 2.f)) < ${nX//10} ) {
+% for i, w_i in enumerate(w):
+ preshifted_f_a[${i*nCells}] = 1./24.f;
+ preshifted_f_b[${i*nCells}] = 1./24.f;
+% endfor
+ } else {
+% for i, w_i in enumerate(w):
+ preshifted_f_a[${i*nCells}] = ${w_i}.f;
+ preshifted_f_b[${i*nCells}] = ${w_i}.f;
+% endfor
+}"""
+
+nUpdates = 2000
nStat = 100
moments = []
print("Initializing simulation...\n")
-lattice = Lattice(nX = 1024, nY = 1024, tau = 0.8, geometry = box)
+lattice = Lattice(nX = 1024, nY = 1024, tau = 0.8, geometry = box, pop_eq_src = pop_eq)
print("Starting simulation using %d cells...\n" % lattice.nCells)