4from .AbstractRungeKuttaDGActionSet
import AbstractRungeKuttaDGActionSet
15 The linear combination of the Runge Kutta trials has to be projected onto
16 the faces, so we can then solve the Riemann problems. So the projection
17 happens in one grid sweep, the corresponding Riemann solve in the next one.
19 ## Time step/time stamp handling
21 We rely on ProjectLinearCombinationOfEstimatesOntoFaces to project the
22 current solution onto the faces.
27 TemplateHandleBoundary_Prologue =
"""
28 {% for PREDICATE_NO in range(0,PREDICATES|length) %}
30 {{PREDICATES[PREDICATE_NO]}}
32 not repositories::{{SOLVER_INSTANCE}}.PeriodicBC[marker.getSelectedFaceNumber()%Dimensions]
34 not marker.hasBeenRefined()
36 fineGridFace{{SOLVER_NAME}}FaceLabel.getBoundary()
38 const double timeStampOldSolution = fineGridFace{{SOLVER_NAME}}FaceLabel.getOldTimeStamp()(0);
41 // double timeStepSize
42 {{COMPUTE_TIME_STEP_SIZE}}
44 const double timeStamp = timeStampOldSolution + {{BUTCHER_TABLEAU_RELATIVE_TIME_STEP_SIZES[PREDICATE_NO]}} * timeStepSize;
46 assertion5( tarch::la::greaterEquals( timeStepSize, 0.0 ), timeStamp, timeStepSize, timeStampOldSolution, marker.toString(), fineGridFace{{SOLVER_NAME}}FaceLabel.toString() );
47 assertion5( tarch::la::greaterEquals( timeStamp, 0.0 ), timeStamp, timeStepSize, timeStampOldSolution, marker.toString(), fineGridFace{{SOLVER_NAME}}FaceLabel.toString() );
51 TemplateHandleBoundary_KernelCalls =
"""
52 ::exahype2::dg::applyBoundaryConditions(
54 const double * __restrict__ Qinside,
55 double * __restrict__ Qoutside,
56 const tarch::la::Vector<Dimensions,double>& x,
61 repositories::{{SOLVER_INSTANCE}}.boundaryConditions( Qinside, Qoutside, x, t, normal );
66 repositories::{{SOLVER_INSTANCE}}.getMinTimeStepSize(),
68 {{NUMBER_OF_UNKNOWNS}},
69 {{NUMBER_OF_AUXILIARY_VARIABLES}},
70 marker.getSelectedFaceNumber(),
71 repositories::{{SOLVER_INSTANCE}}.QuadraturePoints1d,
72 fineGridFace{{UNKNOWN_IDENTIFIER}}EstimateProjection.value
76 TemplateHandleBoundary_Epilogue =
"""
78 if (marker.getSelectedFaceNumber()<Dimensions) {
79 fineGridFace{{SOLVER_NAME}}FaceLabel.setUpdatedTimeStamp(0, fineGridFace{{SOLVER_NAME}}FaceLabel.getUpdatedTimeStamp(1) );
80 fineGridFace{{SOLVER_NAME}}FaceLabel.setNewTimeStamp (0, fineGridFace{{SOLVER_NAME}}FaceLabel.getNewTimeStamp(1) );
81 fineGridFace{{SOLVER_NAME}}FaceLabel.setOldTimeStamp (0, fineGridFace{{SOLVER_NAME}}FaceLabel.getOldTimeStamp(1) );
84 fineGridFace{{SOLVER_NAME}}FaceLabel.setUpdatedTimeStamp(1, fineGridFace{{SOLVER_NAME}}FaceLabel.getUpdatedTimeStamp(0) );
85 fineGridFace{{SOLVER_NAME}}FaceLabel.setNewTimeStamp( 1, fineGridFace{{SOLVER_NAME}}FaceLabel.getNewTimeStamp(0) );
86 fineGridFace{{SOLVER_NAME}}FaceLabel.setOldTimeStamp( 1, fineGridFace{{SOLVER_NAME}}FaceLabel.getOldTimeStamp(0) );
95 guard_project: String (C++ code)
96 Predicate which controls if the solution is actually projected
98 guard_safe_old_time_step: String (C++ code)
99 Predicate which controls if the projection should be copied into
100 the old solution and the time step should also be moved over
103 super(HandleBoundary, self).
__init__(solver)
110 raise Exception(
"Guards are not initialised")
117 and len(new_guards) != self.
_solver.number_of_Runge_Kutta_steps()
120 "Expect one guard per Runge Kutta step. Have {} steps but got guards {}".format(
121 solver.number_of_Runge_Kutta_steps(), guards
130 == peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME
133 self.
_solver._init_dictionary_with_default_parameters(d)
134 self.
_solver.add_entries_to_text_replacement_dictionary(d)
137 "BUTCHER_TABLEAU_RELATIVE_TIME_STEP_SIZES"
139 result = jinja2.Template(
148 return __name__.replace(
".py",
"").replace(
".",
"_")
The linear combination of the Runge Kutta trials has to be projected onto the faces,...
__init__(self, solver, guard)
guard_project: String (C++ code) Predicate which controls if the solution is actually projected
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
str TemplateHandleBoundary_Epilogue
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
str TemplateHandleBoundary_Prologue
str TemplateHandleBoundary_KernelCalls