From 927a0d3e87ce77fb272a7e606e696dc9971bcbbf 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:28:11 +0200
Subject: [PATCH] Ensured that only ghost cells are changed for Dirichlet
 boundary.

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

diff --git a/Snakefile b/Snakefile
index b6d6b22..4960e3c 100644
--- a/Snakefile
+++ b/Snakefile
@@ -25,7 +25,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 -> Done
-TODO: Make sure only ghost cells are limited for Dirichlet boundary
+TODO: Make sure only ghost cells are limited for Dirichlet boundary -> Done
 TODO: Move height adjustment and stretch factor into implicit solver function
 TODO: Check correctness of implicit solver (with burgex.f)
 TODO: Add Burgers class completely
diff --git a/scripts/tcd/Boundary_Condition.py b/scripts/tcd/Boundary_Condition.py
index cb9f610..72f3a8c 100644
--- a/scripts/tcd/Boundary_Condition.py
+++ b/scripts/tcd/Boundary_Condition.py
@@ -58,8 +58,8 @@ def dirichlet_boundary(projection: ndarray, config: dict) -> ndarray:
     left_factor = config['left_factor']
     right_factor = config['right_factor']
 
-    projection_values_left = [0 for i in range(polynomial_degree+1)]
-    projection_values_right = [0 for i in range(polynomial_degree+1)]
+    projection_values_left = [0 for _ in range(polynomial_degree+1)]
+    projection_values_right = [0 for _ in range(polynomial_degree+1)]
     if final_time > 1:
         projection_values_left[0] = -np.sqrt(2) / final_time
         projection_values_right[0] = np.sqrt(2) / final_time
@@ -67,8 +67,8 @@ def dirichlet_boundary(projection: ndarray, config: dict) -> ndarray:
         projection_values_left[0] = np.sqrt(2) * left_factor
         projection_values_right[0] = np.sqrt(2) * right_factor
 
-    projection[:, :num_ghost_cells+1] = np.repeat(projection_values_left)
-    projection[:, -num_ghost_cells-1:] = np.repeat(projection_values_right)
+    projection[:, :num_ghost_cells] = np.repeat(projection_values_left)
+    projection[:, -num_ghost_cells:] = np.repeat(projection_values_right)
     # projection[:, 0] = projection_values_left
     # projection[:, 1] = projection_values_left
     # projection[:, -2] = projection_values_right
-- 
GitLab