GCC Code Coverage Report


Directory: ./
File: Solver/linearProblemNSSimplifiedFSI.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 9 10 90.0%
Branches: 0 0 -%

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:
13 //
14
15 #ifndef _LinearProblemNSSimplifiedFSI_HPP
16 #define _LinearProblemNSSimplifiedFSI_HPP
17
18 // System includes
19
20 // External includes
21
22 // Project includes
23 #include "Solver/linearProblemNS.hpp"
24 #include "Core/felisceParam.hpp"
25 #include "Core/felisceTools.hpp"
26 #include "FiniteElement/elementField.hpp"
27 #include "Solver/autoregulation.hpp"
28 #include "Geometry/curvatures.hpp"
29
30 namespace felisce {
31
32 class LinearProblemNSSimplifiedFSI:
33 public LinearProblemNS {
34 /*!
35 @{\name Generic
36 */
37 public:
38 LinearProblemNSSimplifiedFSI();
39 /*! \brief destructor
40 Do nothing-destructor
41 */
42 24 ~LinearProblemNSSimplifiedFSI() override= default;;
43 /*!@}*/
44 /*!
45 @{ \name Boundary condition
46 */
47 public:
48 void userElementInitNaturalBoundaryCondition() override;
49 void userElementComputeNaturalBoundaryCondition(const std::vector<Point*>& elemPoint, const std::vector<felInt>& elemIdPoint,felInt& iel, int label) override;
50 void applyEssentialBoundaryConditionDerivedProblem(int rank, FlagMatrixRHS flagMatrixRHS) override;
51 //!\brief getter of #m_lumpedModelBC
52 44 inline LumpedModelBC* lumpedModelBC() { return m_lumpedModelBC; }
53 protected:
54 std::unordered_map<std::string,std::vector<int> > m_label; //< ids of inlet,outlet,lateral surface
55 std::vector<felInt> m_embedLabels;
56 /*!@}*/
57 /*!
58 @{ \name Structure methods
59 */
60 public:
61 void initStructure();
62 void computeCurvatures();
63 void updateStructure();
64 void updateNormalVelocityAndCurrentDisplacement();
65 void computeScalarDisplacement(double& max, double& min);
66 private:
67 void computeGradUN(CurrentFiniteElementWithBd* fe ,felInt iel,felInt idVariable, std::vector<double> &gradUdotNdotN, int ibd, int icomp);
68 void computeMeanGradUN();
69 void computeTangentComponent();
70 void computeScalarNormalVelocity();
71 /*!@}*/
72 /*!
73 @{ \name Structure properties and parameters
74 */
75 public:
76 double m_betaS; //!<
77 double m_deltaT; //!< \brief time step
78 double m_fiberTensPassive; //!< \brief \f$k_{0,ref}\f$ the reference part of the fiber pre-stress
79 double m_fiberYoung; //!< \brief \f$k_{1,ref}\f$ the reference part of the fiber elastic modulus
80 std::vector<double> m_fiberDensity; //!< \brief Density of fibers by label (coefficient multiplying (m_fiberTensPassive+extraTension) and m_fiberYoung). The list is ordered as the labels defining the EmbedFSI type of BC.
81 std::map<int,int> m_label2embedFSI; //!< \brief gives the rank in the EmbedFSI list of a given label
82 private:
83 double m_densityS; //!< \brief density of the entire structure
84 double m_viscS; //!< \brief viscosity of the structure (not tested)
85 double m_widthS; //!< \brief entire thickness of the structure TODO change name
86 double m_youngS; //!< \brief young modulus of the koiter shell
87 double m_poissonS; //!< \brief poisson ratio of the entire structure
88 double m_alphaS; //!<
89 int m_nonLinear; //!< \brief 1: non-linear model, 0: linear model
90 protected:
91 double m_radius; //!< \brief radius of the structure (only in 2D)
92 /*!@}*/
93 /*!
94 @{ \name Autoregulation
95 */
96 public:
97 void handleWindkessel( const double& t);
98 double control( const double& t);
99 void updateControl (const double& time, const int& rank);
100 void exportControl (const int& rank);
101 inline Autoregulation* getAutoregulation() { return &m_autoregulation; }
102 void initializeAutoregulation( const int& nc );
103 4 inline void autoregulated( const bool& autoreg ){ m_autoregulated = autoreg; }
104 76 inline bool const& autoregulated() { return m_autoregulated;}
105 private:
106 double m_referencePressure; //!< \brief the pressure associated with no control
107 bool m_autoregulated; //!< \brief wether we are using autoregulation or not
108 protected:
109 Autoregulation m_autoregulation; //!< \brief class to handle autoregulation
110 /*!@}*/
111 /*!
112 @{ \name all the available computers: the functionOfTheLoop that can be called with function assemblyLoopBoundary()
113 */
114 void scalarComputer(felInt ielSupportDof);
115 void meanGradUNComputer(felInt ielSupportDof);
116 void normalVelocityScalarComputer(felInt ielSupportDof);
117 void curvaturesComputer(felInt ielSupportDof);
118 void normL2BoundaryDifferenceComputer(felInt ielSupportDof);
119 void scalarProductComputer(felInt ielSupportDof);
120 double computeL2ScalarProduct(std::string l, std::string r);
121 void testQuantitiesComputer(felInt ielSupportDof);
122 void testQuantitiesLumpedComputer(felInt ielSupportDof);
123
124 /*!@}*/
125 /*!
126 @{ \name Coupling with IOP
127 */
128 public:
129 void initializeDofBoundaryAndBD2VolMaps();
130 4 inline void coupled( const bool& coupled ){ m_iopCoupling = coupled; }
131 inline bool const& coupled() { return m_iopCoupling; }
132 void readIOPInterface(std::map<int,std::map<int, int> > mapIOP, PetscVector& seqCurrentIOP, std::map<int,int> labelMap, felInt rank);
133 double computeL2Difference(std::string current, std::string old = "zero");
134 void resetInterfaceQuantities();
135 std::pair<double,double> computeTestQuantities( bool lumped );
136 private:
137 bool m_iopCoupling; //!< \brief wether we are using the iop coupling or not
138 /*@}*/
139
140 /*!
141 @{ \name Element field for boundary condition and the curvature object
142 */
143 private:
144 ElementField m_normalFieldEF,
145 m_displacementEF,
146 m_displacementOldEF,
147 m_gradUNEF,
148 m_TgradUNEF,
149 m_iopEF,
150 m_koiterCoefficientsEF,
151 m_meanCurvEF,
152 m_firstLapCoeffEF,
153 m_secondLapCoeffEF,
154 m_thirdLapCoeffEF,
155 m_minLapFibersCoeffEF,
156 m_maxLapFibersCoeffEF,
157 m_etagradunEF;
158 Curvatures m_curv;
159 std::vector<double> m_auxiliaryDoubles;
160 std::vector<std::string> m_auxiliaryStrings;
161 /*@}*/
162
163 /*!
164 @{ \name small functions and some variables to use the assemblyLoopBoundaryGeneral
165 */
166 private:
167 template<class theClass> void assemblyLoopBoundary( void (theClass::*functionOfTheLoop)(felInt));
168 void initPerET();
169 void initPerETWBD();
170 void updateFe (const std::vector<Point*>& elemPoint,const std::vector<felInt>& elemIdPoint);
171 void updateFeWBD(const std::vector<Point*>& elemPoint,const std::vector<felInt>& elemIdPoint);
172
173 CurrentFiniteElementWithBd* m_curWBDFeVel;
174 /*@}*/
175 public:
176 332 inline DofBoundary& dofBD(std::size_t iBD) { return m_dofBD[iBD]; };
177
178 protected:
179 // Dof boundary utilities
180 std::vector<DofBoundary> m_dofBD = std::vector<DofBoundary>(1, DofBoundary());
181
182 public:
183 void initFixedPointAcceleration();
184 /// This two methods implement aitken acceleration algorithm to
185 /// speed up fixed point iteration.
186 /// First you call accelerationPreStep
187 /// and you pass the input that you are about to use
188 /// Than you use it and you obtain a new input
189 /// you pass this input to accelerationPostStep
190 /// To obtain a smarter input based on that.
191 void accelerationPreStep(PetscVector& seqCurrentInput);
192 void accelerationPostStep(PetscVector& seqCurrentInput,felInt cIteration);
193 private:
194 /// Different available techniques
195 enum accelerationType {
196 FixedPoint = 0, /*!< Standard fixed point iterations. We need only x1 and only for computing norm of update */
197 Relaxation = 1, /*!< Relaxed fixed point iterations. We need only x1 */
198 Aitken = 2, /*!< Aitken acceleration. We need only x0,x1,fx0,fx1 */
199 IronsTuck = 3 /*!< Variant of Aitken acceleration. We need only x0,x1,fx0,fx1 */
200 };
201
202 accelerationType m_accMethod; ///< The acceleration method in use
203 double m_omegaAcceleration; ///< Accelaration parameter, computed during acceleration or setted
204 };
205
206 /*!
207 \brief this function it is a generic assembly loop on the boundary elements where EmbedFSI conditions are imposed.
208 */
209 template<class theClass>
210 440 inline void LinearProblemNSSimplifiedFSI::assemblyLoopBoundary( void (theClass::*functionOfTheLoop)( felInt ) ) {
211 440 this->assemblyLoopBoundaryGeneral(functionOfTheLoop,m_embedLabels,&LinearProblemNSSimplifiedFSI::initPerET,&LinearProblemNSSimplifiedFSI::updateFe);
212 440 }
213 }
214
215 #endif
216