Peano
Loading...
Searching...
No Matches
DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks.py
Go to the documentation of this file.
1"""
2 This file is part of the MGHyPE project within Peano 4. For conditions of distribution and
3 use, please see the copyright notice at www.peano-framework.org
4"""
5import peano4.api
7import dastgen2
8import os
9import jinja2
10
11from .Solver import Solver
12from .DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver import DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver
13
14from .actionsets.DGSolver.UpdateResidualWithTasks import UpdateResidualWithTasks
15from .actionsets.DGSolver.ProjectIntoCellAndUpdateCellSolutionWithTasks import ProjectIntoCellAndUpdateCellSolutionWithTasks
16
17
18import peano4.api
19
20
22 """!
23
24 DG solver adding tasks to baseline code
25
26
27 See the documentation for solvers.api.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver.DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver
28 first. The class adds a few simple features:
29
30 1. We create a cell marker which holds the task numbers.
31 2. This one is added to the mesh within add_to_Peano4_datamodel().
32 3. We tell both the mesh initialisation and each solve step to use the data.
33 4. We swap out the residual computation and the cell update with a bespoke
34 task-based implementation
35
36 """
37 def __init__(self,
38 name,
39 dimensions,
40 poly_degree,
41 unknowns_per_cell_node,
42 solutions_per_face_node,
43 projections_per_face_node,
44 min_h,
45 max_h,
46 assembly_matrix,
47 assembly_matrix_scaling,
48 mass_matrix,
49 mass_matrix_scaling,
50 face_from_cell_projection,
51 face_from_cell_projection_scaling,
52 cell_from_face_projection,
53 cell_from_face_projection_scaling,
54 riemann_matrix,
55 boundary_matrix,
56 cell_relaxation,
57 face_relaxation,
58 approximate_system_matrix,
59 approximate_system_matrix_scaling,
60 integration_points,
61 solver_tolerance,
62 custom_init_actionset = None,
63 custom_plot_actionset = None, # just pass in a list of tuples, one for the variable name and the other for the getter
64 custom_init_cell = "",
65 enable_plotting = True, # sometimes we want to disable standard plotting...,
66 plot_predicate = "true", # enable custom plotting behaviour
67 solver_includes = "",
68 ):
69 super( DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks, self ).__init__(
70 name,
71 dimensions,
72 poly_degree,
73 unknowns_per_cell_node,
74 solutions_per_face_node,
75 projections_per_face_node,
76 min_h,
77 max_h,
78 assembly_matrix,
79 assembly_matrix_scaling,
80 mass_matrix,
81 mass_matrix_scaling,
82 face_from_cell_projection,
83 face_from_cell_projection_scaling,
84 cell_from_face_projection,
85 cell_from_face_projection_scaling,
86 riemann_matrix,
87 boundary_matrix,
88 cell_relaxation,
89 face_relaxation,
90 approximate_system_matrix,
91 approximate_system_matrix_scaling,
92 integration_points,
93 solver_tolerance,
94 custom_init_actionset,
95 custom_plot_actionset,
96 custom_init_cell,
97 enable_plotting,
98 plot_predicate,
99 solver_includes,
100 use_smart_pointer = True,
101 )
102
103 self._task_name = self._name + "DGTaskMarker"
105
106 # Stays the same
107 # self._action_set_update_face_solution = UpdateFaceSolution(self, descend_order+1, False)
108 # self._action_set_project_onto_faces = ProjectOntoFaces(self, descend_order+3, False)
110 self._action_set_update_residual = UpdateResidualWithTasks(self, self._action_set_update_residual.descend_invocation_order, False)
111
112 self._cell_data.data.add_attribute(dastgen2.attributes.DoublePointer( "inverseOfSystemMatrix" ))
113
114
115 def add_to_init_solution(self, observer):
116 """!
117
118 See superclass' constructor
119
120 We ask the superclass to add all of its action sets to the project's
121 observer. After that, we add our own action set to the algorithm
122 step.
123
124 """
125 super( DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks, self ).add_to_init_solution( observer )
126 observer.add_action_set( peano4.api.toolbox.api.AssignNumbersToCells(self._task_name) )
127
128
129 def add_to_solve(self, observer):
130 super( DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks, self ).add_to_solve( observer )
131 observer.add_action_set( peano4.api.toolbox.api.AssignNumbersToCells(self._task_name) )
132
133
134 def add_to_Peano4_datamodel( self, datamodel, verbose ):
135 super( DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks, self ).add_to_Peano4_datamodel( datamodel, verbose )
136 datamodel.add_cell(self._cell_marker_for_tasks)
137
138
139 def add_use_statements(self, observer):
140 super( DiscontinuousGalerkinDiscretisationPointWiseRiemannSolver_Tasks, self ).add_use_statements( observer )
141 observer.use_cell( self._cell_marker_for_tasks)
142
__init__(self, name, dimensions, poly_degree, unknowns_per_cell_node, solutions_per_face_node, projections_per_face_node, min_h, max_h, assembly_matrix, assembly_matrix_scaling, mass_matrix, mass_matrix_scaling, face_from_cell_projection, face_from_cell_projection_scaling, cell_from_face_projection, cell_from_face_projection_scaling, riemann_matrix, boundary_matrix, cell_relaxation, face_relaxation, approximate_system_matrix, approximate_system_matrix_scaling, integration_points, solver_tolerance, custom_init_actionset=None, custom_plot_actionset=None, custom_init_cell="", enable_plotting=True, plot_predicate="true", solver_includes="")
Construct the solver.
create_cell_marker(task_name)
Create cell marker for tasking.