aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-11-02 17:32:41 +0100
committerAdrian Kummerlaender2019-11-02 17:32:41 +0100
commit05e74fb112f5b5f645b649c587d18052c7b7f9df (patch)
tree140f41b303a705d3862f5e8d2d074481b7a24135
parentf233beddfc74d5933f46684adab5298e03c08871 (diff)
downloadboltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar.gz
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar.bz2
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar.lz
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar.xz
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.tar.zst
boltzgen-05e74fb112f5b5f645b649c587d18052c7b7f9df.zip
Improve lattice, model selection error reportingv0.1.2
-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,