LifeV
OneDFSISolver.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  * @file
29  * @brief File containing a solver class for the 1D model.
30  *
31  * @version 1.0
32  * @date 01-10-2006
33  * @author Vincent Martin
34  * @author Tiziano Passerini
35  * @author Lucia Mirabella
36  *
37  * @version 2.0
38  * @author Gilles Fourestey <gilles.fourestey@epfl.ch>
39  * @date 01-08-2009
40  *
41  * @version 2.1
42  * @date 21-04-2010
43  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
44  *
45  * @contributors Simone Rossi <simone.rossi@epfl.ch>, Ricardo Ruiz-Baier <ricardo.ruiz@epfl.ch>
46  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
47  */
48 
49 
50 
51 #ifndef OneDFSISolver_H
52 #define OneDFSISolver_H
53 
54 #include <lifev/core/array/MatrixElemental.hpp>
55 #include <lifev/core/array/VectorElemental.hpp>
56 #include <lifev/core/fem/AssemblyElemental.hpp>
57 #include <lifev/core/fem/Assembly.hpp>
58 
59 #include <lifev/core/algorithm/SolverAztecOO.hpp>
60 #include <lifev/core/algorithm/SolverAmesos.hpp>
61 
62 #include <lifev/core/fem/FESpace.hpp>
63 
64 #include <lifev/one_d_fsi/fem/OneDFSIBCHandler.hpp>
65 #include <lifev/one_d_fsi/solver/OneDFSIDefinitions.hpp>
66 
67 
68 namespace LifeV
69 {
70 
71 //! OneDFSISolver - Solver class for the 1D model.
72 /*!
73  * @author Vincent Martin, Tiziano Passerini, Lucia Mirabella, Gilles Fourestey, Cristiano Malossi
74  * @see Equations and networks of 1-D models \cite FormaggiaLamponi2003
75  * @see Geometrical multiscale coupling of 1-D models \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D \cite BonnemainMalossi2012LVAD
76  *
77  * <b>EQUATIONS:</b> <BR>
78  * The conservative form of the generic hyperbolic problem is
79  *
80  * \f[
81  * \frac{\partial \mathbf U}{\partial t} + \frac{\partial \mathbf F(\mathbf U)}{\partial z} + \mathbf S(\mathbf U) = 0,
82  * \f]
83  *
84  * where \f$\mathbf U\f$ are the conservative variables, \f$\mathbf F\f$ the corresponding fluxes,
85  * and \f$\mathbf S\f$ represents the source terms.
86  *
87  * <b>NUMERICAL DISCRETIZATION:</b> <BR>
88  * We discretize the problem by a second-order Taylor--Galerkin scheme.
89  * Let us consider the time interval \f$[t^n, t^{n+1}]\f$, for \f$n=0,1,2,\dots\f$, with \f$t^n=n \Delta t$, $\Delta t\f$ being the time step.
90  * Given \f$ \mathbf U_h^n\f$ we compute \f$\mathbf U_h^{n+1}\f$ by using the following scheme
91  *
92  * \f[
93  * (\mathbf U^{n+1}_h,\varphi_h) = (\mathbf U^n_h,\varphi_h) + \Delta t \left( \mathbf F(\mathbf U^n_h)-
94  * \displaystyle\frac{\Delta t}{2} \displaystyle\frac{\partial \mathbf F(\mathbf U^n_h)}{\partial \mathbf U}\left(\mathbf S(\mathbf U^n_h)+
95  * \displaystyle\frac{\partial \mathbf F(\mathbf U^n_h)}{\partial z}\right), \displaystyle\frac{\partial \varphi_h}{\partial z}\right) +
96  * \Delta t \left( -\mathbf S(\mathbf U^n_h)+\displaystyle\frac{\Delta t}{2}
97  * \displaystyle\frac{\partial \mathbf S(\mathbf U^n_h)}{\partial \mathbf U}\left( \mathbf S(\mathbf U^n_h)+
98  * \displaystyle\frac{\partial \mathbf F(\mathbf U^n_h)}{\partial z}\right), \varphi_h\right).
99  * \f]
100  *
101  * <b>IMPLEMENTATION:</b> <BR>
102  * The implementation of the Taylor-Galerkin scheme is the following:
103  *
104  * <CODE>
105  * (Un+1, phi) = //! massFactor^{-1} * Un+1 <BR>
106  * (Un, phi) //! mass * U <BR>
107  * +dt * ( Fh(Un), dphi/dz ) //! grad * F(U) <BR>
108  * -dt^2/2 * (diffFh(Un) Sh(Un), dphi/dz ) //! gradDiffFlux(U) * S(U) <BR>
109  * +dt^2/2 * (diffSh(Un) dFh/dz(Un), phi ) //! divDiffSrc(U) * F(U) <BR>
110  * -dt^2/2 * (diffFh(Un) dFh/dz(Un), dphi/dz ) //!stiffDiffFlux(U) * F(U) <BR>
111  * -dt * ( Sh(Un), phi ) //! mass * S(U) <BR>
112  * +dt^2/2 * (diffSh(Un) Sh(Un), phi ) //! massDiffSrc(U) * S(U) <BR>
113  * </CODE>
114  *
115  * Let's define:
116  *
117  * \cond \TODO improve doxygen description with latex equation and other features \endcond
118  * <ol>
119  * <li> (\phi_i)_{i in nodes} is the basis of P1 (the "hat" functions)
120  * <li> (1_{i+1/2})_{i+1/2 in elements} is the basis of P0 (constant per element).
121  * The vertices of the element "i+1/2" are the nodes "i" and "i+1".
122  * </ol>
123  *
124  * Then:
125  *
126  * \cond \TODO improve doxygen description with latex equation and other features \endcond
127  * <ol>
128  * <li> Uh is in P1 : U = sum_{i in nodes} U_i phi_i
129  * <li> Fh(U) is in P1 : F(U) = sum_{i in nodes} F(U_i) phi_i
130  * <li> diffFh(U) is in P0 : diffFlux(U) = sum_{i+1/2 in elements} 1/2 { dF/dU(U_i) + dF/dU(U_i+1) } 1_{i+1/2}
131  * (means of the two extremal values of the cell)
132  * <li> dF/dz(U) = sum_{i in nodes} F(U_i) d(phi_i)/dz
133  * <li> Sh(U) is in P1 : S(U) = sum_{i in nodes} S(U_i) phi_i
134  * <li> diffSh(U) is in P0 : diffSrc(U) = sum_{i+1/2 in elements} 1/2 { dS/dU(U_i) + dS/dU(U_i+1) } 1_{i+1/2}
135  * (means of the two extremal values of the cell)
136  * </ol>
137  *
138  * <b>DEVELOPMENT NOTES:</b> <BR>
139  * The option taken here is to define the different tridiagonal matrix
140  * operators (div, grad, mass, stiff) and reconstruct them at each time
141  * step (as they depend on diffFlux and diffSrc). They are thus rebuilt
142  * at the element level and reassembled.
143  * Afterwards, there remains to do only some tridiagonal matrix vector
144  * products to obtain the right hand side. This procedure might appear a bit memory consuming (there are 18
145  * tridiagonal matrices stored), but it has the advantage of being
146  * very clear. If it is too costly, it should be quite easy to improve
147  * it.
148  */
150 {
151 public:
152 
153  //! @name Typedef & Enumerator
154  //@{
155 
158 
161 
164 
166  typedef data_Type::mesh_Type mesh_Type;
167 
168  typedef data_Type::container2D_Type container2D_Type;
169  typedef data_Type::scalarVector_Type scalarVector_Type;
171 
172  typedef FESpace< mesh_Type, MapEpetra > feSpace_Type;
174 
177 
180 
184 
188 
192 
193  typedef OneDFSI::bcLine_Type bcLine_Type;
194  typedef OneDFSI::bcSide_Type bcSide_Type;
195  typedef OneDFSI::bcType_Type bcType_Type;
196 
197  //@}
198 
199 
200  //! @name Constructors & Destructor
201  //@{
202 
203  //! Empty Constructor
204  /*!
205  * Need a call to: \c setCommunicator(), \c setProblem(), \c setFESpace()
206  */
207  explicit OneDFSISolver();
208 
209  //! Destructor
210  virtual ~OneDFSISolver() {}
211 
212  //@}
213 
214 
215  //! @name Methods
216  //@{
217 
218  //! Build constant matrices (mass and grad)
219  void buildConstantMatrices();
220 
221  //! Setup the solution using the default FESpace map.
222  /*!
223  * @param solution solution container
224  */
225  void setupSolution ( solution_Type& solution )
226  {
227  setupSolution ( solution, M_feSpacePtr->map() );
228  }
229 
230  //! Setup the solution using user defined FESpace map.
231  /*!
232  * @param solution solution container
233  * @param map map for initializing the solution vectors
234  * @param onlyMainQuantities if true setup only \f$Q\f$, \f$P\f$, and \f$\displaystyle\frac{A}{A^0}-1\f$
235  */
236  void setupSolution ( solution_Type& solution, const MapEpetra& map, const bool& onlyMainQuantities = false );
237 
238  //! Initialize all the variables of the solution to a reference condition with \f$Q=0\f$, \f$A=A^0\f$, and \f$P=P_\mathrm{ext}\f$
239  /*!
240  * @param solution the solution container
241  */
242  void initialize ( solution_Type& solution );
243 
244  //! Update the Riemann variables.
245  /*!
246  * @param solution the solution container is passed with \f$A^n\f$, \f$Q^n\f$ and it is updated with \f$W_1^n\f$, \f$W_2^n\f$
247  */
248  void computeW1W2 ( solution_Type& solution );
249 
250  //! Update the pressure.
251  /*!
252  * This method compute the value of the pressure (elastic and if necessary also viscoelastic)
253  * adding it to the solution.
254  * @param solution the solution container is passed with \f$A^n\f$, \f$Q^n\f$, \f$W_1^n\f$, \f$W_2^n\f$ and is updated with \f$P^n\f$
255  * @param timeStep time step
256  */
257  void computePressure ( solution_Type& solution, const Real& timeStep );
258 
259  //! Update the ratio between \f$A\f$ and \f$A^0\f$.
260  /*!
261  * @param solution the solution container is passed with \f$A^n\f$, is updated with \f$\displaystyle\frac{A}{A^0}-1\f$
262  */
263  void computeAreaRatio ( solution_Type& solution );
264 
265  //! Compute A from the area ratio: \f$\displaystyle\frac{A}{A^0}-1\f$.
266  /*!
267  * @param solution the solution container is passed with \f$\displaystyle\frac{A}{A^0}-1\f$ and is updated with \f$A^n\f$
268  */
269  void computeArea ( solution_Type& solution );
270 
271  //! Compute the right hand side
272  /*!
273  * @param solution the solution container
274  * @param timeStep the time step.
275  */
276  void updateRHS ( const solution_Type& solution, const Real& timeStep );
277 
278  //! Update convective term and BC. Then solve the linearized system
279  /*!
280  * @param bcH the BC handler
281  * @param time the time
282  * @param timeStep the time step
283  */
284  void iterate ( OneDFSIBCHandler& bcH, solution_Type& solution, const Real& time, const Real& timeStep );
285 
286  //! Apply the viscoelastic flow rate correction.
287  /*!
288  * To introduce the viscoelastic component of the wall within the formulation, we use an operator-splitting technique,
289  * where the flow rate is splitted into two components such that \f$Q = \hat{Q} + \tilde{Q}\f$, where \f$\hat{Q}\f$ is the solution
290  * of the pure elastic problem and \f$\tilde{Q}\f$ is the viscoelastic correction.
291  * On each time interval \f$[t^n, t^{n+1}]\f$ with \f$n \ge 0\f$, firstly we solve the elastic part for \f$\hat{Q}^{n+1}\f$, using \f$Q^n\f$
292  * to compute the contributions in such equation to the right hand side, and then we correct the flow rate by solving the following equation
293  * By using the mass conservation equation, we remove the time dependence from the viscoelastic wall term. The resulting problem is
294  *
295  * \f[
296  * \displaystyle\frac{1}{A}\displaystyle\frac{\partial \tilde{Q}}{\partial t} -
297  * \displaystyle\frac{\partial}{\partial z}\left(\displaystyle\frac{\gamma}{\rho A^{3/2}}\displaystyle\frac{\partial Q}{\partial z}\right) = 0,
298  * \f]
299  *
300  * which is closed by a proper set of homogeneous boundary conditions for \f$\tilde{Q}\f$.
301  * The corresponding finite element formulation reads: given \f$(A_h^{n+1},\hat{Q}_h^{n+1})\f$,
302  * find \f$\tilde{Q}_h^{n+1}\f$ such that
303  *
304  *
305  * \f[
306  * \left(\displaystyle\frac{\tilde{Q}^{n+1}_h}{A^{n+1}_h},\varphi_h\right) +
307  * \Delta t \left(\displaystyle\frac{\gamma}{\rho \left(A^{n+1}_h\right)^{3/2}}\displaystyle\frac{\partial \tilde{Q}^{n+1}_h}{\partial z},
308  * \displaystyle\frac{\partial \varphi_h}{\partial z}\right) = \left(\displaystyle\frac{\tilde{Q}^{n}_h}{A^{n+1}_h},\varphi_h\right) - \Delta t \left(\displaystyle\frac{\gamma}{\rho \left(A^{n+1}_h\right)^{3/2}}
309  * \displaystyle\frac{\partial \hat{Q}^{n+1}_h}{\partial z},\displaystyle\frac{\partial \varphi_h}{\partial z}\right)+
310  * \Delta t \left[\displaystyle\frac{\gamma}{\rho \left(A^{n+1}_h\right)^{3/2}}\displaystyle\frac{\partial\hat{Q}^{n+1}_h}{\partial z}\,\varphi_h\right]^L_0.
311  * \f]
312  *
313  * @param area area
314  * @param flowRate flow rate
315  * @param timeStep the time step
316  * @param bcH the BC handler
317  * @param updateSystemMatrix flag for the recomputation of the system matrix
318  * @return the viscoelastic flow rate correction \f$\tilde{Q}\f$
319  */
320  vector_Type viscoelasticFlowRateCorrection ( const vector_Type& newArea, const vector_Type& newElasticFlowRate,
321  const vector_Type& oldViscoelasticFlowRate, const Real& timeStep,
322  OneDFSIBCHandler& bcHandler, const bool& updateSystemMatrix = true );
323 
324  //! CFL computation (correct for constant mesh)
325  /*!
326  * @param solution the solution container
327  * @param timeStep the time step
328  * @return CFL
329  */
330  Real computeCFL ( const solution_Type& solution, const Real& timeStep ) const;
331 
332  //! Reset the output files
333  /*!
334  * @param solution the solution container
335  */
336  void resetOutput ( const solution_Type& solution );
337 
338  //! Save results on output files
339  /*!
340  * @param solution solution container
341  * @param time solution time
342  */
343  void postProcess ( const solution_Type& solution, const Real& time );
344 
345  //@}
346 
347 
348  //! @name Set Methods
349  //@{
350 
351  //! Set problem classes
352  /*!
353  * @param physicsPtr pointer to the physics class.
354  * @param fluxPtr pointer to the flux class.
355  * @param sourcePtr pointer to the source class.
356  */
357  void setProblem ( const physicsPtr_Type& physicsPtr,
358  const fluxPtr_Type& fluxPtr,
359  const sourcePtr_Type& sourcePtr );
360 
361  //! Set the communicator
362  /*!
363  * @param commPtr pointer to the Epetra MPI communicator
364  */
365  void setCommunicator ( const commPtr_Type& commPtr );
366 
367  //! Set the FEspace
368  /*!
369  * @param feSpacePtr pointer to the FE space
370  */
371  void setFESpace ( const feSpacePtr_Type& feSpacePtr );
372 
373  //! Set the linear solver
374  /*!
375  * @param linearSolverPtr pointer to the linear solver for the hyperbolic problem
376  */
377  void setLinearSolver ( const linearSolverPtr_Type& linearSolverPtr );
378 
379  //! Set the viscoelastic linear solver
380  /*!
381  * @param linearViscoelasticSolverPtr pointer to the linear solver for the viscoelastic problem
382  */
383  void setLinearViscoelasticSolver ( const linearSolverPtr_Type& linearViscoelasticSolverPtr );
384 
385  //@}
386 
387 
388  //! @name Get Methods
389  //@{
390 
391  //! Get the physics class
392  /*!
393  * @return shared pointer to the physics class.
394  */
395  const physicsPtr_Type& physics() const
396  {
397  return M_physicsPtr;
398  }
399 
400  //! Get the flux class
401  /*!
402  * @return shared pointer to the flux class.
403  */
404  const fluxPtr_Type& flux() const
405  {
406  return M_fluxPtr;
407  }
408 
409  //! Get the source class
410  /*!
411  * @return shared pointer to the source class.
412  */
413  const sourcePtr_Type& source() const
414  {
415  return M_sourcePtr;
416  }
417 
418  //! Return the ID of the boundary node given a side.
419  /*!
420  * @param bcSide Side of the boundary.
421  * @return ID of the boundary node.
422  */
423  UInt boundaryDOF ( const bcSide_Type& bcSide ) const;
424 
425  //! Return the value of a quantity (\f$P\f$, \f$A\f$, \f$Q\f$, \f$W_1\f$, \f$W_2\f$) on a specified boundary.
426  /*!
427  * Given a bcType and a bcSide it return the value of the quantity.
428  * @param bcType Type of the asked boundary value.
429  * @param bcSide Side of the boundary.
430  * @return value of the quantity on the specified side.
431  */
432  Real boundaryValue ( const solution_Type& solution, const bcType_Type& bcType, const bcSide_Type& bcSide ) const;
433 
434  //! Return the value of the eigenvalues and eigenvectors on a specified boundary.
435  /*!
436  * @param bcSide Side of the boundary.
437  * @param solution solution container.
438  * @param eigenvalues output eigenvalues.
439  * @param leftEigenvector1 output left eigenvector associated to the first eigenvalue.
440  * @param leftEigenvector1 output left eigenvector associated to the second eigenvalue.
441  */
442  void boundaryEigenValuesEigenVectors ( const bcSide_Type& bcSide, const solution_Type& solution,
443  container2D_Type& eigenvalues,
444  container2D_Type& leftEigenvector1,
445  container2D_Type& leftEigenvector2 );
446 
447  //! Get the residual container
448  /*!
449  * @return System residual container
450  */
452  {
453  return M_residual;
454  }
455 
456  //! Get the system matrix without BC
457  /*!
458  * @return shared pointer to the system matrix without BC
459  */
460  const matrixPtr_Type& massMatrix() const
461  {
463  }
464 
465  //@}
466 
467 private:
468 
469  //! @name Private Methods
470  //@{
471 
472  //! Update the P1 flux vector from U: M_fluxi = F_h(Un) i=1,2 (works only for P1Seg elements)
473  /*!
474  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
475  */
476  void updateFlux ( const solution_Type& solution );
477 
478  //! Call _updateFlux and update the P0 derivative of flux vector from U:
479  /*!
480  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
481  * M_diffFluxij = dF_h/dU(Un) i,j=1,2
482  * M_diffFluxij(elem) = 1/2 [ dF/dU(U(node1(elem))) + dF/dU(U(node2(elem))) ]
483  *
484  * (mean value of the two extremal values of dF/dU)
485  * BEWARE: works only for P1Seg elements
486  */
487  void updatedFdU ( const solution_Type& solution );
488 
489  //! Update the P1 source vector from U: M_sourcei = S_h(Un) i=1,2 (works only for P1Seg elements)
490  /*!
491  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
492  */
493  void updateSource ( const solution_Type& solution );
494 
495  //! Call _updateSource and update the P0 derivative of source vector from U:
496  /*!
497  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
498  * M_diffSrcij = dS_h/dU(Un) i,j=1,2
499  * M_diffSrcij(elem) = 1/2 [ dS/dU(U(node1(elem))) + dS/dU(U(node2(elem))) ]
500  *
501  * (mean value of the two extremal values of dS/dU)
502  * BEWARE: works only for P1Seg elements
503  */
504  void updatedSdU ( const solution_Type& solution );
505 
506  //! Update the matrices
507  /*!
508  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
509  *
510  * M_massMatrixDiffSrcij, M_stiffMatrixDiffFluxij
511  * M_gradMatrixDiffFluxij, and M_divMatrixDiffSrcij (i,j=1,2)
512  *
513  * from the values of diffFlux(Un) and diffSrc(Un)
514  * that are computed with _updateMatrixCoefficients.
515  *
516  * call of _updateMatrixCoefficients,
517  * _updateMatrixElementalrices and _assemble_matrices.
518  */
519  void updateMatrices();
520 
521  //! Update the element matrices with the current element
522  /*!
523  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
524  */
525  void updateElementalMatrices ( const Real& dFdU, const Real& dSdU );
526 
527  //! Assemble the matrices
528  /*!
529  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
530  */
531  void matrixAssemble ( const UInt& ii, const UInt& jj );
532 
533  //! Update the matrices to take into account Dirichlet BC.
534  /*!
535  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
536  * Modify the matrix to take into account
537  * the Dirichlet boundary conditions
538  * (works for P1Seg and canonic numbering!)
539  */
540  void applyDirichletBCToMatrix ( matrix_Type& matrix );
541 
542  //! Apply the inertial Flux correction:
543  /*!
544  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
545  *
546  * We use a finite element scheme for the correction term:
547  * given the solution of Taylor-Galerkin scheme, solve
548  * ( 1/Ah(n+1) Qtildeh(n+1), phi) + //! 1/A * massFactor^{-1} * Un+1
549  * ( m / rho ) * ( dQtildeh(n+1)/dz, dphi/dz ) //! stiff * Qtilde(U)
550  * = ( m / rho ) * ( dQhath(n+1)/dz, dphi/dz ) //! stiff * Qhat(U)
551  *
552  * m = rho_w h0 / ( 2 sqrt(pi) sqrt(A0) )
553  */
555 
556  //! Apply the longitudinal Flux correction:
557  /*!
558  * \cond \TODO improve doxygen description with latex equation, input/output parameter, etc... \endcond
559  * We use a finite element scheme for the correction term:
560  * given the solution of Taylor-Galerkin scheme, solve
561  * ( 1/Ah(n+1) Qtildeh(n+1), phi) + //! 1/A * massFactor^{-1} * Un+1
562  * = ( 1/Ah(n+1) Qtildeh(n), phi) + //! 1/A * massFactor^{-1} * Un+1
563  * + ( a / rho ) * ( d3Ahath(n+1)/dz3, phi ) //! mass * d3Ahat(U)/dz
564  */
566 
567  //! L2 Projection of the second derivative of Q over P1 space.
568  //scalarVector_Type _compute_d2Q_dx2( const scalarVector_Type& );
569 
570  //@}
571 
578 
580  std::shared_ptr< MatrixElemental > M_elementalStiffnessMatrixPtr; //!< element stiffness matrix
581  std::shared_ptr< MatrixElemental > M_elementalGradientMatrixPtr; //!< element gradient matrix
582  std::shared_ptr< MatrixElemental > M_elementalDivergenceMatrixPtr; //!< element divergence matrix
583 
584  //! Right hand sides of the linear system i: "mass * M_Ui = M_rhsi"
586 
587  //! Residual of the linear system
589 
590  //! Flux F(U) (in P1)
592 
593  //! Source term S (in P1)
595 
596  //! diffFlux = dF(U)/dU (in P0)
598 
599  //! diffSrc = dSource(U)/dU (in P0)
601 
602  //! tridiagonal mass matrix
604 
605  //! tridiagonal gradient matrix
607 
608  //! tridiagonal mass matrices multiplied by diffSrcij
610 
611  //! tridiagonal stiffness matrices multiplied by diffFluxij
613 
614  //! tridiagonal gradient matrices multiplied by diffFluxij
616 
617  //! tridiagonal divergence matrices multiplied by diffSrcij
619 
620  //! The linear solver
623 
624 private:
625 
626  //! @name Unimplemented Methods
627  //@{
628 
629  explicit OneDFSISolver ( const OneDFSISolver& solver );
630 
631  OneDFSISolver& operator= ( const OneDFSISolver& solver );
632 
633  //@}
634 };
635 
636 }
637 
638 #endif // OneDFSISolver_H
sourcePtr_Type M_sourcePtr
void initialize(solution_Type &solution)
Initialize all the variables of the solution to a reference condition with , , and ...
RegionMesh< LinearLine > mesh_Type
void setLinearSolver(const linearSolverPtr_Type &linearSolverPtr)
Set the linear solver.
const vectorPtrContainer_Type & residual() const
Get the residual container.
void updatedSdU(const solution_Type &solution)
Call _updateSource and update the P0 derivative of source vector from U:
scalarVectorContainer_Type M_dFdUVector
diffFlux = dF(U)/dU (in P0)
matrixPtrContainer_Type M_dSdUMassMatrixPtr
tridiagonal mass matrices multiplied by diffSrcij
SolverAmesos linearSolver_Type
std::shared_ptr< MatrixElemental > M_elementalGradientMatrixPtr
element gradient matrix
linearSolverPtr_Type M_linearViscoelasticSolverPtr
OneDFSIPhysics - Base class providing physical operations for the 1D model data.
void updateRHS(const solution_Type &solution, const Real &timeStep)
Compute the right hand side.
virtual ~OneDFSISolver()
Destructor.
linearSolver_Type::matrix_type matrix_Type
std::shared_ptr< comm_Type > commPtr_Type
std::shared_ptr< solution_Type > solutionPtr_Type
std::array< matrixPtr_Type, 4 > matrixPtrContainer_Type
OneDFSIData - Class which read and holds all the data for the One Dimensional Model Solver...
vector_Type viscoelasticFlowRateCorrection(const vector_Type &newArea, const vector_Type &newElasticFlowRate, const vector_Type &oldViscoelasticFlowRate, const Real &timeStep, OneDFSIBCHandler &bcHandler, const bool &updateSystemMatrix=true)
Apply the viscoelastic flow rate correction.
VectorEpetra vector_type
std::shared_ptr< vector_Type > vectorPtr_Type
MatrixEpetra< Real > matrix_type
const fluxPtr_Type & flux() const
Get the flux class.
Real computeCFL(const solution_Type &solution, const Real &timeStep) const
CFL computation (correct for constant mesh)
std::array< scalarVector_Type, 4 > scalarVectorContainer_Type
solution_Type::const_iterator solutionConstIterator_Type
OneDFSIFlux - Base class for the flux term of the 1D hyperbolic problem.
Definition: OneDFSIFlux.hpp:63
std::shared_ptr< physics_Type > physicsPtr_Type
scalarVectorContainer_Type M_dSdUVector
diffSrc = dSource(U)/dU (in P0)
void buildConstantMatrices()
Build constant matrices (mass and grad)
linearSolverPtr_Type M_linearSolverPtr
The linear solver.
std::shared_ptr< MatrixElemental > M_elementalMassMatrixPtr
element mass matrix
OneDFSISource - Base class for the source term of the 1D hyperbolic problem.
std::shared_ptr< MatrixElemental > M_elementalStiffnessMatrixPtr
element stiffness matrix
void setCommunicator(const commPtr_Type &commPtr)
Set the communicator.
void setupSolution(solution_Type &solution)
Setup the solution using the default FESpace map.
OneDFSISolver()
Empty Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
void setProblem(const physicsPtr_Type &physicsPtr, const fluxPtr_Type &fluxPtr, const sourcePtr_Type &sourcePtr)
Set problem classes.
void updateMatrices()
Update the matrices.
void computeAreaRatio(solution_Type &solution)
Update the ratio between and .
void computePressure(solution_Type &solution, const Real &timeStep)
Update the pressure.
OneDFSISolver & operator=(const OneDFSISolver &solver)
matrixPtrContainer_Type M_dSdUDivergenceMatrixPtr
tridiagonal divergence matrices multiplied by diffSrcij
UInt boundaryDOF(const bcSide_Type &bcSide) const
Return the ID of the boundary node given a side.
linearSolver_Type::vector_type vector_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
Definition: MapEpetra.cpp:394
std::shared_ptr< matrix_Type > matrixPtr_Type
const matrixPtr_Type & massMatrix() const
Get the system matrix without BC.
void boundaryEigenValuesEigenVectors(const bcSide_Type &bcSide, const solution_Type &solution, container2D_Type &eigenvalues, container2D_Type &leftEigenvector1, container2D_Type &leftEigenvector2)
Return the value of the eigenvalues and eigenvectors on a specified boundary.
OneDFSISolver(const OneDFSISolver &solver)
std::array< vectorPtr_Type, 2 > vectorPtrContainer_Type
matrixPtrContainer_Type M_dFdUGradientMatrixPtr
tridiagonal gradient matrices multiplied by diffFluxij
const sourcePtr_Type & source() const
Get the source class.
void matrixAssemble(const UInt &ii, const UInt &jj)
Assemble the matrices.
vectorPtrContainer_Type M_residual
Residual of the linear system.
void setLinearViscoelasticSolver(const linearSolverPtr_Type &linearViscoelasticSolverPtr)
Set the viscoelastic linear solver.
void iterate(OneDFSIBCHandler &bcH, solution_Type &solution, const Real &time, const Real &timeStep)
Update convective term and BC. Then solve the linearized system.
Real boundaryValue(const solution_Type &solution, const bcType_Type &bcType, const bcSide_Type &bcSide) const
Return the value of a quantity ( , , , , ) on a specified boundary.
OneDFSIBCHandler - Class featuring methods to handle boundary conditions.
matrixPtr_Type M_homogeneousMassMatrixPtr
tridiagonal mass matrix
SolverAmesos - Class to wrap linear solver.
void updateSource(const solution_Type &solution)
Update the P1 source vector from U: M_sourcei = S_h(Un) i=1,2 (works only for P1Seg elements) ...
std::shared_ptr< flux_Type > fluxPtr_Type
ublas::vector< Real > scalarVector_Type
vector_Type longitudinalFlowRateCorrection()
Apply the longitudinal Flux correction:
std::shared_ptr< MatrixElemental > M_elementalDivergenceMatrixPtr
element divergence matrix
void applyDirichletBCToMatrix(matrix_Type &matrix)
Update the matrices to take into account Dirichlet BC.
matrixPtrContainer_Type M_dFdUStiffnessMatrixPtr
tridiagonal stiffness matrices multiplied by diffFluxij
double Real
Generic real data.
Definition: LifeV.hpp:175
std::map< std::string, vectorPtr_Type > solution_Type
feSpacePtr_Type M_feSpacePtr
std::array< Real, 2 > container2D_Type
std::shared_ptr< source_Type > sourcePtr_Type
std::shared_ptr< linearSolver_Type > linearSolverPtr_Type
OneDFSISolver - Solver class for the 1D model.
vectorPtrContainer_Type M_fluxVector
Flux F(U) (in P1)
void resetOutput(const solution_Type &solution)
Reset the output files.
const physicsPtr_Type & physics() const
Get the physics class.
void setFESpace(const feSpacePtr_Type &feSpacePtr)
Set the FEspace.
vectorPtrContainer_Type M_rhs
Right hand sides of the linear system i: "mass * M_Ui = M_rhsi".
void updatedFdU(const solution_Type &solution)
Call _updateFlux and update the P0 derivative of flux vector from U:
OneDFSIPhysics physics_Type
void computeArea(solution_Type &solution)
Compute A from the area ratio: .
FESpace< mesh_Type, MapEpetra > feSpace_Type
void setupSolution(solution_Type &solution, const MapEpetra &map, const bool &onlyMainQuantities=false)
Setup the solution using user defined FESpace map.
void updateFlux(const solution_Type &solution)
Update the P1 flux vector from U: M_fluxi = F_h(Un) i=1,2 (works only for P1Seg elements) ...
std::shared_ptr< feSpace_Type > feSpacePtr_Type
void postProcess(const solution_Type &solution, const Real &time)
Save results on output files.
matrixPtr_Type M_homogeneousGradientMatrixPtr
tridiagonal gradient matrix
physicsPtr_Type M_physicsPtr
L2 Projection of the second derivative of Q over P1 space.
void computeW1W2(solution_Type &solution)
Update the Riemann variables.
OneDFSISource source_Type
vectorPtrContainer_Type M_sourceVector
Source term S (in P1)
Displayer - This class is used to display messages in parallel simulations.
Definition: Displayer.hpp:62
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
void updateElementalMatrices(const Real &dFdU, const Real &dSdU)
Update the element matrices with the current element.
vector_Type inertialFlowRateCorrection(const vector_Type &)
Apply the inertial Flux correction: