aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xboltzgen.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/boltzgen.py b/boltzgen.py
index 4317c68..57b3ed0 100755
--- a/boltzgen.py
+++ b/boltzgen.py
@@ -25,12 +25,19 @@ args = argparser.parse_args()
if args.model is None:
args.model = "BGK"
-lattice = eval("lbm.lattice.%s" % args.lattice)
-model = eval("lbm.model.%s" % args.model)
-
if args.index is None:
args.index = 'XYZ'
+try:
+ lattice = eval("lbm.lattice.%s" % args.lattice)
+except AttributeError:
+ raise Exception("There is no lattice type called '%s'" % args.lattice) from None
+
+try:
+ model = eval("lbm.model.%s" % args.model)
+except AttributeError:
+ raise Exception("There is no LBM model called '%s'" % args.model) from None
+
generator = Generator(
model = model(lattice, tau = float(args.tau), optimize = not args.disable_cse),
target = args.target,