From 284b9c64a21288e278eb22054e12cdc7c3d99f85 Mon Sep 17 00:00:00 2001 From: Jakub Both Date: Sun, 5 Nov 2023 16:07:03 +0100 Subject: [PATCH] MAINT: Initialize distance for robustness. --- src/darsia/measure/wasserstein.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/darsia/measure/wasserstein.py b/src/darsia/measure/wasserstein.py index 914a7823..93f8610c 100644 --- a/src/darsia/measure/wasserstein.py +++ b/src/darsia/measure/wasserstein.py @@ -1212,6 +1212,9 @@ def _solve(self, flat_mass_diff: np.ndarray) -> tuple[float, np.ndarray, dict]: self.darcy_init.copy(), rhs.copy(), solution_i ) + # Initialize distance in case below iteration fails + new_distance = 0 + # Initialize container for storing the convergence history convergence_history = { "distance": [], @@ -1489,6 +1492,9 @@ def _solve(self, flat_mass_diff: np.ndarray) -> tuple[float, np.ndarray, dict]: self.darcy_init.copy(), rhs.copy(), solution_i ) + # Initialize distance in case below iteration fails + new_distance = 0 + # Initialize container for storing the convergence history convergence_history = { "distance": [],