Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
FSI_decl.hpp
1#ifndef FSI_decl_hpp
2#define FSI_decl_hpp
3#include "feddlib/problems/abstract/TimeProblem.hpp"
4#include "feddlib/problems/specific/NavierStokes.hpp"
5#include "feddlib/problems/specific/LinElas.hpp"
6#include "feddlib/problems/specific/NonLinElasticity.hpp"
7#include "feddlib/problems/specific/Geometry.hpp"
8#include "feddlib/problems/Solver/TimeSteppingTools.hpp"
9#include <Xpetra_ThyraUtils.hpp>
10#include <Xpetra_CrsMatrixWrap.hpp>
11#include <Thyra_PreconditionerBase.hpp>
12#include <Thyra_ModelEvaluatorBase_decl.hpp>
13namespace FEDD{
14
15template <class SC , class LO , class GO , class NO >
16class TimeProblem;
17template <class SC , class LO , class GO , class NO >
18class Geometry;
19template <class SC , class LO , class GO , class NO >
20class NavierStokes;
21template <class SC , class LO , class GO , class NO >
22class LinElas;
23template <class SC , class LO , class GO , class NO >
25template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
26class FSI : public NonLinearProblem<SC,LO,GO,NO> {
27
28public:
29 typedef Problem<SC,LO,GO,NO> Problem_Type;
30 typedef typename Problem_Type::Matrix_Type Matrix_Type;
31 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
32
33 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
34 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
35
36 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
37 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
38 typedef typename Problem_Type::MultiVectorConstPtr_Type MultiVectorConstPtr_Type;
39 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
40 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
41
42 typedef typename Problem_Type::Domain_Type Domain_Type;
43 typedef Teuchos::RCP<Domain_Type > DomainPtr_Type;
44 typedef typename Problem_Type::DomainConstPtr_Type DomainConstPtr_Type;
45
46 typedef typename Problem_Type::Domain_Type::Mesh_Type Mesh_Type;
47 typedef typename Problem_Type::Domain_Type::MeshPtr_Type MeshPtr_Type;
48
49 typedef typename Problem_Type::CommConstPtr_Type CommConstPtr_Type;
50
51 typedef NonLinearProblem<SC,LO,GO,NO> NonLinearProblem_Type;
52
53 typedef typename NonLinearProblem_Type::BlockMultiVectorPtrArray_Type BlockMultiVectorPtrArray_Type;
54
55 typedef TimeProblem<SC,LO,GO,NO> TimeProblem_Type;
56 typedef Teuchos::RCP<TimeProblem_Type> TimeProblemPtr_Type;
57
58 typedef NavierStokes<SC,LO,GO,NO> FluidProblem_Type;
59 typedef LinElas<SC,LO,GO,NO> StructureProblem_Type;
60 typedef NonLinElasticity<SC,LO,GO,NO> StructureNonLinProblem_Type;
61 typedef Geometry<SC,LO,GO,NO> GeometryProblem_Type;
62
63 typedef Teuchos::RCP<FluidProblem_Type> FluidProblemPtr_Type;
64 typedef Teuchos::RCP<StructureProblem_Type> StructureProblemPtr_Type;
65 typedef Teuchos::RCP<StructureNonLinProblem_Type> StructureNonLinProblemPtr_Type;
66 typedef Teuchos::RCP<GeometryProblem_Type> GeometryProblemPtr_Type;
67
68 typedef typename Problem_Type::MapConstPtr_Type MapConstPtr_Type;
69
70 typedef typename Problem_Type::BC_Type BC_Type;
71 typedef typename Teuchos::RCP<BC_Type> BCPtr_Type;
72
73 typedef MeshUnstructured<SC,LO,GO,NO> MeshUnstr_Type;
74 typedef Teuchos::RCP<MeshUnstr_Type> MeshUnstrPtr_Type;
75
76 typedef ExporterParaView<SC,LO,GO,NO> Exporter_Type;
77 typedef Teuchos::RCP<Exporter_Type> ExporterPtr_Type;
78 typedef Teuchos::RCP<ExporterTxt> ExporterTxtPtr_Type;
79
80 typedef std::vector<GO> vec_GO_Type;
81 typedef std::vector<vec_GO_Type> vec2D_GO_Type;
82 typedef std::vector<vec2D_GO_Type> vec3D_GO_Type;
83 typedef Teuchos::RCP<vec3D_GO_Type> vec3D_GO_ptr_Type;
84
85 // FETypeVelocity muss gleich FETypeStructure sein, wegen Interface.
86 // Zudem wird FETypeVelocity auch fuer das Geometrieproblem genutzt.
87 FSI( const DomainConstPtr_Type &domainVelocity, std::string FETypeVelocity,
88 const DomainConstPtr_Type &domainPressure, std::string FETypePressure,
89 const DomainConstPtr_Type &domainStructure, std::string FETypeStructure,
90 const DomainConstPtr_Type &domainInterface, std::string FETypeInterface,
91 const DomainConstPtr_Type &domainGeometry, std::string FETypeGeometry,
92 ParameterListPtr_Type parameterListFluid, ParameterListPtr_Type parameterListStructure,
93 ParameterListPtr_Type parameterListFSI, ParameterListPtr_Type parameterListGeometry,
94 Teuchos::RCP<SmallMatrix<int> > &defTS );
95
96 ~FSI();
97
98 virtual void info();
99
100 virtual void assemble( std::string type = "" ) const;
101
102 void initializeGE();
103
104 void reAssemble( std::string type ) const;
105 // type = FixedPoint, Newton, ForTime, UpdateMeshDisplacement, SetPartialSolutions, SolveGeometryProblem,
106 // UpdateTime, UpdateFluidInTime
107// virtual void reAssemble(std::string type="FixedPoint") const;
108
109 // type = FluidMassmatrixAndRHS, StructureMassmatrixAndRHS
110 // In der Funktion wird massmatrix und rhs resetet.
111
112 virtual void reAssemble( BlockMultiVectorPtr_Type previousSolution ) const{};
113
114 virtual void reAssembleExtrapolation(BlockMultiVectorPtrArray_Type previousSolutions);
115
116 virtual void calculateNonLinResidualVec(std::string type="standard", double time=0.) const; //standard or reverse
117
118 virtual void getValuesOfInterest( vec_dbl_Type& values );
119
120 // init FSI vectors from partial problems
121 void setFromPartialVectorsInit() const;
122
123 // Setze die aktuelle Loesung als vergangene Loesung
124 void updateMeshDisplacement() const;
125
126 // Loese das Geometrieproblem. Das wird genutzt, wenn wir GE rechnen
127 void solveGeometryProblem() const;
128
129 // Berechnet die Massematrix und die daraus resultierende rechte Seite nach BDF2
130 // void getFluidMassmatrixAndRHSInTime(BlockMatrixPtr_Type massmatrix, BlockMultiVectorPtr_Type rhs) const;
131
132 // Berechne die Massematrix fuer das FluidProblem.
133 // Bei GE nur einmal pro Zeitschritt, bei GI in jeder nichtlinearen Iteration
134 void setFluidMassmatrix(MatrixPtr_Type& massmatrix) const;
135
136 // Berechne die rechte Seite nach BDF2-Integration. Diese Funktion wird
137 // einmal pro Zeitschritt aufgerufen
138 void computeFluidRHSInTime( ) const;
139
140 // Hier wird im Prinzip updateSolution() fuer problemTimeFluid_ aufgerufen
141 void updateFluidInTime() const;
142
143 // Berechnet die Massematrix und die daraus resultierende rechte Seite nach Newmark
144 // und macht direkt ein Update. Dies koennen wir bei Struktur machen, da Massematrix
145 // innerhalb einer Zeitschleife konstant ist.
146 void setSolidMassmatrix( MatrixPtr_Type& massmatrix ) const;
147
148 void computeSolidRHSInTime() const;
149
150 // Hier wird timeSteppingTool_->t_ inkrementiert
151 void updateTime() const;
152
153 // Verschiebt die notwendigen Gitter
154 void moveMesh() const;
155
156 // Fuegt den Block C2*d_s^n in die RHS in den Interface-Block
157 void addInterfaceBlockRHS() const;
158
159 // Macht setupTimeStepping() auf problemTimeFluid_ und problemTimeStructure_
160 void setupSubTimeProblems(ParameterListPtr_Type parameterListFluid, ParameterListPtr_Type parameterListStructure) const;
161
162 FluidProblemPtr_Type getFluidProblem(){
163 return problemFluid_;
164 }
165
166 StructureProblemPtr_Type getStructureProblem(){
167 return problemStructure_;
168 }
169
170 StructureNonLinProblemPtr_Type getNonLinStructureProblem(){
171 return problemStructureNonLin_;
172 }
173
174 GeometryProblemPtr_Type getGeometryProblem(){
175 return problemGeometry_;
176 }
177
178 // Berechnet von einer dofID, d.h. dim*nodeID+(0,1,2), die entsprechende nodeID.
179 // IN localDofNumber steht dann, ob es die x- (=0), y- (=1) oder z-Komponente (=2) ist.
180 void toNodeID(UN dim, GO dofID, GO& nodeID, LO& localDofNumber ) const
181 {
182 nodeID = (GO) (dofID/dim);
183 localDofNumber = (LO) (dofID%dim);
184 }
185
186 // Diese Funktion berechnet genau das umgekehrte. Also von einer nodeID die entsprechende dofID
187 void toDofID(UN dim, GO nodeID, LO localDofNumber, GO& dofID) const
188 {
189 dofID = (GO) ( dim * nodeID + localDofNumber);
190 }
191
192 void findDisplacementTurek2DBenchmark();
193
194 void findDisplacementRichter3DBenchmark();
195
196 void getValuesOfInterest2DBenchmark( vec_dbl_Type& values );
197
198 void getValuesOfInterest3DBenchmark( vec_dbl_Type& values );
199
200 virtual void computeValuesOfInterestAndExport();
201 /*####################*/
202
203 // Alternativ wie in reAssembleExtrapolation() in NS?
204
205 MultiVectorPtr_Type meshDisplacementOld_rep_;
206 MultiVectorPtr_Type meshDisplacementNew_rep_;
207 MultiVectorPtr_Type u_rep_;
208 MultiVectorPtr_Type w_rep_;
209 MultiVectorPtr_Type u_minus_w_rep_;
210 MultiVectorPtr_Type p_rep_;
211
212 mutable MatrixPtr_Type C2_;
213
214 mutable MatrixPtr_Type P_;
215 mutable int counterP;
216 // stationaere Systeme
217 FluidProblemPtr_Type problemFluid_;
218 StructureProblemPtr_Type problemStructure_;
219 StructureNonLinProblemPtr_Type problemStructureNonLin_; // CH: we want to combine both structure models to one general model later
220 GeometryProblemPtr_Type problemGeometry_;
221
222 // zeitabhaengige Systeme
223 mutable TimeProblemPtr_Type problemTimeFluid_;
224 mutable TimeProblemPtr_Type problemTimeStructure_;
225
226 Teuchos::RCP<SmallMatrix<int>> defTS_;
227 mutable Teuchos::RCP<TimeSteppingTools> timeSteppingTool_;
228
229private:
230 std::string materialModel_;
231 vec_dbl_Type valuesForExport_;
232 bool geometryExplicit_;
233 ExporterTxtPtr_Type exporterTxtDrag_;
234 ExporterTxtPtr_Type exporterTxtLift_;
235 mutable ExporterPtr_Type exporterGeo_;
236 /*####################*/
237
238public:
239 // NOX and FSI only implement in combination with TimeProblem
240
241// typedef Thyra::VectorSpaceBase<SC> thyra_vec_space;
242// typedef Thyra::VectorBase<SC> thyra_vec;
243// typedef Tpetra::Map<LO, GO, NO> tpetra_map;
244// typedef Tpetra::CrsMatrix<SC, LO, GO, NO> tpetra_matrix;
245// typedef Thyra::LinearOpBase<SC> thyra_op;
246// typedef Tpetra::Operator<SC,LO,GO,NO> tpetra_op;
247//
248
249// Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op() const;
250// Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Monolithic() const;
251//#ifdef FEDD_HAVE_TEKO
252// Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Block() const;
253//#endif
254// Teuchos::RCP<Thyra::PreconditionerBase<SC> > create_W_prec() const;
255
256private:
257
258 virtual void evalModelImpl(
259 const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
260 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs
261 ) const;
262
263// void evalModelImplMonolithic(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
264// const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs) const;
265//
266//#ifdef FEDD_HAVE_TEKO
267// void evalModelImplBlock(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
268// const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs) const;
269//#endif
270};
271}
272#endif
Definition ExporterParaView_decl.hpp:44
Definition Geometry_decl.hpp:7
Definition LinElas_decl.hpp:7
Definition MeshUnstructured_decl.hpp:31
Navier-Stokes.
Definition NavierStokes_decl.hpp:30
Definition NonLinElasticity_decl.hpp:17
Definition Problem_decl.hpp:38
This class represents a templated small Matrix of type T. Primarily created for 2x2 and 3x3 matrices....
Definition SmallMatrix.hpp:22
Definition TimeProblem_decl.hpp:33
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5