15 templateTouchFaceFirstTime=
"""
17 fineGridFace{{SOLVER_NAME}}.getType() == facedata::{{SOLVER_NAME}}::Type::Interior
19 repositories::{{SOLVER_INSTANCE}}.updateFace()
21 logTraceInWith2Arguments( "updateFaceSolution::Interior", fineGridFace{{SOLVER_NAME}}.getSolution(), marker.toString() );
23 // project the u^\pm into a temporary vector
24 tarch::la::Vector< 2*repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution, double > projections;
25 // alias for number of solutions
26 const int nSols = repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution;
27 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution; i++) {
28 projections[i] = fineGridFace{{SOLVER_NAME}}.getLProjection(i);
29 projections[i+nSols] = fineGridFace{{SOLVER_NAME}}.getRProjection(i);
32 // multiply by riemann matrix
33 auto faceSolutionUpdate = repositories::{{SOLVER_INSTANCE}}.applyRiemannMatrix( projections );
35 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution; i++)
36 fineGridFace{{SOLVER_NAME}}.setSolution(
38 (1-repositories::{{SOLVER_INSTANCE}}.OmegaFace)*fineGridFace{{SOLVER_NAME}}.getSolution(i)
39 + repositories::{{SOLVER_INSTANCE}}.OmegaFace * faceSolutionUpdate(i)
42 fineGridFace{{SOLVER_NAME}}.setLProjection( 0.0 );
43 fineGridFace{{SOLVER_NAME}}.setRProjection( 0.0 );
44 logTraceOutWith1Argument( "updateFaceSolution::Interior", fineGridFace{{SOLVER_NAME}}.getSolution() );
48 fineGridFace{{SOLVER_NAME}}.getType() == facedata::{{SOLVER_NAME}}::Type::Boundary
50 repositories::{{SOLVER_INSTANCE}}.updateFace()
52 logTraceInWith2Arguments( "updateFaceSolution::InteriorPenalty", fineGridFace{{SOLVER_NAME}}.getLProjection(), fineGridFace{{SOLVER_NAME}}.getRProjection() );
53 // Essentially what we do here is fix the solution on the boundary to be
54 // the inner-side projection.
56 // skip halfway along the projection vector if we are on face 0 or 1
57 int startIndexProjection =
58 marker.getSelectedFaceNumber() < Dimensions ?
59 repositories::{{SOLVER_INSTANCE}}.NodesPerFace * repositories::{{SOLVER_INSTANCE}}.ProjectionsPerFaceNode :
62 if ( marker.getSelectedFaceNumber() < Dimensions )
63 fineGridFace{{SOLVER_NAME}}.setSolution(
64 repositories::{{SOLVER_INSTANCE}}.applyBoundaryConditionMatrix(
65 fineGridFace{{SOLVER_NAME}}.getRProjection()
70 fineGridFace{{SOLVER_NAME}}.setSolution(
71 repositories::{{SOLVER_INSTANCE}}.applyBoundaryConditionMatrix(
72 fineGridFace{{SOLVER_NAME}}.getLProjection()
76 logTraceOut( "updateFaceSolution::InteriorPenalty");
85 descend_invocation_order=0,
87 super( UpdateFaceSolution, self ).
__init__(
88 descend_invocation_order,
92 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
93 self.
d[
"SOLVER_NAME"] = solver.typename()
97 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
105 Configure name of generated C++ action set
107 This action set will end up in the directory observers with a name that
108 reflects how the observer (initialisation) is mapped onto this action
109 set. The name pattern is ObserverName2ActionSetIdentifier where this
110 routine co-determines the ActionSetIdentifier. We make is reflect the
114 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_UpdateFaceSolution"
119 The action set that Peano will generate that corresponds to this class
120 should not be modified by users and can safely be overwritten every time
121 we run the Python toolkit.
129 We need the solver repository in this action set, as we directly access
130 the solver object. We also need access to Peano's d-dimensional loops.
134#include "../repositories/SolverRepository.h"
135#include "peano4/utils/Loop.h"
Action set (reactions to events)
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
str templateTouchFaceFirstTime
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
__init__(self, solver, descend_invocation_order=0, parallel=True)
get_action_set_name(self)
Configure name of generated C++ action set.