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< repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution, double > projection =
25 repositories::{{SOLVER_INSTANCE}}.getRiemannMatrix() * fineGridFace{{SOLVER_NAME}}.getProjection();
27 for (int i=0; i<repositories::{{SOLVER_INSTANCE}}.FaceUnknownsSolution; i++)
28 fineGridFace{{SOLVER_NAME}}.setSolution(
30 (1-repositories::{{SOLVER_INSTANCE}}.OmegaFace)*fineGridFace{{SOLVER_NAME}}.getSolution(i)
31 + repositories::{{SOLVER_INSTANCE}}.OmegaFace * projection(i)
33 logTraceOutWith1Argument( "updateFaceSolution::Interior", fineGridFace{{SOLVER_NAME}}.getSolution() );
37 fineGridFace{{SOLVER_NAME}}.getType() == facedata::{{SOLVER_NAME}}::Type::Boundary
39 repositories::{{SOLVER_INSTANCE}}.updateFace()
41 logTraceInWith1Argument( "updateFaceSolution::InteriorPenalty", fineGridFace{{SOLVER_NAME}}.getProjection() );
42 // Essentially what we do here is fix the solution on the boundary to be
43 // the inner-side projection.
45 // skip halfway along the projection vector if we are on face 0 or 1
46 int startIndexProjection =
47 marker.getSelectedFaceNumber() < Dimensions ?
48 repositories::{{SOLVER_INSTANCE}}.NodesPerFace * repositories::{{SOLVER_INSTANCE}}.ProjectionsPerFaceNode :
51 auto boundaryMatrix = repositories::{{SOLVER_INSTANCE}}.getBoundaryConditionMatrix();
54 Here we do slightly messy matrix multiplication. We would just multiply the boundary matrix
55 by the projection vector, and place that into the solution, but here we only want to capture
56 half of the projection vector; the other half lies outside the computational domain and
59 for (int row=0; row<boundaryMatrix.rows(); row++)
61 double rowSolution = 0;
62 for (int col=0; col<boundaryMatrix.cols(); col++)
64 rowSolution += boundaryMatrix( row, col ) * fineGridFace{{SOLVER_NAME}}.getProjection( col + startIndexProjection );
66 // place this solution into the face
67 fineGridFace{{SOLVER_NAME}}.setSolution( row, rowSolution );
70 logTraceOut( "updateFaceSolution::InteriorPenalty");
79 descend_invocation_order=0,
81 super( UpdateFaceSolution, self ).
__init__(
82 descend_invocation_order,
86 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
87 self.
d[
"SOLVER_NAME"] = solver.typename()
91 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_FACE_FIRST_TIME:
99 Configure name of generated C++ action set
101 This action set will end up in the directory observers with a name that
102 reflects how the observer (initialisation) is mapped onto this action
103 set. The name pattern is ObserverName2ActionSetIdentifier where this
104 routine co-determines the ActionSetIdentifier. We make is reflect the
108 return __name__.replace(
".py",
"").replace(
".",
"_") +
"_UpdateFaceSolution"
113 The action set that Peano will generate that corresponds to this class
114 should not be modified by users and can safely be overwritten every time
115 we run the Python toolkit.
123 We need the solver repository in this action set, as we directly access
124 the solver object. We also need access to Peano's d-dimensional loops.
128#include "../repositories/SolverRepository.h"
129#include "peano4/utils/Loop.h"
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
get_action_set_name(self)
Configure name of generated C++ action set.
str templatetouchFaceFirstTime
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
__init__(self, solver, descend_invocation_order=0, parallel=True)
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
Action set (reactions to events)