From c5ed7277df34dce0a17d2770b6e4fa37da4aa5c6 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 18:47:13 +0200
Subject: [PATCH] Vectorized 'update_right_hand_side()' for Burgers.

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

diff --git a/Snakefile b/Snakefile
index ea3fb9b..1b5ddc0 100644
--- a/Snakefile
+++ b/Snakefile
@@ -26,6 +26,7 @@ TODO: Ask why implicit solver is always over the interval [0,1] with 200 cells
 TODO: Ask about reasoning behind height_adjustment and stretch_factor
 
 Urgent:
+TODO: Move code to other Git
 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 -> Done
@@ -39,6 +40,7 @@ TODO: Vectorize 'burgers_volume_integral()'
 TODO: Vectorize 'burgers_local_Lax_Friedrich()'
 TODO: Vectorize 'burgers_boundary_matrix()'
 TODO: Vectorize '_calculate_boundary_points()'
+TODO: Vectorize 'update_right_hand_side()' for Burgers -> Done
 TODO: Try to extract calculation of matrices for the volume integral and flux
     for Burgers
 TODO: Rework/refactor implicit solver
diff --git a/scripts/tcd/Equation.py b/scripts/tcd/Equation.py
index 783dd22..c518c91 100644
--- a/scripts/tcd/Equation.py
+++ b/scripts/tcd/Equation.py
@@ -614,44 +614,9 @@ class Burgers(Equation):
             Matrix of right-hand side.
 
         """
-        pass
         volume_integral_matrix = self._burgers_volume_integral(projection)
         boundary_matrix = self._burgers_boundary_matrix(projection)
-
-        # Initialize vector and set first entry to accommodate for ghost cell
-        right_hand_side = [0]
-
-        for j in range(self._mesh.num_cells):
-            right_hand_side.append(2*(volume_integral_matrix[:, j + 1] +
-                                      boundary_matrix[:, j + 1]))
-
-        # Set ghost cells to respective value
-        # (Periodic, Updated to Dirichlet in enforce_boundary_condition
-        # for DiscontinuousConstant problem)
-        right_hand_side[0] = right_hand_side[self._mesh.num_cells]
-        right_hand_side.append(right_hand_side[1])
-
-        return np.transpose(right_hand_side)
-        # right_hand_side = np.zeros_like(projection)
-        # if self._wave_speed > 0:
-        #     right_hand_side[:, self._mesh.num_ghost_cells:
-        #                     -self._mesh.num_ghost_cells] = \
-        #         2 * (self._flux_matrix @
-        #              projection[:, self._mesh.num_ghost_cells-1:
-        #                         -self._mesh.num_ghost_cells-1] +
-        #              self._volume_integral_matrix @
-        #              projection[:, self._mesh.num_ghost_cells:
-        #                         -self._mesh.num_ghost_cells])
-        # else:
-        #     right_hand_side[:, self._mesh.num_ghost_cells:
-        #                     -self._mesh.num_ghost_cells] = \
-        #         2 * (self._flux_matrix @
-        #              projection[:, self._mesh.num_ghost_cells+1:] +
-        #              self._volume_integral_matrix @
-        #              projection[:, self._mesh.num_ghost_cells:
-        #                         -self._mesh.num_ghost_cells])
-        #
-        # return right_hand_side
+        return 2*(volume_integral_matrix+boundary_matrix)
 
     def _burgers_volume_integral(self, projection):
         basis_vector = self._basis.basis
-- 
GitLab