Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
TimeSteppingTools.hpp
1#ifndef TIMESTEPPINGTOOLS_hpp
2#define TIMESTEPPINGTOOLS_hpp
3
4#include "feddlib/core/FEDDCore.hpp"
5#include "feddlib/problems/problems_config.h"
6#include "feddlib/core/General/ExporterParaView.hpp"
7#include "feddlib/core/LinearAlgebra/BlockMatrix.hpp"
8#include "feddlib/core/General/ExporterTxt.hpp"
9
18
19namespace FEDD {
20
21
22class TimeSteppingTools {
23
24public:
25 typedef default_sc SC;
26 typedef default_lo LO;
27 typedef default_go GO;
28 typedef default_no NO;
29
30 typedef Matrix<SC,LO,GO,NO> Matrix_Type;
31 typedef Teuchos::RCP<Matrix_Type> MatrixPtr_Type;
32 typedef typename Matrix_Type::MapConstPtr_Type MapConstPtr_Type;
33
34 typedef BlockMatrix<SC,LO,GO,NO> BlockMatrix_Type;
35 typedef Teuchos::RCP<BlockMatrix_Type> BlockMatrixPtr_Type;
36
37 typedef MultiVector<SC,LO,GO,NO> MultiVector_Type;
38 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
39 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorConstPtr_Type;
40
41 typedef BlockMultiVector<SC,LO,GO,NO> BlockMultiVector_Type;
42 typedef Teuchos::RCP<BlockMultiVector_Type> BlockMultiVectorPtr_Type;
43 typedef Teuchos::Array<BlockMultiVectorPtr_Type> BlockMultiVectorPtrArray_Type;
44
45 typedef ExporterTxt ExporterTxt_Type;
46 typedef Teuchos::RCP<ExporterTxt_Type> ExporterTxtPtr_Type;
47
48 typedef typename Matrix_Type::CommConstPtr_Type CommConstPtr_Type;
49
50 enum timeSteppingType {NON_ADAPTIVE, ADAPTIVE} ;
51 enum errorType {EUCLIDIAN, L2} ;
52 /* --------------------------------------------------------------------------------- */
53 CommConstPtr_Type comm_;
54 ParameterListPtr_Type parameterList_;
55 int butcherTableNmb_;
56 int BDFNmb_;
57 timeSteppingType tsType_;
58 double tEnd_;
59 double dt_;
60 double t_;
61 /* adaptive variables*/
62 double dt_prev_;
63 double dt_adaptive_;
64 double rho_;
65 double tolAdaptive_;
66 double dtmin_;
67 double dtmax_;
68 int convOrder_;
69 errorType adaptiveError_;
70 int adaptiveCalculation_;
71 double error_;
72 double error_prev_;
73 /* Butcher table information*/
74 int stages_;
75 bool stifflyAcc_;
76 bool stifflyAccEmbedded_;
77 vec2D_dbl_ptr_Type butcherTable_;
78 vec_dbl_ptr_Type BDFInformation_;
79 vec_dbl_ptr_Type b_embedded_;
80 vec_dbl_ptr_Type gamma_vec_;
81 bool verbose_;
82 ExporterTxtPtr_Type exporterTxtTime_;
83 ExporterTxtPtr_Type exporterTxtDt_;
84 ExporterTxtPtr_Type exporterTxtError_;
85
86 int RKType_;
87 // Newmark-Variablen
88 double beta_;
89 double gamma_;
90
91 /* --------------------------------------------------------------------------------- */
92
93 TimeSteppingTools();
94
95 TimeSteppingTools(ParameterListPtr_Type parameterList , CommConstPtr_Type comm);
96
97 void setParameter();
98
99 void setTableInformationRK();
100
101 void setInformationBDF();
102
103 double getInformationBDF(int i);
104
105 void correctPressure(MultiVectorPtr_Type &newP, MultiVectorConstPtr_Type lastP);
106
107 int getBDFNumber();
108
109 double currentTime();
110
111 bool continueTimeStepping();
112
113 void calculateSolution(BlockMultiVectorPtr_Type &sol, BlockMultiVectorPtrArray_Type &rkSolVec, BlockMatrixPtr_Type massSystem, BlockMultiVectorPtr_Type solShort = Teuchos::null);
114
115 void adaptiveTimestep(BlockMultiVectorPtr_Type &sol, BlockMultiVectorPtrArray_Type &rkSolVec, BlockMatrixPtr_Type massSystem, BlockMultiVectorPtr_Type solShort);
116
117 void calculateNewDt(BlockMultiVectorPtr_Type &solDiff, BlockMatrixPtr_Type massSystem);
118
119 void advanceTime(bool printInfo=false);
120
121 void printInfo();
122
123 int getNmbStages();
124
125 double getButcherTableCoefficient(int row , int col);
126
127 double getButcherTableC(int row);
128
129 double get_dt();
130
131 double get_dt_prev();
132
133 void setupTxtExporter();
134
135 double get_beta();
136
137 double get_gamma();
138};
139}
140#endif
Definition BlockMatrix_decl.hpp:23
Definition BlockMultiVector_decl.hpp:25
Definition ExporterTxt.hpp:18
Definition Matrix_decl.hpp:32
Definition MultiVector_decl.hpp:36
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5