3from .AbstractADERDGActionSet
import AbstractADERDGActionSet
6import peano4.solversteps
11 The linear combination of the Runge-Kutta trials has to be projected onto
12 the faces, so we can then solve the Riemann problems. So the projection
13 happens in one grid sweep, the corresponding Riemann solve in the next one.
16 _Template_HandleBoundary =
"""
18 const double timeStamp = fineGridFace{{SOLVER_NAME}}FaceLabel.getNewTimeStamp(marker.getSelectedFaceNumber() < Dimensions ? 1 : 0);
20 // Needs to declare and define timeStepSize
21 {{COMPUTE_TIME_STEP_SIZE}}
24 constexpr int SpaceFaceSize = {{ORDER}} + 1;
26 constexpr int SpaceFaceSize = ({{ORDER}} + 1) * ({{ORDER}} + 1);
29 constexpr int FluxElementsByFace = SpaceFaceSize * {{NUMBER_OF_UNKNOWNS}};
30 constexpr int BasisElementsByFace = SpaceFaceSize * ({{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}});
32 const int normal = marker.getSelectedFaceNumber() % Dimensions;
33 const bool isLeftFace = marker.getSelectedFaceNumber() < Dimensions;
35 {{CORRECTOR_COMPUTATION_PRECISION}}* FIn = fineGridFace{{UNKNOWN_IDENTIFIER}}FluxEstimates.value + (!isLeftFace ? 0 : FluxElementsByFace);
36 {{CORRECTOR_COMPUTATION_PRECISION}}* FOut = fineGridFace{{UNKNOWN_IDENTIFIER}}FluxEstimates.value + (!isLeftFace ? FluxElementsByFace : 0);
37 {{CORRECTOR_COMPUTATION_PRECISION}}* QIn = fineGridFace{{UNKNOWN_IDENTIFIER}}Estimates.value + (!isLeftFace ? 0 : BasisElementsByFace);
38 {{CORRECTOR_COMPUTATION_PRECISION}}* QOut = fineGridFace{{UNKNOWN_IDENTIFIER}}Estimates.value + (!isLeftFace ? BasisElementsByFace : 0);
40 tarch::la::Vector<Dimensions, double> faceOffset = marker.x() - 0.5 * marker.h();
41 faceOffset(normal) += 0.5 * marker.h()(normal);
43 dfore(dof, {{ORDER}} + 1, normal, 0) {
44 tarch::la::Vector<Dimensions, double> nodePosition;
45 int dofSerialised = 0;
47 for (int d = 0; d < Dimensions; d++) {
48 nodePosition(d) = faceOffset(d);
49 nodePosition(d) += (d == normal) ? 0.0 : kernels::{{SOLVER_NAME}}::Quadrature<{{SOLUTION_STORAGE_PRECISION}}>::nodes[dof(d)] * marker.h()(d);
50 dofSerialised += (d == normal) ? 0 : dof(d) * basis;
51 basis *= (d == normal) ? 1 : ({{ORDER}} + 1);
54 repositories::{{SOLVER_INSTANCE}}.boundaryConditions(
55 QIn + dofSerialised * ({{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}}),
56 QOut + dofSerialised * ({{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}}),
64 repositories::{{SOLVER_INSTANCE}}.flux(
65 QOut + dofSerialised * ({{NUMBER_OF_UNKNOWNS}} + {{NUMBER_OF_AUXILIARY_VARIABLES}}),
71 FOut + dofSerialised * {{NUMBER_OF_UNKNOWNS}}
74 // Not formally correct, should still be able to contain contributions from things such as sources, point sources etc.
75 // These must now be handled through the boundary conditions.
76 std::fill_n(FOut + dofSerialised * {{NUMBER_OF_UNKNOWNS}}, {{NUMBER_OF_UNKNOWNS}}, 0.0);
84 guard_project: String (C++ code)
85 Predicate which controls if the solution is actually projected
87 guard_safe_old_time_step: String (C++ code)
88 Predicate which controls if the projection should be copied into
89 the old solution and the time step should also be moved over
91 super(HandleBoundary, self).
__init__(solver)
98 == peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME
101 self.
_solver._init_dictionary_with_default_parameters(d)
102 self.
_solver.add_entries_to_text_replacement_dictionary(d)
103 d[
"PREDICATE"] = self.
_guard
108 return __name__.replace(
".py",
"").replace(
".",
"_")
The linear combination of the Runge-Kutta trials has to be projected onto the faces,...
get_includes(self)
Return include statements that you need.
str _Template_HandleBoundary
__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...
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.