diff --git a/Snakefile b/Snakefile index 16257584bf65e0c8f7a872ace005df826c7ed1e9..e3672dc60661e43ab7259071aba27ed3d8382013 100644 --- a/Snakefile +++ b/Snakefile @@ -21,13 +21,24 @@ TODO: Discuss descriptions (matrices, cfl number, right-hand side, TODO: Discuss referencing info on SSPRK3 TODO: Discuss name for quadrature mesh (now: grid) TODO: Contemplate using lambdify for basis + TODO: Ask why MinMod slope is only calculated from degree 1, not 0 + -> Done (degree 0 is avg, not included in slope) +TODO: Ask whether cell indexing for limiter is correct as was or is now + -> Done (old was wrong) Urgent: -TODO: Vectorize '_determine_modification()' in ModifiedMinMod -TODO: Vectorize '_set_cell_slope()' in MinMod -TODO: Vectorize '_determine_modification()' in MinMod -TODO: Vectorize 'apply()' in MinMod +TODO: Rework ModifiedMinMod limiter for efficiency -> Done +TODO: Vectorize '_set_cell_slope()' in MinMod -> Done +TODO: Vectorize '_determine_modification()' in MinMod -> Done +TODO: Rework limit masking to apply over array instead of cell -> Done +TODO: Vectorize 'apply()' in MinMod -> Done +TODO: Vectorize 'get_cells()' in ANN detector -> Done +TODO: Vectorize '_calculate_wavelet_coeffs()' for wavelet detectors -> Done +TODO: Vectorize '_calculate_coarse_projection()' for wavelet detectors -> Done +TODO: Vectorize '_update_right_hand_side()' for SSPRK3 -> Done +TODO: Vectorize '_reset()' for update scheme +TODO: Vectorize 'plot_details()' TODO: Replace loops/list comprehension with vectorization if feasible TODO: Replace loops with list comprehension if feasible TODO: Rework ICs to allow vector input @@ -39,6 +50,8 @@ TODO: Investigate g-mesh(?) TODO: Create g-mesh with Mesh class TODO: Combine ANN workflows if feasible TODO: Investigate profiling for speed up +TODO: Make sure that the cell indices are the same over all TCDs +TODO: Make sure TCs are reported as ndarray Critical, but not urgent: TODO: Check whether all ValueError are set (correctly) diff --git a/scripts/tcd/Update_Scheme.py b/scripts/tcd/Update_Scheme.py index bc740d9bd3c62a456787278014284b817d674484..771ecb73fc4c8e9eaae18a21a31b4d1ca3ddbf79 100644 --- a/scripts/tcd/Update_Scheme.py +++ b/scripts/tcd/Update_Scheme.py @@ -318,23 +318,18 @@ class SSPRK3(UpdateScheme): Matrix of right-hand side. """ - # Initialize vector and set first entry to accommodate for ghost cell - right_hand_side = [0] - - for j in range(self._num_cells): - if self._wave_speed > 0: - right_hand_side.append(2*(self._stiffness_matrix - @ current_projection[:, j+1] - + self._boundary_matrix - @ current_projection[:, j])) - else: - right_hand_side.append(2*(self._stiffness_matrix - @ current_projection[:, j+1] - + self._boundary_matrix - @ current_projection[:, j+2])) + right_hand_side = np.zeros_like(current_projection) + if self._wave_speed > 0: + right_hand_side[:, 1:-1] = 2 * ( + self._boundary_matrix @ current_projection[:, :-2] + + self._stiffness_matrix @ current_projection[:, 1:-1]) + else: + right_hand_side[:, 1:-1] = 2 * ( + self._boundary_matrix @ current_projection[:, 2:] + + self._stiffness_matrix @ current_projection[:, 1:-1]) # Set ghost cells to respective value - right_hand_side[0] = right_hand_side[self._num_cells] - right_hand_side.append(right_hand_side[1]) + right_hand_side[:, 0] = right_hand_side[:, -2] + right_hand_side[:, -1] = right_hand_side[:, 1] - return np.transpose(right_hand_side) + return right_hand_side