diff options
-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: |