8from .AbstractRungeKuttaDGActionSet
import AbstractRungeKuttaDGActionSet
9from .ProjectLinearCombinationOfEstimatesOntoFaces
import FaceProjections
10from .ProjectLinearCombinationOfEstimatesOntoFaces
import compute_number_of_face_projection_quantities
16 Default DG interpolation/restriction action set
18 There is a detailed description of the DG AMR semantics in the exahype2 C++
19 directory. Logically, any AMR mesh transition translates into a Riemann
20 problem. The documentation hence is stored in the Riemann.h file.
27 face_projections: FaceProjections):
30 The guards are those for the projection onto the faces.
33 super(DynamicAMR,self).
__init__(solver)
39 return __name__.replace(
".py",
"").replace(
".",
"_")
48 __Template_TouchFaceFirstTime =
"""
49 {% for PREDICATE_NO in range(0,PREDICATES|length) %}
50 if ( {{PREDICATES[PREDICATE_NO]}} ) {
51 ::exahype2::dg::clearSolutionProjection(
53 {{NUMBER_OF_UNKNOWNS}},
54 {{NUMBER_OF_AUXILIARY_VARIABLES}},
55 {{NUMBER_OF_PROJECTED_QUANTITIES}},
56 fineGridFace{{UNKNOWN_IDENTIFIER}}EstimateProjection.value
63 __Template_CreateHangingFace =
"""
64 ::exahype2::dg::interpolateRiemannSolution(
67 {{NUMBER_OF_UNKNOWNS}},
68 repositories::{{SOLVER_INSTANCE}}.InterpolationMatrix1d,
69 coarseGridFaces{{UNKNOWN_IDENTIFIER}}RiemannSolution(marker.getSelectedFaceNumber()).value,
70 fineGridFace{{UNKNOWN_IDENTIFIER}}RiemannSolution.value
73 fineGridFace{{FACE_LABEL}}.setNewTimeStamp(0, std::max( coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).getNewTimeStamp(0), fineGridFace{{FACE_LABEL}}.getNewTimeStamp(0)) );
74 fineGridFace{{FACE_LABEL}}.setNewTimeStamp(1, std::max( coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).getNewTimeStamp(1), fineGridFace{{FACE_LABEL}}.getNewTimeStamp(1)) );
75 fineGridFace{{FACE_LABEL}}.setOldTimeStamp(0, std::max( coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).getOldTimeStamp(0), fineGridFace{{FACE_LABEL}}.getOldTimeStamp(0)) );
76 fineGridFace{{FACE_LABEL}}.setOldTimeStamp(1, std::max( coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).getOldTimeStamp(1), fineGridFace{{FACE_LABEL}}.getOldTimeStamp(1)) );
80 __Template_DestroyHangingFace =
"""
81 {% for PREDICATE_NO in range(0,PREDICATES|length) %}
82 if ( {{PREDICATES[PREDICATE_NO]}} ) {
83 ::exahype2::dg::restrictAndAccumulateProjectedFacePolynomial(
86 {{NUMBER_OF_PROJECTED_QUANTITIES}},
87 {{NUMBER_OF_UNKNOWNS}},
88 {{NUMBER_OF_AUXILIARY_VARIABLES}},
89 repositories::{{SOLVER_INSTANCE}}.RestrictionMatrix1d,
90 fineGridFace{{UNKNOWN_IDENTIFIER}}EstimateProjection.value,
91 coarseGridFaces{{UNKNOWN_IDENTIFIER}}EstimateProjection(marker.getSelectedFaceNumber()).value
94 bool isLeftEntryOnCoarseFaceLabel = marker.getSelectedFaceNumber() >= Dimensions;
95 coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).setUpdated( isLeftEntryOnCoarseFaceLabel ? 0 : 1,true);
96 coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).setUpdatedTimeStamp(
97 isLeftEntryOnCoarseFaceLabel ? 0 : 1,
99 coarseGridFaces{{FACE_LABEL}}(marker.getSelectedFaceNumber()).getUpdatedTimeStamp( isLeftEntryOnCoarseFaceLabel ? 0 : 1 ),
100 fineGridFace{{FACE_LABEL}}.getUpdatedTimeStamp( isLeftEntryOnCoarseFaceLabel ? 0 : 1 )
110 self.
_solver._init_dictionary_with_default_parameters(d)
111 self.
_solver.add_entries_to_text_replacement_dictionary(d)
113 d[
"FACE_LABEL" ] = self.
_solver._face_label.name
114 d[
"NUMBER_OF_PROJECTED_QUANTITIES" ] = compute_number_of_face_projection_quantities( self.
face_projections )
117 if operation_name==peano4.solversteps.ActionSet.OPERATION_CREATE_HANGING_FACE:
125 if operation_name==peano4.solversteps.ActionSet.OPERATION_DESTROY_HANGING_FACE:
141 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
153 raise Exception(
"Guards are not initialised" )
159 if new_guards!=[]
and len(new_guards)!=self.
_solver.number_of_Runge_Kutta_steps():
160 raise Exception(
"Expect one guard per Runge Kutta step. Have {} steps but got guards {}".format(solver.number_of_Runge_Kutta_steps(),guards) )
Default DG interpolation/restriction action set.
str __Template_DestroyHangingFace
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
__init__(self, solver, FaceProjections face_projections)
The guards are those for the projection onto the faces.
get_includes(self)
Return include statements that you need.
str __Template_TouchFaceFirstTime
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
str __Template_CreateHangingFace