Skip to content
Snippets Groups Projects
Commit 53c9e96e authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Removed unnecessary comments.

parent 3ff5ede6
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,6 @@ class TrainingDataGenerator(object): ...@@ -112,7 +112,6 @@ class TrainingDataGenerator(object):
# Calculating Cell centers for a given 1D domain with n elements, and # Calculating Cell centers for a given 1D domain with n elements, and
# Calculating Corresponding Legendre Basis Coefficients for given polynomial_degree # 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 # Create stencil and basis_coefficients for smooth_function mapped onto stencil
interval, centers, h = self._build_stencil() interval, centers, h = self._build_stencil()
centers = [center[0] for center in centers] centers = [center[0] for center in centers]
...@@ -121,7 +120,7 @@ class TrainingDataGenerator(object): ...@@ -121,7 +120,7 @@ class TrainingDataGenerator(object):
left_bound, right_bound = interval left_bound, right_bound = interval
dg_scheme = DG_Approximation.DGScheme('NoDetection', polynomial_degree=polynomial_degree, 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', right_bound=right_bound, quadrature='Gauss',
quadrature_config={'num_eval_points': polynomial_degree+1}) quadrature_config={'num_eval_points': polynomial_degree+1})
...@@ -143,11 +142,6 @@ class TrainingDataGenerator(object): ...@@ -143,11 +142,6 @@ class TrainingDataGenerator(object):
order = np.random.permutation(num_samples) order = np.random.permutation(num_samples)
input_data = input_data[order] 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)) output_data = np.zeros((num_samples, 2))
if is_smooth: if is_smooth:
output_data[:, 1] = np.ones(num_samples) output_data[:, 1] = np.ones(num_samples)
......
...@@ -14,7 +14,7 @@ tic = timeit.default_timer() ...@@ -14,7 +14,7 @@ tic = timeit.default_timer()
alpha = 1 alpha = 1
p = 2 p = 2
cfl = 0.2 cfl = 0.2
N = 256 # 40 elements work well for Condition 3 N = 4 # 40 elements work well for Condition 3
finalTime = 1 finalTime = 1
xL = -1 xL = -1
xR = 1 xR = 1
...@@ -38,9 +38,10 @@ limiter_config['erase_degree'] = 0 ...@@ -38,9 +38,10 @@ limiter_config['erase_degree'] = 0
quadrature_config['num_eval_points'] = 12 # 12 quadrature_config['num_eval_points'] = 12 # 12
detector = 'Theoretical' # detector = 'Theoretical'
detector = 'ArtificialNeuralNetwork'
update_scheme = 'SSPRK3' update_scheme = 'SSPRK3'
init_cond = 'Box' init_cond = 'Sine'
limiter = 'ModifiedMinMod' limiter = 'ModifiedMinMod'
quadrature = 'Gauss' quadrature = 'Gauss'
dg_scheme = DGScheme(detector, detector_config=detector_config, init_cond=init_cond, init_config=init_config, 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 ...@@ -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, polynomial_degree=p, cfl_number=cfl, num_grid_cells=N, final_time=finalTime,
verbose=False, left_bound=xL, right_bound=xR) verbose=False, left_bound=xL, right_bound=xR)
# __, __, troubled_cells, __ =
dg_scheme.approximate() dg_scheme.approximate()
dg_scheme.save_plots() dg_scheme.save_plots()
toc = timeit.default_timer() toc = timeit.default_timer()
print('Time:', toc-tic) 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__': # if __name__ == '__main__':
# pass # pass
...@@ -280,32 +280,6 @@ class WaveletDetector(TroubledCellDetector): ...@@ -280,32 +280,6 @@ class WaveletDetector(TroubledCellDetector):
basis = self._basis.get_basis_vector() basis = self._basis.get_basis_vector()
wavelet = self._basis.get_wavelet_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) averaged_projection = [[coarse_projection[degree][cell] * basis[degree].subs(x, value)
for cell in range(self._num_coarse_grid_cells) for cell in range(self._num_coarse_grid_cells)
for value in [-0.5, 0.5]] for value in [-0.5, 0.5]]
...@@ -315,11 +289,6 @@ class WaveletDetector(TroubledCellDetector): ...@@ -315,11 +289,6 @@ class WaveletDetector(TroubledCellDetector):
for cell in range(self._num_coarse_grid_cells) for cell in range(self._num_coarse_grid_cells)
for value in [(-1) ** (self._polynomial_degree + degree + 1), 1]] for value in [(-1) ** (self._polynomial_degree + degree + 1), 1]]
for degree in range(self._polynomial_degree + 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_coarse = np.sum(averaged_projection, axis=0)
projected_fine = np.sum([fine_projection[degree] * basis[degree].subs(x, 0) projected_fine = np.sum([fine_projection[degree] * basis[degree].subs(x, 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment