4from .AbstractRungeKuttaDGActionSet
import AbstractRungeKuttaDGActionSet
15 Different data can be projected onto the faces. In the simplest variant,
16 only the solution is projected on the faces and the Riemann solver then
17 reconstructs the flux from the arising jump, i.e. the solution left and
18 right of the face. There are more sophisticated variants however which
19 exploit the solution left and right plus additional data such as the
20 gradient along the normal.
23 SolutionAndGradient = 2,
24 SolutionAndFluxExtrapolation = 3
28 Translate the information what is projected onto the faces into a number
29 how many quantities are to be held per face.
31 if face_projections == FaceProjections.Solution:
33 elif face_projections == FaceProjections.SolutionAndGradient:
35 elif face_projections == FaceProjections.SolutionAndFluxExtrapolation:
38 assert False,
"variant {} not handled".format( face_projections )
44 The linear combination of the Runge-Kutta trials has to be projected onto
45 the faces, so we can then solve the Riemann problems. So the projection
46 happens in one grid sweep, the corresponding Riemann solve in the next one.
48 Please consult the documentation of RungeKuttaDG for an explanation of the
49 role of the two different boundary data fields.
52 ## Time step sizes and time stamps
54 Besides the actual projection, I also set the following fields on the
57 - Updated Is set after each projection.
59 - UpdatedTimeStamp Is set after each projection with the time stamp
60 of the current Runge-Kutta trial.
62 We do not update the new and old time stamp on the face label. These
63 values are properly set in the ComputeFinalLinearCombination action set.
68 We can set separate guards for each individual step (which we have to do,
69 as the different steps depend on the role of the individual Runge-Kutta
70 phases). The action set does not initialise the guards with a dummy.
71 Instead, I expect that the person who creates the action set explicitly
72 sets the guard list before the action set is handed over to the code
78 TemplateProjectLinearCombinationSolution =
"""
79 {% for PREDICATE_NO in range(0,PREDICATES|length) %}
80 if ({{PREDICATES[PREDICATE_NO]}}) {
82 double* QIn = fineGridCell{{UNKNOWN_IDENTIFIER}}LinearCombination.value;
85 ::exahype2::dg::projectVolumetricDataOntoFaces(
88 {{NUMBER_OF_UNKNOWNS}},
89 {{NUMBER_OF_AUXILIARY_VARIABLES}},
90 repositories::{{SOLVER_INSTANCE}}.BasisFunctionValuesLeft1d,
91 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(0).value, //left
92 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(2).value, //right
93 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(1).value, //down
94 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(3).value //up
97 ::exahype2::dg::projectVolumetricDataOntoFaces(
100 {{NUMBER_OF_UNKNOWNS}},
101 {{NUMBER_OF_AUXILIARY_VARIABLES}},
102 repositories::{{SOLVER_INSTANCE}}.BasisFunctionValuesLeft1d,
103 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(0).value, //left
104 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(3).value, //right
105 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(1).value, //down
106 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(4).value, //up
107 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(2).value, //front
108 fineGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(5).value //back
114 // double timeStepSize
115 const double timeStampOldSolution = fineGridCell{{SOLVER_NAME}}CellLabel.getTimeStamp();
116 {{COMPUTE_TIME_STEP_SIZE}}
117 const double timeStamp = timeStampOldSolution + {{BUTCHER_TABLEAU_RELATIVE_TIME_STEP_SIZES[PREDICATE_NO]}} * timeStepSize;
119 for (int d=0; d<Dimensions; d++) {
120 {{FACE_METADATA_ACCESSOR}}(d).setUpdated( 1,true);
121 {{FACE_METADATA_ACCESSOR}}(d+Dimensions).setUpdated(0,true);
123 {{FACE_METADATA_ACCESSOR}}(d).setUpdatedTimeStamp( 1, timeStamp );
124 {{FACE_METADATA_ACCESSOR}}(d+Dimensions).setUpdatedTimeStamp(0, timeStamp );
126 logDebug( "touchCellLastTime(...)", "update {{FACE_METADATA_ACCESSOR}}(" << d << ")(1)" );
127 logDebug( "touchCellLastTime(...)", "update {{FACE_METADATA_ACCESSOR}}(" << (d+Dimensions) << ")(0)" );
136 face_projections: FaceProjections):
141 super(ProjectLinearCombinationOfEstimatesOntoFaces,self).
__init__(solver)
150 raise Exception(
"Guards are not initialised" )
156 if new_guards!=[]
and len(new_guards)!=self.
_solver.number_of_Runge_Kutta_steps():
157 raise Exception(
"Expect one guard per Runge Kutta step. Have {} steps but got guards {}".format(solver.number_of_Runge_Kutta_steps(),guards) )
164 self.
_solver._init_dictionary_with_default_parameters(d)
165 self.
_solver.add_entries_to_text_replacement_dictionary(d)
167 d[
"FACE_METADATA_ACCESSOR" ] =
"fineGridFaces" + self.
_solver._face_label.name
168 d[
"CELL_METADATA_ACCESSOR" ] =
"fineGridCell""" + self.
_solver._cell_label.name
170 d[
"BUTCHER_TABLEAU_RELATIVE_TIME_STEP_SIZES" ] = self.
_butcher_tableau.time_step_sizes()
171 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
and self.
face_projections==FaceProjections.Solution:
174 elif operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
175 assert False,
"face projection variant {} not supported yet ".format( self.
face_projections)
181 return __name__.replace(
".py",
"").replace(
".",
"_")
The linear combination of the Runge-Kutta trials has to be projected onto the faces,...
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
str TemplateProjectLinearCombinationSolution
__init__(self, solver, FaceProjections face_projections)
solver: RungeKuttaDG Reference to creating class
Different data can be projected onto the faces.
compute_number_of_face_projection_quantities(FaceProjections face_projections)
Translate the information what is projected onto the faces into a number how many quantities are to b...