aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-26 12:51:49 +0200
committerAdrian Kummerlaender2019-10-26 12:51:49 +0200
commitafbb5520cd2140c108adffd6170b5a83faf329f2 (patch)
tree10f9a1331a3598a63b977ab4db1a2c64b92c387c
parent8e968727a9c2c5a1b3be858b1102e70651f34168 (diff)
downloadboltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar.gz
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar.bz2
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar.lz
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar.xz
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.tar.zst
boltzgen-afbb5520cd2140c108adffd6170b5a83faf329f2.zip
Add lattice argument
-rw-r--r--boltzgen.py16
-rw-r--r--boltzgen/__init__.py7
2 files changed, 15 insertions, 8 deletions
diff --git a/boltzgen.py b/boltzgen.py
index b487b07..6f8f20c 100644
--- a/boltzgen.py
+++ b/boltzgen.py
@@ -3,16 +3,22 @@ import string
from boltzgen import *
-argparser = argparse.ArgumentParser(description='Generate LBM kernels in various languages using a symbolic description.')
+argparser = argparse.ArgumentParser(
+ description = 'Generate LBM kernels in various languages using a symbolic description.')
+
argparser.add_argument('language', help = 'Target language (currently either "cl" or "cpp")')
-argparser.add_argument('--layout', dest = 'layout', help = 'Memory layout ("AOS" or "SOA")', required = True)
-argparser.add_argument('--precision', dest = 'precision', help = 'Floating precision ("single" or "double")', required = True)
+
+argparser.add_argument('--lattice', dest = 'lattice', required = True, help = 'Lattice type (D2Q9, D3Q7, D3Q19, D3Q27)')
+argparser.add_argument('--layout', dest = 'layout', required = True, help = 'Memory layout ("AOS" or "SOA")')
+argparser.add_argument('--precision', dest = 'precision', required = True, help = 'Floating precision ("single" or "double")')
args = argparser.parse_args()
-lbm = LBM(D2Q9)
+lattice = eval("lbm.model.%s" % args.lattice)
+
+lbm = LBM(lattice)
generator = Generator(
- descriptor = D2Q9,
+ descriptor = lattice,
moments = lbm.moments(),
collision = lbm.bgk(f_eq = lbm.equilibrium(), tau = 0.6))
diff --git a/boltzgen/__init__.py b/boltzgen/__init__.py
index 0cf365b..d12f06d 100644
--- a/boltzgen/__init__.py
+++ b/boltzgen/__init__.py
@@ -1,8 +1,9 @@
from lbm import LBM
-import lbm.model.D2Q9 as D2Q9
-import lbm.model.D3Q19 as D3Q19
-import lbm.model.D3Q27 as D3Q27
+import lbm.model.D2Q9
+import lbm.model.D3Q7
+import lbm.model.D3Q19
+import lbm.model.D3Q27
from geometry import Geometry