LifeV
OneDFSIData.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 class for 1D model data handling.
30  *
31  * @version 1.0
32  * @date 01-07-2004
33  * @author Vincent Martin
34  *
35  * @version 2.0
36  * @date 12-04-2010
37  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
38  *
39  * @contributors Ricardo Ruiz-Baier <ricardo.ruiz@epfl.ch>
40  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
41  */
42 
43 #ifndef OneDFSIData_H
44 #define OneDFSIData_H
45 
46 
47 #include <Epetra_SerialComm.h>
48 
49 
50 #include <lifev/core/filter/GetPot.hpp>
51 #include <lifev/core/fem/TimeData.hpp>
52 #include <lifev/core/mesh/RegionMesh1DBuilders.hpp>
53 
54 #include <lifev/one_d_fsi/solver/OneDFSIDefinitions.hpp>
55 
56 #include <array>
57 
58 namespace LifeV
59 {
60 
61 //! OneDFSIData - Class which read and holds all the data for the One Dimensional Model Solver.
62 /*!
63  * @authors Vincent Martin, Cristiano Malossi
64  * @see Equations and networks of 1-D models \cite FormaggiaLamponi2003
65  * @see Geometrical multiscale coupling of 1-D models \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D \cite BonnemainMalossi2012LVAD
66  *
67  * <b>Physical Parameters</b>
68  *
69  * Main parameters: \f$A^0, \alpha, \beta_0, \beta_1, \gamma, K_r, \rho\f$.
70  *
71  * Euler equations:
72  *
73  * \f[
74  * \left\{\begin{array}{l}
75  * \displaystyle\frac{\partial A}{\partial t} + \frac{\partial Q}{\partial z} = 0, \\[2ex]
76  * \displaystyle\frac{\partial Q}{\partial t} +
77  * \alpha \frac{\partial}{\partial z}\left(\frac{Q^2}{A}\right) +
78  * \frac{A}{\rho}\frac{\partial P}{\partial z} + K_r \frac{Q}{A} = 0
79  * \end{array}\right.
80  * \f]
81  *
82  * with
83  *
84  * \f[
85  * P-P_\mathrm{ext} = \psi(A,A^0,\beta_0, \beta_1, \gamma) =
86  * \underbrace{\sqrt{\frac{\pi}{A^0}}\frac{h E}{1-\nu^2}}_{\beta_0} \left(\left(\frac{A}{A^0}\right)^{\beta_1}-1\right) +
87  * \underbrace{\frac{T \tan\phi}{4 \sqrt{\pi}}\frac{h E}{1-\nu^2}}_{\displaystyle\gamma} \frac{1}{A\sqrt{A}} \frac{\partial A}{\partial t},
88  * \f]
89  *
90  * <b>Linear Parameters</b>
91  *
92  * Parameters: \f$F_{11}, F_{12}, F_{21}, F_{22}, \lambda_1, \lambda_2\f$
93  *
94  * Equations:
95  *
96  * \f[
97  * \left\{\begin{array}{l}
98  * \displaystyle\frac{dU_1}{dt} + F_{11} \frac{dU_1}{dz} + F_{12} \frac{dU_2}{dz} = 0\\[2ex]
99  * \displaystyle\frac{dU_2}{dt} + F_{21} \frac{dU_1}{dz} + F_{22} \frac{dU_2}{dz} = 0
100  * \end{array}\right.
101  * \f]
102  *
103  *
104  * The flux matrix \f$\mathbf F = [F_{11}, F_{12}; F_{21}, F_{22}]\f$ has the eigenvalues \f$\lambda_1, \lambda_2\f$.
105  */
107 {
108 public:
109 
110  //! @name Type definitions
111  //@{
112 
115 
118 
119  // ScalVec SHOULD BE REPLACED EVERYWHERE BY EPETRAVECTOR FOR PARALLEL COMPUTATION
121  typedef std::array< Real, 2 > container2D_Type;
122 
124  {
128  };
129 
130  //@}
131 
132 
133  //! @name Constructors & Destructor
134  //@{
135 
136  //! Empty constructor
137  explicit OneDFSIData();
138 
139  //! Destructor
140  virtual ~OneDFSIData() {}
141 
142  //@}
143 
144 
145  //! @name Methods
146  //@{
147 
148  //! Setup method.
149  /*!
150  * @param dataFile GetPot dataFile
151  * @param section section in the dataFile
152  */
153  void setup ( const GetPot& dataFile, const std::string& section = "1D_Model" );
154 
155  //! <b>Deprecated</b> setup method. (<b>DO NOT USE THIS</b>)
156  /*!
157  * This method has been implemented for compatibility reason with some old applications.
158  * Please, for any new application use the setup method in place of this one. Future
159  * compatibility for this method is not guaranteed.
160  *
161  * @param dataFile GetPot dataFile
162  * @return section section in the dataFile
163  */
164  void LIFEV_DEPRECATED ( oldStyleSetup ( const GetPot& dataFile, const std::string& section = "1dnetwork" ) );
165 
166  //! Update all the physical coefficients
167  /*!
168  * This method can be called after any update in the physical coefficient.
169  * It recomputes the main coefficients \f$\alpha, \beta_0, \beta_1, \gamma, K_r\f$
170  */
171  void updateCoefficients();
172 
173  //! Compute the spatial derivative of a quantity at a node.
174  /*!
175  * Note: works only for homogeneous discretizations.
176  * @param vector the quantity vector
177  * @param iNode node
178  * @return spatial derivative
179  */
180  template< typename VectorType >
181  Real computeSpatialDerivativeAtNode ( const VectorType& vector, const UInt& iNode, const UInt& bcFiniteDifferenceOrder = 2 );
182 
183  //! Initialize linear parameters (<b>NOT WORKING</b>)
184  /*!
185  * The linearization of the Euler model yields
186  * \f[
187  * \begin{array}{l}
188  * \displaystyle F = [ Q; A c^2]\\[2ex]
189  * \displaystyle B = [ 0; k_R / A^0]\\[2ex]
190  * \displaystyle c = \sqrt{\frac{\beta_0\beta_1}{\rho} }
191  * \end{array}
192  * \f]
193  */
194  // void initializeLinearParameters();
195 
196  //! Make the vessel stiffer on the left side of interval [xl, xr]
197  /*!
198  * \cond \TODO improve doxygen description with latex equation and other features \endcond
199  * These routines change the elastic modulus along the vessel
200  *
201  * When x < alpha - delta/2, the Young modulus is E * factor
202  * When x > alpha + delta/2, the Young modulus is E
203  * When alpha - delta/2 < x < alpha + delta/2, the Young modulus changes
204  * smoothly from the larger to the smaller value, according to a
205  * polynomial law of order n.
206  *
207  * The grid size can be adapted (yesadaptive=1) in the nieghborhood of alpha,
208  * where the spatial derivative of the parameter will be maximum.
209  * However, the grid size is not allowed to be smaller than min_deltax
210  *
211  * \cond \TODO add doxygen description for the parameters \endcond
212  */
213  // void stiffenVesselLeft( const Real& xl, const Real& xr,
214  // const Real& factor, const Real& alpha,
215  // const Real& delta, const Real& n,
216  // const Real& minDeltaX=1, const UInt& yesAdaptive=0 );
217 
218  //! Make the vessel stiffer on the right side of interval [xl, xr]
219  /*!
220  * \sa stiffenVesselLeft
221  *
222  * \cond \TODO add doxygen description for the parameters \endcond
223  */
224  // void stiffenVesselRight( const Real& xl, const Real& xr,
225  // const Real& factor, const Real& alpha,
226  // const Real& delta, const Real& n,
227  // const Real& minDeltaX=1, const UInt& yesAdaptive=0 );
228 
229  //! Display some information about the model.
230  /*!
231  * @param output Stream where the informations must be printed
232  */
233  void showMe ( std::ostream& output = std::cout ) const;
234 
235  //@}
236 
237 
238  //! @name Set Methods
239  //@{
240 
241  //! Set the post-processing directory
242  /*!
243  * @param directory post-processing directory
244  */
245  void setPostprocessingDirectory ( const std::string& directory )
246  {
247  M_postprocessingDirectory = directory;
248  }
249 
250  //! Set the post-processing file name
251  /*!
252  * @param file post-processing file name
253  */
254  void setPostprocessingFile ( const std::string& file )
255  {
256  M_postprocessingFile = file;
257  }
258 
259  //! Set the area perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
260  /*!
261  * @param jacobianPerturbationArea area perturbation parameter
262  */
263  void setJacobianPerturbationArea ( const Real& jacobianPerturbationArea )
264  {
265  M_jacobianPerturbationArea = jacobianPerturbationArea;
266  }
267 
268  //! Set the flow rate perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
269  /*!
270  * @param jacobianPerturbationFlowRate flow rate perturbation parameter
271  */
272  void setJacobianPerturbationFlowRate ( const Real& jacobianPerturbationFlowRate )
273  {
274  M_jacobianPerturbationFlowRate = jacobianPerturbationFlowRate;
275  }
276 
277  //! Set the stress perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
278  /*!
279  * @param jacobianPerturbationStress stress perturbation parameter
280  */
281  void setJacobianPerturbationStress ( const Real& jacobianPerturbationStress )
282  {
283  M_jacobianPerturbationStress = jacobianPerturbationStress;
284  }
285 
286  //! Set data time container
287  /*!
288  * @param timeDataPtr shared_ptr to TimeData container
289  */
290  void setTimeData ( const timePtr_Type timeDataPtr )
291  {
292  M_timeDataPtr = timeDataPtr;
293  }
294 
295  //! Set the fluid density
296  /*!
297  * @param density fluid density
298  */
299  void setDensity ( const Real& density )
300  {
301  M_density = density;
302  }
303 
304  //! Set the fluid viscosity
305  /*!
306  * @param viscosity fluid viscosity
307  */
308  void setViscosity ( const Real& viscosity )
309  {
310  M_viscosity = viscosity;
311  }
312 
313  //! Set the wall density
314  /*!
315  * @param densityWall wall density
316  */
317  void setDensityWall ( const Real& densityWall )
318  {
319  M_densityWall = densityWall;
320  }
321 
322  //! Set the wall thickness
323  /*!
324  * @param i node id
325  * @param thickness wall thickness
326  */
327  void setThickness ( const Real& thickness, const UInt& i )
328  {
329  M_thickness[i] = thickness;
330  }
331 
332  //! Set the wall Young modulus
333  /*!
334  * @param young wall Young modulus
335  */
336  void setYoung ( const Real& young )
337  {
338  M_young = young;
339  }
340 
341  //! Set the wall Poisson number
342  /*!
343  * @param poisson wall Poisson number
344  */
345  void setPoisson ( const Real& poisson )
346  {
347  M_poisson = poisson;
348  }
349 
350  //! Set the wall external pressure
351  /*!
352  * @param externalPressure wall external pressure
353  */
354  void setExternalPressure ( const Real& externalPressure )
355  {
356  M_externalPressure = externalPressure;
357  }
358 
359  //! Set the venous pressure at the terminals
360  /*!
361  * @param venousPressure venous pressure at the terminals
362  */
363  void setVenousPressure ( const Real& venousPressure )
364  {
365  M_venousPressure = venousPressure;
366  }
367 
368  //! Set the reference area
369  /*!
370  * @param i node id
371  * @param area0 reference area
372  */
373  void setArea0 ( const Real& area0, const UInt& i )
374  {
375  M_area0[i] = area0;
376  }
377 
378  //! Set the wall \f$\beta_0\f$
379  /*!
380  * @param i node id
381  * @param beta0 wall \f$\beta_0\f$
382  */
383  void setBeta0 ( const Real& beta0, const UInt& i )
384  {
385  M_beta0[i] = beta0;
386  }
387 
388  //! Set the wall \f$\frac{d\beta_0}{dz}\f$
389  /*!
390  * @param i node id
391  * @param thickness wall \f$\frac{d\beta_0}{dz}\f$
392  */
393  void setdBeta0dz ( const Real& dBeta0dz, const UInt& i )
394  {
395  M_dBeta0dz[i] = dBeta0dz;
396  }
397 
398  //@}
399 
400 
401  //! @name Get Methods
402  //@{
403 
404  //! Get the physics type
405  /*!
406  * @return Physics type
407  */
409  {
410  return M_physicsType;
411  }
412 
413  //! Get the flux type
414  /*!
415  * @return Flux type
416  */
418  {
419  return M_fluxType;
420  }
421 
422  //! Get the source type
423  /*!
424  * @return Source type
425  */
427  {
428  return M_sourceType;
429  }
430 
431  //! Get data time container
432  /*!
433  * @return shared_ptr to TimeData container
434  */
436  {
437  return M_timeDataPtr;
438  }
439 
440  //! Get the mesh container
441  /*!
442  * @return shared_ptr to the mesh
443  */
445  {
446  return M_meshPtr;
447  }
448 
449  //! Get the length of the 1D segment
450  /*!
451  * @return length of the 1D segment
452  */
453  Real length() const
454  {
455  return M_meshPtr->pointList ( M_meshPtr->numVertices() - 1).x() - M_meshPtr->pointList ( 0 ).x();
456  }
457 
458  //! Get the number of elements in the 1D segment
459  /*!
460  * @return number of elements in the 1D segment
461  */
463  {
464  return M_meshPtr->numElements();
465  }
466 
467  //! Get the number of nodes in the 1D segment
468  /*!
469  * @return number of nodes in the 1D segment
470  */
472  {
473  return M_meshPtr->numPoints();
474  }
475 
476  //! Get the flag identifying if the wall is viscoelastic
477  /*!
478  * @return true if the wall is viscoelastic, false otherwise
479  */
480  const bool& viscoelasticWall() const
481  {
482  return M_viscoelasticWall;
483  }
484 
485  //! Get the viscoelastic coefficient \f$\gamma\f$
486  /*!
487  * @return viscoelastic coefficient \f$\gamma\f$
488  */
489  const Real& viscoelasticCoefficient ( const UInt& i ) const
490  {
491  return M_viscoelasticCoefficient[i];
492  }
493 
494  //! Get the flag identifying if the wall has inertia
495  /*!
496  * @return true if the wall has intertia, false otherwise
497  */
498  const bool& inertialWall() const
499  {
500  return M_inertialWall;
501  }
502 
503  //! Get the density of the wall
504  /*!
505  * @return density of the wall
506  */
507  const Real& densityWall() const
508  {
509  return M_densityWall;
510  }
511 
512  //! Get the inertial coefficient (to be defined)
513  /*!
514  * @return inertial coefficient (to be defined)
515  */
516  const Real& inertialModulus() const
517  {
518  return M_inertialModulus;
519  }
520 
521  //! Get the flag identifying if the wall has a longitudinal pre-stress
522  /*!
523  * @return true if the wall has a longitudinal pre-stress, false otherwise
524  */
525  const bool& longitudinalWall() const
526  {
527  return M_longitudinalWall;
528  }
529 
530  //! Get the post-processing directory
531  /*!
532  * @return post-processing directory
533  */
534  const std::string& postprocessingDirectory() const
535  {
536  return M_postprocessingDirectory;
537  }
538 
539  //! Get the post-processing file
540  /*!
541  * @return post-processing file
542  */
543  const std::string& postprocessingFile() const
544  {
545  return M_postprocessingFile;
546  }
547 
548  //! Get the imposed CFL condition
549  /*!
550  * @return imposed CFL condition
551  */
552  const Real& CFLmax() const
553  {
554  return M_CFLmax;
555  }
556 
557  //! Get the area perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
558  /*!
559  * @return area perturbation parameter
560  */
562  {
564  }
565 
566  //! Get the flow rate perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
567  /*!
568  * @return flow rate perturbation parameter
569  */
571  {
573  }
574 
575  //! Get the stress perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)
576  /*!
577  * @return stress perturbation parameter
578  */
580  {
582  }
583 
584  //! Get the fluid density
585  /*!
586  * @return fluid density
587  */
588  const Real& densityRho() const
589  {
590  return M_density;
591  }
592 
593  //! Get the fluid viscosity
594  /*!
595  * @return fluid viscosity
596  */
597  const Real& viscosity() const
598  {
599  return M_viscosity;
600  }
601 
602  //! Get the wall Young modulus
603  /*!
604  * @return wall Young modulus
605  */
606  const Real& young() const
607  {
608  return M_young;
609  }
610 
611  //! Get the wall Poisson number
612  /*!
613  * @return wall Poisson number
614  */
615  const Real& poisson() const
616  {
617  return M_poisson;
618  }
619 
620  //! Get the wall external pressure
621  /*!
622  * @return wall external pressure
623  */
624  const Real& externalPressure() const
625  {
626  return M_externalPressure;
627  }
628 
629  //! Get the venous pressure
630  /*!
631  * @return venous pressure.
632  */
633  const Real& venousPressure() const
634  {
635  return M_venousPressure;
636  }
637 
638  //! Get the Robertson correction coefficient (<b>Not tested: maybe wrong in the code</b>)
639  /*!
640  * @return Robertson correction coefficient
641  */
642  const Real& robertsonCorrection() const;
643 
644  //! Get the wall thickness
645  /*!
646  * @return wall thickness
647  */
648  const Real& thickness ( const UInt& i ) const
649  {
650  return M_thickness[i];
651  }
652 
653  //! Get the wall friction coefficient \f$K_r\f$
654  /*!
655  * @return wall friction coefficient \f$K_r\f$
656  */
657  const Real& friction() const
658  {
659  return M_friction;
660  }
661 
662  //! Get the reference area \f$A^0\f$
663  /*!
664  * @param i node id
665  * @return reference area \f$A^0\f$
666  */
667  const Real& area0 ( const UInt& i ) const
668  {
669  return M_area0[i];
670  }
671 
672  //! Get the Coriolis coefficient \f$\alpha\f$
673  /*!
674  * @param i node id
675  * @return Coriolis coefficient \f$\alpha\f$
676  */
677  const Real& alpha ( const UInt& i ) const
678  {
679  return M_alpha[i];
680  }
681 
682  //! Get the \f$\beta_0\f$ coefficient
683  /*!
684  * @param i node id
685  * @return \f$\beta_0\f$ coefficient
686  */
687  const Real& beta0 ( const UInt& i ) const
688  {
689  return M_beta0[i];
690  }
691 
692  //! Get the \f$\beta_1\f$ coefficient
693  /*!
694  * @param i node id
695  * @return \f$\beta_1\f$ coefficient
696  */
697  const Real& beta1 ( const UInt& i ) const
698  {
699  return M_beta1[i];
700  }
701 
702  //! Get \f$\frac{dA^0}{dz}\f$
703  /*!
704  * @param i node id
705  * @return \f$\frac{dA^0}{dz}\f$
706  */
707  const Real& dArea0dz ( const UInt& i ) const
708  {
709  return M_dArea0dz[i];
710  }
711 
712  //! Get \f$\frac{d\alpha}{dz}\f$
713  /*!
714  * @param i node id
715  * @return \f$\frac{d\alpha}{dz}\f$
716  */
717  const Real& dAlphadz ( const UInt& i ) const
718  {
719  return M_dAlphadz[i];
720  }
721 
722  //! Get \f$\frac{d\beta_0}{dz}\f$
723  /*!
724  * @param i node id
725  * @return \f$\frac{d\beta_0}{dz}\f$
726  */
727  const Real& dBeta0dz ( const UInt& i ) const
728  {
729  return M_dBeta0dz[i];
730  }
731 
732  //! Get \f$\frac{d\beta_1}{dz}\f$
733  /*!
734  * @param i node id
735  * @return \f$\frac{d\beta_1}{dz}\f$
736  */
737  const Real& dBeta1dz ( const UInt& i ) const
738  {
739  return M_dBeta1dz[i];
740  }
741 
742  //! Get the flux coefficient \f$F_{11}\f$ (used only in the linear problem)
743  /*!
744  * @param i node id
745  * @return \f$F_{11}\f$
746  */
747  const Real& flux11 ( const UInt& i ) const
748  {
749  return M_flux11[i];
750  }
751 
752  //! Get the flux coefficient \f$F_{12}\f$ (used only in the linear problem)
753  /*!
754  * @param i node id
755  * @return \f$F_{12}\f$
756  */
757  const Real& flux12 ( const UInt& i ) const
758  {
759  return M_flux12[i];
760  }
761 
762  //! Get the flux coefficient \f$F_{21}\f$ (used only in the linear problem)
763  /*!
764  * @param i node id
765  * @return \f$F_{21}\f$
766  */
767  const Real& flux21 ( const UInt& i ) const
768  {
769  return M_flux21[i];
770  }
771 
772  //! Get the flux coefficient \f$F_{22}\f$ (used only in the linear problem)
773  /*!
774  * @param i node id
775  * @return \f$F_{22}\f$
776  */
777  const Real& flux22 ( const UInt& i ) const
778  {
779  return M_flux22[i];
780  }
781 
782  //! Get the first eigenvector \f$\lambda_{1}\f$ (used only in the linear problem)
783  /*!
784  * @param i node id
785  * @return \f$\lambda_{1}\f$
786  */
787  const Real& celerity1 ( const UInt& i ) const
788  {
789  return M_celerity1[i];
790  }
791 
792  //! Get the second eigenvector \f$\lambda_{2}\f$ (used only in the linear problem)
793  /*!
794  * @param i node id
795  * @return \f$\lambda_{2}\f$
796  */
797  const Real& celerity2 ( const UInt& i ) const
798  {
799  return M_celerity2[i];
800  }
801 
802  //! Get the left eigenvector coefficient \f$L_{11}\f$ (used only in the linear problem)
803  /*!
804  * @param i node id
805  * @return \f$L_{11}\f$
806  */
807  const Real& leftEigenVector11 ( const UInt& i ) const
808  {
809  return M_celerity1LeftEigenvector1[i];
810  }
811 
812  //! Get the left eigenvector coefficient \f$L_{12}\f$ (used only in the linear problem)
813  /*!
814  * @param i node id
815  * @return \f$L_{12}\f$
816  */
817  const Real& leftEigenVector12 ( const UInt& i ) const
818  {
819  return M_celerity1LeftEigenvector2[i];
820  }
821 
822  //! Get the left eigenvector coefficient \f$L_{21}\f$ (used only in the linear problem)
823  /*!
824  * @param i node id
825  * @return \f$L_{21}\f$
826  */
827  const Real& leftEigenVector21 ( const UInt& i ) const
828  {
829  return M_celerity2LeftEigenvector1[i];
830  }
831 
832  //! Get the left eigenvector coefficient \f$L_{22}\f$ (used only in the linear problem)
833  /*!
834  * @param i node id
835  * @return \f$L_{22}\f$
836  */
837  const Real& leftEigenVector22 ( const UInt& i ) const
838  {
839  return M_celerity2LeftEigenvector2[i];
840  }
841 
842  //! Get the source coefficient \f$S_{10}\f$ (used only in the linear problem)
843  /*!
844  * @param i node id
845  * @return \f$S_{10}\f$
846  */
847  const Real& source10 ( const UInt& i ) const
848  {
849  return M_source10[i];
850  }
851 
852  //! Get the source coefficient \f$S_{20}\f$ (used only in the linear problem)
853  /*!
854  * @param i node id
855  * @return \f$S_{20}\f$
856  */
857  const Real& source20 ( const UInt& i ) const
858  {
859  return M_source20[i];
860  }
861 
862  //! Get the source coefficient \f$S_{11}\f$ (used only in the linear problem)
863  /*!
864  * @param i node id
865  * @return \f$S_{11}\f$
866  */
867  const Real& source11 ( const UInt& i ) const
868  {
869  return M_source11[i];
870  }
871 
872  //! Get the source coefficient \f$S_{12}\f$ (used only in the linear problem)
873  /*!
874  * @param i node id
875  * @return \f$S_{12}\f$
876  */
877  const Real& source12 ( const UInt& i ) const
878  {
879  return M_source12[i];
880  }
881 
882  //! Get the source coefficient \f$S_{21}\f$ (used only in the linear problem)
883  /*!
884  * @param i node id
885  * @return \f$S_{21}\f$
886  */
887  const Real& source21 ( const UInt& i ) const
888  {
889  return M_source21[i];
890  }
891 
892  //! Get the source coefficient \f$S_{22}\f$ (used only in the linear problem)
893  /*!
894  * @param i node id
895  * @return \f$S_{22}\f$
896  */
897  const Real& source22 ( const UInt& i ) const
898  {
899  return M_source22[i];
900  }
901 
902  //@}
903 
904 private:
905 
906  //! @name Private Methods
907  //@{
908 
909  //! Compute the linear interpolation of a general quantity.
910  /*!
911  * Very useful for tapering.
912  * @param vector interpolated vector
913  * @param dataFile data file
914  * @param quantity quantity
915  * @param defaultValue default value
916  * @param isArea flag identifying if the vector is an area (the linear interpolation is done on the radius)
917  */
918  void linearInterpolation ( scalarVector_Type& vector,
919  const GetPot& dataFile,
920  const std::string& quantity,
921  const Real& defaultValue,
922  const bool& isArea = false );
923 
924  //! Compute the derivatives of alpha, area0, beta0, and beta1 using centered differences.
926 
927  //! Reset all the containers.
928  void resetContainers();
929 
930  //@}
931 
932  //! Model
936 
937  //! Data containers for time and mesh
940 
941  //! Physical Wall Model
946 
951 
952  //! Miscellaneous
953  std::string M_postprocessingDirectory; //! full directory name (including path)
954  std::string M_postprocessingFile; //! output file name
956 
957  //! Jacobian perturbation
961 
962  //! Physical Parameters
965 
966  Real M_density; // Density rho (always taken constant along the vessel)
968 
972 
976 
978  Real M_friction; // Friction parameter
979 
981  scalarVector_Type M_alpha; // Coriolis coefficient (often called alpha)
982  scalarVector_Type M_beta0; // homogeneous to a pressure
983  scalarVector_Type M_beta1; // power coeff (>0, often=1/2)
984 
985  //! Derivatives of main coefficients
988  scalarVector_Type M_dBeta0dz; // homogeneous to a pressure
989  scalarVector_Type M_dBeta1dz; // power coeff (>0, often=1/2)
990 
991  //! Flux matrix
996 
997  //! Celerities of the linear problem (eigenvalues of the flux matrix)
1000 
1001  //! Eigenvector for first and second eigenvalue
1006 
1007  //! Source matrix
1014 };
1015 
1016 
1017 // ===================================================
1018 // Template implementation
1019 // ===================================================
1020 template< typename VectorType >
1021 inline Real
1022 OneDFSIData::computeSpatialDerivativeAtNode ( const VectorType& vector, const UInt& iNode, const UInt& bcFiniteDifferenceOrder )
1023 {
1024  // This method is coded only for homogeneous discretizations
1025 
1026  Real meanH = MeshUtility::MeshStatistics::computeSize (*M_meshPtr).meanH;
1027  switch ( bcFiniteDifferenceOrder )
1028  {
1029  case 1:
1030 
1031  // We use 1° order finite differences at the boundaries to compute the derivatives
1032  if ( iNode == 0 )
1033  {
1034  return ( -vector[0] + vector[1] ) / ( meanH );
1035  }
1036  else if ( iNode == M_meshPtr->numPoints() - 1 )
1037  {
1038  return ( vector[iNode] - vector[iNode - 1] ) / ( meanH );
1039  }
1040  else
1041  {
1042  return ( vector[iNode + 1] - vector[iNode - 1] ) / ( 2.0 * meanH );
1043  }
1044 
1045  break;
1046 
1047  case 2:
1048 
1049  // We use 2° order finite differences at the boundaries to compute the derivatives
1050  if ( iNode == 0 )
1051  {
1052  return ( -1.5 * vector[0] + 2.0 * vector[1] - 0.5 * vector[2] ) / ( meanH );
1053  }
1054  else if ( iNode == M_meshPtr->numPoints() - 1 )
1055  {
1056  return ( 1.5 * vector[iNode] - 2.0 * vector[iNode - 1] + 0.5 * vector[iNode - 2] ) / ( meanH );
1057  }
1058  else
1059  {
1060  return ( vector[iNode + 1] - vector[iNode - 1] ) / ( 2.0 * meanH );
1061  }
1062 
1063  break;
1064 
1065  default:
1066 
1067  std::cout << "!!! Warning: finite difference order \"" << bcFiniteDifferenceOrder << "\"not available!" << std::endl;
1068  return 0;
1069  }
1070 }
1071 
1072 } // LifeV namespace
1073 
1074 #endif //OneDFSIData_H
timePtr_Type dataTime() const
Get data time container.
RegionMesh< LinearLine > mesh_Type
const Real & venousPressure() const
Get the venous pressure.
std::string M_postprocessingDirectory
Miscellaneous.
void setVenousPressure(const Real &venousPressure)
Set the venous pressure at the terminals.
scalarVector_Type M_flux12
const std::string & postprocessingDirectory() const
Get the post-processing directory.
scalarVector_Type M_flux21
const Real & young() const
Get the wall Young modulus.
const OneDFSI::physicsType_Type & physicsType() const
Get the physics type.
const Real & leftEigenVector11(const UInt &i) const
Get the left eigenvector coefficient (used only in the linear problem)
const Real & source11(const UInt &i) const
Get the source coefficient (used only in the linear problem)
OneDFSIData()
Empty constructor.
Definition: OneDFSIData.cpp:51
scalarVector_Type M_celerity1LeftEigenvector2
void setup(const GetPot &dataFile, const std::string &section="1D_Model")
Setup method.
scalarVector_Type M_dAlphadz
scalarVector_Type M_alpha
const Real & CFLmax() const
Get the imposed CFL condition.
scalarVector_Type M_thickness
OneDFSIData - Class which read and holds all the data for the One Dimensional Model Solver...
const Real & source21(const UInt &i) const
Get the source coefficient (used only in the linear problem)
scalarVector_Type M_dArea0dz
Derivatives of main coefficients.
scalarVector_Type M_celerity2LeftEigenvector2
void setPostprocessingDirectory(const std::string &directory)
Set the post-processing directory.
scalarVector_Type M_flux11
Flux matrix.
scalarVector_Type M_source21
const Real & flux21(const UInt &i) const
Get the flux coefficient (used only in the linear problem)
bool M_computeCoefficients
Physical Parameters.
const Real & leftEigenVector12(const UInt &i) const
Get the left eigenvector coefficient (used only in the linear problem)
const Real & beta1(const UInt &i) const
Get the coefficient.
const Real & jacobianPerturbationFlowRate() const
Get the flow rate perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)...
Real length() const
Get the length of the 1D segment.
scalarVector_Type M_source12
const Real & jacobianPerturbationArea() const
Get the area perturbation parameter to compute the Jacobian matrix (in the Multiscale framework) ...
const Real & flux12(const UInt &i) const
Get the flux coefficient (used only in the linear problem)
void setJacobianPerturbationFlowRate(const Real &jacobianPerturbationFlowRate)
Set the flow rate perturbation parameter to compute the Jacobian matrix (in the Multiscale framework)...
virtual ~OneDFSIData()
Destructor.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
const Real & source20(const UInt &i) const
Get the source coefficient (used only in the linear problem)
const Real & poisson() const
Get the wall Poisson number.
void updateCoefficients()
Update all the physical coefficients.
const Real & beta0(const UInt &i) const
Get the coefficient.
const Real & externalPressure() const
Get the wall external pressure.
const Real & area0(const UInt &i) const
Get the reference area .
scalarVector_Type M_source20
void setArea0(const Real &area0, const UInt &i)
Set the reference area.
Real M_jacobianPerturbationStress
void updateInverseJacobian(const UInt &iQuadPt)
void resetContainers()
Reset all the containers.
const Real & thickness(const UInt &i) const
Get the wall thickness.
const Real & viscoelasticCoefficient(const UInt &i) const
Get the viscoelastic coefficient .
void setExternalPressure(const Real &externalPressure)
Set the wall external pressure.
std::shared_ptr< mesh_Type > meshPtr_Type
scalarVector_Type M_source11
OneDFSI::sourceTerm_Type M_sourceType
meshPtr_Type mesh() const
Get the mesh container.
void setJacobianPerturbationStress(const Real &jacobianPerturbationStress)
Set the stress perturbation parameter to compute the Jacobian matrix (in the Multiscale framework) ...
scalarVector_Type M_celerity1LeftEigenvector1
Eigenvector for first and second eigenvalue.
void setTimeData(const timePtr_Type timeDataPtr)
Set data time container.
scalarVector_Type M_viscoelasticCoefficient
const Real & dArea0dz(const UInt &i) const
Get .
const Real & robertsonCorrection() const
Get the Robertson correction coefficient (Not tested: maybe wrong in the code)
scalarVector_Type M_area0
const bool & longitudinalWall() const
Get the flag identifying if the wall has a longitudinal pre-stress.
scalarVector_Type M_celerity2LeftEigenvector1
const Real & densityWall() const
Get the density of the wall.
void showMe(std::ostream &output=std::cout) const
Initialize linear parameters (NOT WORKING)
const OneDFSI::sourceTerm_Type & sourceType() const
Get the source type.
void setViscosity(const Real &viscosity)
Set the fluid viscosity.
void setDensity(const Real &density)
Set the fluid density.
const Real & alpha(const UInt &i) const
Get the Coriolis coefficient .
const Real & celerity1(const UInt &i) const
Get the first eigenvector (used only in the linear problem)
const Real & jacobianPerturbationStress() const
Get the stress perturbation parameter to compute the Jacobian matrix (in the Multiscale framework) ...
void setThickness(const Real &thickness, const UInt &i)
Set the wall thickness.
std::string M_postprocessingFile
full directory name (including path)
scalarVector_Type M_beta0
scalarVector_Type M_beta1
const Real & leftEigenVector22(const UInt &i) const
Get the left eigenvector coefficient (used only in the linear problem)
const Real & celerity2(const UInt &i) const
Get the second eigenvector (used only in the linear problem)
void computeSpatialDerivatives()
Compute the derivatives of alpha, area0, beta0, and beta1 using centered differences.
void setYoung(const Real &young)
Set the wall Young modulus.
ublas::vector< Real > scalarVector_Type
const Real & dBeta1dz(const UInt &i) const
Get .
void linearInterpolation(scalarVector_Type &vector, const GetPot &dataFile, const std::string &quantity, const Real &defaultValue, const bool &isArea=false)
Compute the linear interpolation of a general quantity.
scalarVector_Type M_flux22
Real computeSpatialDerivativeAtNode(const VectorType &vector, const UInt &iNode, const UInt &bcFiniteDifferenceOrder=2)
Compute the spatial derivative of a quantity at a node.
scalarVector_Type M_dBeta1dz
const bool & viscoelasticWall() const
Get the flag identifying if the wall is viscoelastic.
UInt numberOfNodes() const
Get the number of nodes in the 1D segment.
scalarVector_Type M_celerity1
Celerities of the linear problem (eigenvalues of the flux matrix)
double Real
Generic real data.
Definition: LifeV.hpp:175
Real M_jacobianPerturbationArea
Jacobian perturbation.
std::array< Real, 2 > container2D_Type
const bool & inertialWall() const
Get the flag identifying if the wall has inertia.
std::shared_ptr< time_Type > timePtr_Type
const Real & inertialModulus() const
Get the inertial coefficient (to be defined)
scalarVector_Type M_source22
const Real & viscosity() const
Get the fluid viscosity.
void setDensityWall(const Real &densityWall)
Set the wall density.
const Real & flux22(const UInt &i) const
Get the flux coefficient (used only in the linear problem)
OneDFSI::physicsType_Type M_physicsType
Model.
const std::string & postprocessingFile() const
Get the post-processing file.
timePtr_Type M_timeDataPtr
Data containers for time and mesh.
#define LIFEV_DEPRECATED(func)
Definition: LifeV.hpp:117
const OneDFSI::fluxTerm_Type & fluxType() const
Get the flux type.
UInt numberOfElements() const
Get the number of elements in the 1D segment.
void setdBeta0dz(const Real &dBeta0dz, const UInt &i)
Set the wall .
void setPoisson(const Real &poisson)
Set the wall Poisson number.
const Real & leftEigenVector21(const UInt &i) const
Get the left eigenvector coefficient (used only in the linear problem)
const Real & source12(const UInt &i) const
Get the source coefficient (used only in the linear problem)
scalarVector_Type M_dBeta0dz
const Real & densityRho() const
Get the fluid density.
const Real & dBeta0dz(const UInt &i) const
Get .
scalarVector_Type M_source10
Source matrix.
Real M_jacobianPerturbationFlowRate
const Real & source22(const UInt &i) const
Get the source coefficient (used only in the linear problem)
OneDFSI::fluxTerm_Type M_fluxType
void setBeta0(const Real &beta0, const UInt &i)
Set the wall .
const Real & source10(const UInt &i) const
Get the source coefficient (used only in the linear problem)
Real M_CFLmax
output file name
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
const Real & friction() const
Get the wall friction coefficient .
const Real & dAlphadz(const UInt &i) const
Get .
void setPostprocessingFile(const std::string &file)
Set the post-processing file name.
meshPtr_Type M_meshPtr
const Real & flux11(const UInt &i) const
Get the flux coefficient (used only in the linear problem)
void setJacobianPerturbationArea(const Real &jacobianPerturbationArea)
Set the area perturbation parameter to compute the Jacobian matrix (in the Multiscale framework) ...
bool M_viscoelasticWall
Physical Wall Model.
scalarVector_Type M_celerity2
TimeData - Class for handling temporal discretization.
Definition: TimeData.hpp:61