diff options
author | Adrian Kummerlaender | 2019-10-26 13:42:11 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2019-10-26 13:42:11 +0200 |
commit | 9ddfd0f54ddb95b181421c851826e0bb462c249d (patch) | |
tree | cda21c586fbe0969508e56060851a47849acce62 | |
parent | 1c58183e84b2f7024855dc3c5bac19c48ba45f69 (diff) | |
download | boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar.gz boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar.bz2 boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar.lz boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar.xz boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.tar.zst boltzgen-9ddfd0f54ddb95b181421c851826e0bb462c249d.zip |
Add BGK relaxation time argument
Still thinking how various collision models (BGK, MRT and so on) may be
nicely abstracted in this setting.
-rwxr-xr-x | boltzgen.py | 3 | ||||
-rw-r--r-- | boltzgen/lbm/__init__.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/boltzgen.py b/boltzgen.py index ad76471..24a17b2 100755 --- a/boltzgen.py +++ b/boltzgen.py @@ -14,6 +14,7 @@ argparser.add_argument('--lattice', dest = 'lattice', required = True, help 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")') argparser.add_argument('--geometry', dest = 'geometry', required = True, help = 'Size of the block geometry ("x:y(:z)")') +argparser.add_argument('--tau', dest = 'tau', required = True, help = 'BGK relaxation time') args = argparser.parse_args() @@ -23,7 +24,7 @@ lbm = LBM(lattice) generator = Generator( descriptor = lattice, moments = lbm.moments(), - collision = lbm.bgk(f_eq = lbm.equilibrium(), tau = 0.6)) + collision = lbm.bgk(f_eq = lbm.equilibrium(), tau = float(args.tau))) geometry = Geometry.parse(args.geometry) diff --git a/boltzgen/lbm/__init__.py b/boltzgen/lbm/__init__.py index f80feaa..bafe331 100644 --- a/boltzgen/lbm/__init__.py +++ b/boltzgen/lbm/__init__.py @@ -51,6 +51,9 @@ class LBM: return f_eq def bgk(self, tau, f_eq, optimize = True): + if tau <= 0.5: + raise Exception('Relaxation time must be larger than 0.5') + exprs = [ self.f_curr[i] + 1/tau * (f_eq_i - self.f_curr[i]) for i, f_eq_i in enumerate(f_eq) ] if optimize: |