Line |
Branch |
Exec |
Source |
1 |
|
|
// ______ ______ _ _ _____ ______ |
2 |
|
|
// | ____| ____| | (_)/ ____| | ____| |
3 |
|
|
// | |__ | |__ | | _| (___ ___| |__ |
4 |
|
|
// | __| | __| | | | |\___ \ / __| __| |
5 |
|
|
// | | | |____| |____| |____) | (__| |____ |
6 |
|
|
// |_| |______|______|_|_____/ \___|______| |
7 |
|
|
// Finite Elements for Life Sciences and Engineering |
8 |
|
|
// |
9 |
|
|
// License: LGL2.1 License |
10 |
|
|
// FELiScE default license: LICENSE in root folder |
11 |
|
|
// |
12 |
|
|
// Main authors: E. Schenone |
13 |
|
|
// |
14 |
|
|
|
15 |
|
|
#ifndef _EIGENPROBLEMALPDEIM_HPP |
16 |
|
|
#define _EIGENPROBLEMALPDEIM_HPP |
17 |
|
|
|
18 |
|
|
// System includes |
19 |
|
|
|
20 |
|
|
// External includes |
21 |
|
|
|
22 |
|
|
// Project includes |
23 |
|
|
#include "Solver/eigenProblemALP.hpp" |
24 |
|
|
|
25 |
|
|
namespace felisce { |
26 |
|
|
/*! |
27 |
|
|
\class EigenProblemALPDeim |
28 |
|
|
\authors E. Schenone |
29 |
|
|
\date 23/07/2014 |
30 |
|
|
\brief Manage functions of a ALP-DEIM eigenvalues problem and ALP-DEIM-ROM solver. |
31 |
|
|
*/ |
32 |
|
|
|
33 |
|
|
class EigenProblemALPDeim: |
34 |
|
|
public EigenProblemALP { |
35 |
|
|
public: |
36 |
|
|
// Constructor |
37 |
|
|
//============ |
38 |
|
|
EigenProblemALPDeim(); |
39 |
|
|
~EigenProblemALPDeim() override; |
40 |
|
|
|
41 |
|
|
void initialize(const GeometricMeshRegion::Pointer& mesh, FelisceTransient::Pointer fstransient, MPI_Comm& comm) override; |
42 |
|
|
|
43 |
|
|
// Assemble Matrix |
44 |
|
|
//================ |
45 |
|
|
/// Update finite element with element vertices coordinates and compute operators. |
46 |
|
|
void initPerElementType() override; |
47 |
|
|
void computeElementArray(const std::vector<Point*>& elemPoint, const std::vector<felInt>& elemIdPoint, felInt& iel, FlagMatrixRHS flagMatrixRHS = FlagMatrixRHS::matrix_and_rhs) override; |
48 |
|
|
|
49 |
|
|
// Projection functions from collocation points space to RO one and viceversa |
50 |
|
|
using EigenProblemALP::projectOnDof; |
51 |
|
|
using EigenProblemALP::projectOnBasis; |
52 |
|
|
void projectOnBasis(double* vectorDof, double* vectorBasis, bool flagMass=true); |
53 |
|
|
void projectOnDof(double* vectorBasis, double* vectorDof, int size); |
54 |
|
|
|
55 |
|
|
void readData(IO& io) override; |
56 |
|
|
void readCollocationPts(); |
57 |
|
|
void initializeROM() override; |
58 |
|
|
void initializeSolution() override; |
59 |
|
|
|
60 |
|
|
using EigenProblemALP::MGS; |
61 |
|
|
void MGS(double** A, double** R, int size); |
62 |
|
|
void factorizationQR(double** A, double** Q, double** R, int sizeRow, int sizeCol); |
63 |
|
|
void inverseTriangular(double** A, double** Ainv, int sizeA); |
64 |
|
|
void computeMassDeim(); |
65 |
|
|
|
66 |
|
|
void computeProjectionPiV(); |
67 |
|
|
void writeEnsightSolution(const int iter) override; |
68 |
|
|
|
69 |
|
|
virtual void computeRHSDeim(); |
70 |
|
|
void computeTheta(); |
71 |
|
|
void computeMatrixM() override; |
72 |
|
|
void computeHatU(); |
73 |
|
|
|
74 |
|
|
void computeTensor() override; |
75 |
|
|
void ConjGrad(double** A, double* b, double* x, double tol, int maxIter, int n, bool sym=false); |
76 |
|
|
|
77 |
|
|
void setHeteroTauClose(std::vector<double>& valueTauClose) override; |
78 |
|
|
virtual void setHeteroTauOut(std::vector<double>& valueTauOut); |
79 |
|
|
void setFhNf0(std::vector<double>& valuef0) override; |
80 |
|
|
void setIapp(std::vector<double>& iapp, int& idS) override; |
81 |
|
|
|
82 |
|
|
//Update functions |
83 |
|
|
void updateBasis() override; |
84 |
|
|
void setPotential() override; |
85 |
|
|
void updateBeta(); |
86 |
|
|
void updateEigenvalue() override; |
87 |
|
|
|
88 |
|
|
void checkBasis(int size=0) override; |
89 |
|
|
void checkBasisCollocation(); |
90 |
|
|
|
91 |
|
|
// Write an ECG |
92 |
|
✗ |
void initializeECG() override {} |
93 |
|
✗ |
void writeECG(int /*iteration*/) override {} |
94 |
|
✗ |
void updateEcgOperator() override {} |
95 |
|
|
|
96 |
|
✗ |
void readMeasureEcgFilter() override {} |
97 |
|
|
|
98 |
|
|
protected: |
99 |
|
|
bool m_resPoint; |
100 |
|
|
CurrentFiniteElement* m_fePotExtraCell; |
101 |
|
|
felInt m_ipotExtraCell; |
102 |
|
|
felInt m_dimCollocationPts; |
103 |
|
|
felInt* m_collocationNode; |
104 |
|
|
double** m_basisDeimColloc; // W |
105 |
|
|
double** m_basisDeim; // \Phi |
106 |
|
|
double** m_orthCompDeim; // \Psi |
107 |
|
|
int m_improvedRecType; |
108 |
|
|
double* m_hatU; |
109 |
|
|
double* m_hatW; |
110 |
|
|
double* m_hatUe; |
111 |
|
|
double* m_potential; |
112 |
|
|
double** m_hatBasis; |
113 |
|
|
double** m_theta; |
114 |
|
|
double** m_thetaOrth; |
115 |
|
|
double** m_massDeim; |
116 |
|
|
double** m_stiffDeim; |
117 |
|
|
double** m_invGK; |
118 |
|
|
double* m_resU; |
119 |
|
|
std::vector<PetscVector> m_projectorPiV; |
120 |
|
|
std::vector<PetscVector> m_basisGrad; |
121 |
|
|
double* m_hatF; |
122 |
|
|
double* m_hatG; |
123 |
|
|
double** m_matrixA; |
124 |
|
|
double** m_matrixB; |
125 |
|
|
double* m_sumG; |
126 |
|
|
double* m_coefFhNs; |
127 |
|
|
double* m_coefTauClose; |
128 |
|
|
double* m_coefTauOut; |
129 |
|
|
ElementField m_elemFieldUe0; |
130 |
|
|
}; |
131 |
|
|
|
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
#endif |
135 |
|
|
|