From 3f1140467c0b051e914eca052138d683a9d25a37 Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Mon, 20 Dec 2021 22:33:37 +0100 Subject: [PATCH] Fix precision problems --- lbmpy/boundaries/boundaryhandling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lbmpy/boundaries/boundaryhandling.py b/lbmpy/boundaries/boundaryhandling.py index fc1fae4a..60c00dfe 100644 --- a/lbmpy/boundaries/boundaryhandling.py +++ b/lbmpy/boundaries/boundaryhandling.py @@ -160,7 +160,7 @@ class LbmWeightInfo(CustomCodeNode): self.weights_symbol = TypedSymbol("weights", data_type) data_type_string = "double" if self.weights_symbol.dtype.numpy_dtype == np.float64 else "float" - weights = [str(w.evalf()) for w in lb_method.weights] + weights = [str(w.evalf(17)) for w in lb_method.weights] if data_type_string == "float": weights = "f, ".join(weights) weights += "f" # suffix for the last element @@ -172,7 +172,7 @@ class LbmWeightInfo(CustomCodeNode): def weight_of_direction(self, dir_idx, lb_method=None): if isinstance(sp.sympify(dir_idx), sp.Integer): - return lb_method.weights[dir_idx].evalf() + return lb_method.weights[dir_idx].evalf(17) else: return sp.IndexedBase(self.weights_symbol, shape=(1,))[dir_idx] -- GitLab