From 4fdb3c746b20b737b5eb71be0da91e8b0d58ef50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?=
 <laura.kuehle@uni-duesseldorf.de>
Date: Fri, 12 May 2023 10:22:39 +0200
Subject: [PATCH] Ensured that CFL number is non-negative.

---
 Snakefile               | 2 +-
 scripts/tcd/Equation.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Snakefile b/Snakefile
index 751bca6..b6d6b22 100644
--- a/Snakefile
+++ b/Snakefile
@@ -24,7 +24,7 @@ TODO: Discuss how wavelet details should be plotted
 
 Urgent:
 TODO: Mark Burgers' equation as inviscid -> Done
-TODO: Make sure CFL number is absolute value
+TODO: Make sure CFL number is absolute value -> Done
 TODO: Make sure only ghost cells are limited for Dirichlet boundary
 TODO: Move height adjustment and stretch factor into implicit solver function
 TODO: Check correctness of implicit solver (with burgex.f)
diff --git a/scripts/tcd/Equation.py b/scripts/tcd/Equation.py
index 84e854b..569a4e4 100644
--- a/scripts/tcd/Equation.py
+++ b/scripts/tcd/Equation.py
@@ -273,7 +273,7 @@ class LinearAdvection(Equation):
         # Adjust for final time-step
         if current_time+time_step > self.final_time:
             time_step = self.final_time-current_time
-            cfl_number = self.wave_speed * time_step / self._mesh.cell_len
+            cfl_number = abs(self.wave_speed * time_step / self._mesh.cell_len)
 
         return cfl_number, time_step
 
-- 
GitLab