Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
Preconditioner_decl.hpp
1#ifndef Preconditioner_DECL_hpp
2#define Preconditioner_DECL_hpp
3
4#include "feddlib/problems/problems_config.h"
5#include "feddlib/core/General/DefaultTypeDefs.hpp"
6#include "feddlib/core/General/ExporterParaView.hpp"
7#include "feddlib/problems/abstract/MinPrecProblem.hpp"
8#include "feddlib/problems/abstract/Problem.hpp"
9#include "feddlib/problems/abstract/TimeProblem.hpp"
10#include "feddlib/problems/Solver/PrecOpFaCSI.hpp"
11#include "feddlib/problems/Solver/PrecBlock2x2.hpp"
12#include "feddlib/problems/specific/LaplaceBlocks.hpp"
13#include "feddlib/problems/specific/FSI.hpp"
14#include <Xpetra_ThyraUtils.hpp>
15#include <Thyra_PreconditionerBase.hpp>
16#include <Thyra_DefaultPreconditioner_decl.hpp>
17#include <Stratimikos_FROSch_def.hpp>
18//#include <Stratimikos_FROSch_def.hpp> // hier werden schon alle FROSch VK eingebunden
19#ifdef FEDD_HAVE_TEKO
20#include <Teko_StratimikosFactory.hpp>
21#include <Teko_StaticRequestCallback.hpp>
22#endif
23
32
33namespace FEDD {
34template <class SC , class LO , class GO , class NO >
35class Problem;
36template <class SC , class LO , class GO , class NO >
37class TimeProblem;
38template <class SC , class LO , class GO , class NO >
39class MinPrecProblem;
40template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
41class Preconditioner {
42
43public:
44
45 typedef Teuchos::RCP<Teuchos::Comm<int> > CommPtr_Type;
46 typedef Teuchos::RCP<const Teuchos::Comm<int> > CommConstPtr_Type;
47
48 typedef Problem<SC,LO,GO,NO> Problem_Type;
49 typedef TimeProblem<SC,LO,GO,NO> TimeProblem_Type;
50 typedef MinPrecProblem<SC,LO,GO,NO> MinPrecProblem_Type;
51 typedef Teuchos::RCP<Problem_Type> ProblemPtr_Type;
52 typedef Teuchos::RCP<TimeProblem_Type> TimeProblemPtr_Type;
53 typedef Teuchos::RCP<MinPrecProblem_Type> MinPrecProblemPtr_Type;
54 typedef Map<LO,GO,NO> Map_Type;
55 typedef Teuchos::RCP<Map<LO,GO,NO> > MapPtr_Type;
56 typedef Teuchos::RCP<const Map<LO,GO,NO> > MapConstPtr_Type;
57 typedef Teuchos::RCP<Thyra::PreconditionerBase<SC> > ThyraPrecPtr_Type;
58 typedef Teuchos::RCP<const Thyra::PreconditionerBase<SC> > ThyraPrecConstPtr_Type;
59 typedef Teuchos::RCP<Thyra::LinearOpBase<SC> > ThyraLinOpPtr_Type;
60 typedef Teuchos::RCP<const Thyra::LinearOpBase<SC> > ThyraLinOpConstPtr_Type;
61 typedef Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder > LinSolverBuilderPtr_Type;
62
63 typedef Mesh<SC,LO,GO,NO> Mesh_Type;
64 typedef Teuchos::RCP<Mesh_Type> MeshPtr_Type;
65 typedef Teuchos::RCP<const Mesh_Type> MeshConstPtr_Type;
66
67 typedef typename Problem_Type::DomainConstPtr_Type DomainConstPtr_Type;
68
69 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
70 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
71 typedef typename Problem_Type::MultiVectorConstPtr_Type MultiVectorConstPtr_Type;
72
73 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
74 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
75
76 typedef typename Problem_Type::Matrix_Type Matrix_Type;
77 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
78
79 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
80 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
81
82 typedef typename Problem_Type::BC_Type BC_Type;
83 typedef typename Problem_Type::BCConstPtr_Type BCConstPtr_Type;
84
85 Preconditioner(Problem_Type* problem);
86
87 Preconditioner(TimeProblem_Type* problem);
88
89 ~Preconditioner();
90
91 ThyraPrecPtr_Type getThyraPrec();
92
93 ThyraPrecConstPtr_Type getThyraPrecConst() const;
94
95 void setPreconditionerThyraFromLinOp( ThyraLinOpPtr_Type precLinOp );
96
97 void buildPreconditioner( std::string type="Monolithic" );
98
99 void initializePreconditioner( std::string type="Monolithic" );
100
101 void buildPreconditionerMonolithic( );
102
103 void buildPreconditionerMonolithicFSI( );
104
105 void initPreconditionerMonolithic( );
106
107 void initPreconditionerBlock( );
108
109#ifdef FEDD_HAVE_TEKO
110 void buildPreconditionerTeko( );
111
112 void setVelocityParameters( ParameterListPtr_Type parameterList, int coarseRanks );
113
114 void setPressureParameters( ParameterListPtr_Type parameterList, int coarseRanks );
115
116 ThyraLinOpConstPtr_Type getTekoOp();
117
118 void setVelocityMassMatrix(MatrixPtr_Type massMatrix) const;
119#endif
120
121 void buildPreconditionerFaCSI( std::string type );
122
123 void buildPreconditionerBlock2x2();
124
125 void setPressureMassMatrix(MatrixPtr_Type massMatrix) const;
126
127 void setFaCSIBCFactory( BCConstPtr_Type bcFactory ){ faCSIBCFactory_ = bcFactory; };
128
129 bool hasFaCSIBCFactory(){ return !faCSIBCFactory_.is_null(); };
130
131 BCConstPtr_Type getFaCSIBCFactory( ){ return faCSIBCFactory_; };
132
133 void exportCoarseBasis( );
134
135 void exportCoarseBasisFSI( );
136
137 bool isPreconditionerComputed() const{return precondtionerIsBuilt_;};
138
139private:
140 ThyraPrecPtr_Type thyraPrec_;
141 bool precondtionerIsBuilt_;
142 ProblemPtr_Type problem_;
143 TimeProblemPtr_Type timeProblem_;
144 Teuchos::RCP<Thyra::PreconditionerFactoryBase<SC> > precFactory_;
145#ifdef FEDD_HAVE_TEKO
146 ThyraLinOpConstPtr_Type tekoLinOp_;
147 mutable ThyraLinOpConstPtr_Type velocityMassMatrix_;
148#endif
149 // For FaCSI precondtioner
150 ThyraLinOpConstPtr_Type fsiLinOp_;
151 ThyraLinOpPtr_Type precFluid_;
152 ThyraLinOpPtr_Type precStruct_;
153 ThyraLinOpPtr_Type precGeo_;
154 MinPrecProblemPtr_Type probFluid_;
155 MinPrecProblemPtr_Type probSolid_;
156 MinPrecProblemPtr_Type probGeo_;
157 BCConstPtr_Type faCSIBCFactory_;
158
159 // For Stokes-type block diagonal and triangular precondtioner
160 ThyraLinOpPtr_Type precVelocity_;
161 ThyraLinOpPtr_Type precSchur_;
162 MinPrecProblemPtr_Type probVelocity_;
163 MinPrecProblemPtr_Type probSchur_;
164 mutable MatrixPtr_Type pressureMassMatrix_;
165
166 ParameterListPtr_Type pListPhiExport_;
167#define PRECONDITIONER_TIMER
168#ifdef PRECONDITIONER_TIMER
169 TimePtr_Type preconditionerTimer_;
170#endif
171};
172}
173#endif
Definition Map_decl.hpp:36
Definition Mesh_decl.hpp:25
Definition MinPrecProblem_decl.hpp:26
Definition Problem_decl.hpp:38
Definition TimeProblem_decl.hpp:33
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5