12 Action set implementing the cell update of the continuous Galerkin solver
14 If you apply only this action set (and it makes sense to try this out to get
15 a better grip on what's going on), then you will obtain a result similar to
18 @image html UpdateCellWithoutBoundaryUpdates.png
20 The individual cells are all nicely updated, but the boundaries in-between
21 the cells are not updated at all. Effectively, we solve a set of tiny
22 boundary value problems that are decoupled from each other.
25 templateTouchCellFirstTime=
"""
27 fineGridCell{{SOLVER_NAME}}.getType() != celldata::{{SOLVER_NAME}}::Type::Coarse
29 // only one condition here - ensures that we don't do this when restricting the residual
30// repositories::{{SOLVER_INSTANCE}}.updateResidual()
32 logTraceInWith4Arguments("updateResidual",
33 fineGridCell{{SOLVER_NAME}}.getSolution(),
34 fineGridCell{{SOLVER_NAME}}.getRhs(),
36 repositories::{{SOLVER_INSTANCE}}.getRhsMatrix( marker.x(), marker.h() )
39 // Compute cell residual. Will be incomplete for boundary nodes
40 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.CellUnknowns, double > r =
41 repositories::{{SOLVER_INSTANCE}}.getRhsMatrix( marker.x(), marker.h() ) * fineGridCell{{SOLVER_NAME}}.getRhs();
42 r = r - repositories::{{SOLVER_INSTANCE}}.getLocalAssemblyMatrix(marker.x(), marker.h()) * fineGridCell{{SOLVER_NAME}}.getSolution();
44 // @todo This is not nice. As we already book the memory anyway, we should not
45 // allocate r and instead work directly against r. Alternatively, kick out the
46 // residual (as long as we are not in debug mode). That would actually be the
47 // prime version. Or at least make it not persistent.
48 fineGridCell{{SOLVER_NAME}}.setResidual( r );
50 tarch::la::Matrix<repositories::{{SOLVER_INSTANCE}}.InnerCellUnknowns, repositories::{{SOLVER_INSTANCE}}.InnerCellUnknowns, double>
51 innerMatrix = repositories::{{SOLVER_INSTANCE}}.NarrowToInteriorMatrix
52 * repositories::{{SOLVER_INSTANCE}}.getLocalAssemblyMatrix(marker.x(), marker.h())
53 * tarch::la::transpose(repositories::{{SOLVER_INSTANCE}}.NarrowToInteriorMatrix);
55 tarch::la::Vector< repositories::{{SOLVER_INSTANCE}}.CellUnknowns, double > du =
56 repositories::{{SOLVER_INSTANCE}}.OmegaCell
57 * tarch::la::transpose(repositories::{{SOLVER_INSTANCE}}.NarrowToInteriorMatrix)
58 * tarch::la::invert(innerMatrix)
59 * repositories::{{SOLVER_INSTANCE}}.NarrowToInteriorMatrix
62 fineGridCell{{SOLVER_NAME}}.setSolution(
63 fineGridCell{{SOLVER_NAME}}.getSolution()
68 repositories::{{SOLVER_INSTANCE}}.updateMinMaxMeshSize( marker.h() );
69 dfor( k, repositories::{{SOLVER_INSTANCE}}.PolyDegree-1 ) {
70 int i = peano4::utils::dLinearised( k + tarch::la::Vector< Dimensions, int >(1), repositories::{{SOLVER_INSTANCE}}.PolyDegree+1 );
71 repositories::{{SOLVER_INSTANCE}}.updateGlobalResidual( r(i), marker.h() );
72 repositories::{{SOLVER_INSTANCE}}.updateGlobalSolutionUpdates( du(i), marker.h() );
75 logTraceOut("updateResidual");
83 self.
d[
"SOLVER_INSTANCE"] = solver.instance_name()
84 self.
d[
"SOLVER_NAME"] = solver.typename()
88 if operation_name==peano4.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
96 Configure name of generated C++ action set
98 This action set will end up in the directory observers with a name that
99 reflects how the observer (initialisation) is mapped onto this action
100 set. The name pattern is ObserverName2ActionSetIdentifier where this
101 routine co-determines the ActionSetIdentifier. We make is reflect the
105 return __name__.replace(
".py",
"").replace(
".",
"_")
110 The action set that Peano will generate that corresponds to this class
111 should not be modified by users and can safely be overwritten every time
112 we run the Python toolkit.
120 We need the solver repository in this action set, as we directly access
121 the solver object. We also need access to Peano's d-dimensional loops.
125#include "../repositories/SolverRepository.h"
126#include "peano4/utils/Loop.h"
127#include "tarch/la/LUDecomposition.h"
Action set implementing the cell update of the continuous Galerkin solver.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_includes(self)
We need the solver repository in this action set, as we directly access the solver object.
user_should_modify_template(self)
The action set that Peano will generate that corresponds to this class should not be modified by user...
get_action_set_name(self)
Configure name of generated C++ action set.
str templateTouchCellFirstTime
Action set (reactions to events)