diff --git a/DG_Approximation.py b/DG_Approximation.py index 7aa8b94bf6dd17564113255ee9d9622cf0256cf7..1727f6e6d3a6fad4bdffa31682e55e188483cfdf 100644 --- a/DG_Approximation.py +++ b/DG_Approximation.py @@ -10,6 +10,7 @@ TODO: Contemplate removing Methods section from class docstring TODO: Contemplate containing the quadrature application for plots in Mesh TODO: Contemplate containing coarse mesh generation in Mesh TODO: Contemplate extracting boundary condition from InitialCondition +TODO: Contemplate containing boundary condition in Mesh Urgent: TODO: Put basis initialization for plots in function -> Done @@ -17,12 +18,13 @@ TODO: Contain cell length in mesh -> Done TODO: Contain bounds in mesh -> Done TODO: Contain interval length in mesh -> Done TODO: Contain number of grid cells in mesh -> Done -TODO: Create data dict for mesh separately -TODO: Create data dict for basis separately +TODO: Create data dict for mesh separately -> Done +TODO: Create data dict for basis separately -> Done +TODO: Remove unnecessary instance variables from TCD -> Done TODO: Refactor eval_points in do_initial_projection() +TODO: Replace getter with property attributes for quadrature TODO: Check whether ghost cells are handled/set correctly TODO: Ensure uniform use of mesh and grid -TODO: Replace getter with property attributes for quadrature TODO: Remove use of DGScheme from ANN_Data_Generator TODO: Find error in centering for ANN training TODO: Adapt TCD from Soraya @@ -32,10 +34,10 @@ TODO: Add TC condition to only flag cell if left-adjacent one is flagged as TODO: Move plot_approximation_results() into plotting script TODO: Add verbose output TODO: Improve file naming (e.g. use '.' instead of '__') -TODO: Combine ANN workflows -TODO: Add an environment file for Snakemake Critical, but not urgent: +TODO: Combine ANN workflows +TODO: Add an environment file for Snakemake TODO: Investigate profiling for speed up TODO: Rework Theoretical TC for efficiency TODO: Check sign change in stiffness matrix to accommodate negative wave speed @@ -214,10 +216,7 @@ class DGScheme: self._quadrature = getattr(Quadrature, self._quadrature)( config=self._quadrature_config) self._detector = getattr(Troubled_Cell_Detector, self._detector)( - config=self._detector_config, mesh=self._mesh, - wave_speed=self._wave_speed, final_time=self._final_time, - basis=self._basis, init_cond=self._init_cond, - quadrature=self._quadrature) + config=self._detector_config, mesh=self._mesh, basis=self._basis) self._update_scheme = getattr(Update_Scheme, self._update_scheme)( polynomial_degree=self._basis.polynomial_degree, num_grid_cells=self._mesh.num_grid_cells, detector=self._detector, @@ -271,6 +270,8 @@ class DGScheme: approx_stats = self._detector.create_data_dict(projection) # Save approximation results in dictionary + approx_stats['wave_speed'] = self._wave_speed + approx_stats['final_time'] = self._final_time approx_stats['time_history'] = time_history approx_stats['troubled_cell_history'] = troubled_cell_history diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py index 8ac1646cc580ea998852a19626488021031acf6f..5adf0474380730ee7e558d8251ccbfffd648068f 100644 --- a/Troubled_Cell_Detector.py +++ b/Troubled_Cell_Detector.py @@ -31,34 +31,21 @@ class TroubledCellDetector(ABC): Return dictionary with data necessary to plot troubled cells. """ - def __init__(self, config, init_cond, quadrature, basis, mesh, - wave_speed=1, final_time=1): + def __init__(self, config, basis, mesh): """Initializes TroubledCellDetector. Parameters ---------- config : dict Additional parameters for detector. - init_cond : InitialCondition object - Initial condition for evaluation. - quadrature : Quadrature object - Quadrature for evaluation. basis : Basis object Basis for calculation. mesh : Mesh Mesh for calculation. - wave_speed : float, optional - Speed of wave in rightward direction. Default: 1. - final_time : float, optional - Final time for which approximation is calculated. Default: 1. """ self._mesh = mesh - self._wave_speed = wave_speed - self._final_time = final_time self._basis = basis - self._init_cond = init_cond - self._quadrature = quadrature self._reset(config) @@ -91,8 +78,7 @@ class TroubledCellDetector(ABC): def create_data_dict(self, projection): """Return dictionary with data necessary to plot troubled cells.""" - return {'projection': projection, 'wave_speed': self._wave_speed, - 'final_time': self._final_time, + return {'projection': projection, 'basis': self._basis.create_data_dict(), 'mesh': self._mesh.create_data_dict() }