From 53c9e96e7a21687d1efb55da209415d865e35fb2 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: Tue, 3 Aug 2021 14:52:58 +0200 Subject: [PATCH] Removed unnecessary comments. --- ANN_Data_Generator.py | 8 +------- Main.py | 18 ++++-------------- Troubled_Cell_Detector.py | 31 ------------------------------- 3 files changed, 5 insertions(+), 52 deletions(-) diff --git a/ANN_Data_Generator.py b/ANN_Data_Generator.py index c6a22bb..860ef55 100644 --- a/ANN_Data_Generator.py +++ b/ANN_Data_Generator.py @@ -112,7 +112,6 @@ class TrainingDataGenerator(object): # Calculating Cell centers for a given 1D domain with n elements, and # Calculating Corresponding Legendre Basis Coefficients for given polynomial_degree - num_grid_cells = self._stencil_length # former: 3 # Create stencil and basis_coefficients for smooth_function mapped onto stencil interval, centers, h = self._build_stencil() centers = [center[0] for center in centers] @@ -121,7 +120,7 @@ class TrainingDataGenerator(object): left_bound, right_bound = interval dg_scheme = DG_Approximation.DGScheme('NoDetection', polynomial_degree=polynomial_degree, - num_grid_cells=num_grid_cells, left_bound=left_bound, + num_grid_cells=self._stencil_length, left_bound=left_bound, right_bound=right_bound, quadrature='Gauss', quadrature_config={'num_eval_points': polynomial_degree+1}) @@ -143,11 +142,6 @@ class TrainingDataGenerator(object): order = np.random.permutation(num_samples) input_data = input_data[order] - # for i in range(len(test_data)): - # print(i) - # print(test_data[i]) - # print() - output_data = np.zeros((num_samples, 2)) if is_smooth: output_data[:, 1] = np.ones(num_samples) diff --git a/Main.py b/Main.py index 0c7dae2..5ae4083 100644 --- a/Main.py +++ b/Main.py @@ -14,7 +14,7 @@ tic = timeit.default_timer() alpha = 1 p = 2 cfl = 0.2 -N = 256 # 40 elements work well for Condition 3 +N = 4 # 40 elements work well for Condition 3 finalTime = 1 xL = -1 xR = 1 @@ -38,9 +38,10 @@ limiter_config['erase_degree'] = 0 quadrature_config['num_eval_points'] = 12 # 12 -detector = 'Theoretical' +# detector = 'Theoretical' +detector = 'ArtificialNeuralNetwork' update_scheme = 'SSPRK3' -init_cond = 'Box' +init_cond = 'Sine' limiter = 'ModifiedMinMod' quadrature = 'Gauss' dg_scheme = DGScheme(detector, detector_config=detector_config, init_cond=init_cond, init_config=init_config, @@ -49,22 +50,11 @@ dg_scheme = DGScheme(detector, detector_config=detector_config, init_cond=init_c polynomial_degree=p, cfl_number=cfl, num_grid_cells=N, final_time=finalTime, verbose=False, left_bound=xL, right_bound=xR) -# __, __, troubled_cells, __ = dg_scheme.approximate() dg_scheme.save_plots() toc = timeit.default_timer() print('Time:', toc-tic) -# ============================================================================= -# -# print(troubled_cells) -# -# print(dg_scheme.update_scheme) -# print(dg_scheme.init_cond) -# print(dg_scheme.detector) -# print(dg_scheme.limiter) -# # print(dg_scheme.projection) -# ============================================================================= # if __name__ == '__main__': # pass diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py index 15c32b0..8a6b5a2 100644 --- a/Troubled_Cell_Detector.py +++ b/Troubled_Cell_Detector.py @@ -280,32 +280,6 @@ class WaveletDetector(TroubledCellDetector): basis = self._basis.get_basis_vector() wavelet = self._basis.get_wavelet_vector() -######################################################################################################################## - # For later consideration -######################################################################################################################## - # tic = timeit.default_timer() - # averaged_projection1 = [] - # wavelet_projection1 = [] - # for degree in range(self._polynomial_degree + 1): - # leftMesh = coarse_projection[degree] * basis[degree].subs(x, -1 / 2) - # rightMesh = coarse_projection[degree] * basis[degree].subs(x, 1 / 2) - # leftTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(z, 1 / 2) \ - # * (-1)**(self._polynomial_degree + 1 + degree) - # rightTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(z, 1 / 2) - # newRowMesh = [] - # newRowTest = [] - # for i in range(len(coarse_projection[0])): - # newRowMesh.append(leftMesh[i]) - # newRowMesh.append(rightMesh[i]) - # newRowTest.append(leftTest[i]) - # newRowTest.append(rightTest[i]) - # averaged_projection1.append(newRowMesh) - # wavelet_projection1.append(newRowTest) - # toc = timeit.default_timer() - # print('Loop:', toc-tic) -######################################################################################################################## - - # tic = timeit.default_timer() averaged_projection = [[coarse_projection[degree][cell] * basis[degree].subs(x, value) for cell in range(self._num_coarse_grid_cells) for value in [-0.5, 0.5]] @@ -315,11 +289,6 @@ class WaveletDetector(TroubledCellDetector): for cell in range(self._num_coarse_grid_cells) for value in [(-1) ** (self._polynomial_degree + degree + 1), 1]] for degree in range(self._polynomial_degree + 1)] - # toc = timeit.default_timer() - # print('List:', toc-tic) - - # print(averaged_projection1 == averaged_projection) - # print(wavelet_projection1 == wavelet_projection) projected_coarse = np.sum(averaged_projection, axis=0) projected_fine = np.sum([fine_projection[degree] * basis[degree].subs(x, 0) -- GitLab