LifeV
MultiscaleSolver.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 the Multiscale Solver
30  *
31  * @date 28-09-2009
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #ifndef MultiscaleSolver_H
38 #define MultiscaleSolver_H 1
39 
40 #include <lifev/multiscale/framework/MultiscaleDefinitions.hpp>
41 #include <lifev/multiscale/models/MultiscaleModelMultiscale.hpp>
42 
43 namespace LifeV
44 {
45 namespace Multiscale
46 {
47 
48 //! MultiscaleSolver - The Multiscale solver
49 /*!
50  * @author Cristiano Malossi
51  *
52  * @see Full description of the Geometrical Multiscale Framework: \cite Malossi-Thesis
53  * @see Methodology: \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D \cite Malossi2011Algorithms3D1DFSI \cite BlancoMalossi2012
54  * @see Applications: \cite Malossi2011Algorithms3D1DFSIAortaIliac \cite LassilaMalossi2012IdealLeftVentricle \cite BonnemainMalossi2012LVAD
55  *
56  * The MultiscaleSolver class provides a series of methods to create and
57  * solve a general Geometrical Multiscale problem.
58  */
60 {
61 public:
62 
63  //! @name Constructors & Destructor
64  //@{
65 
66  //! Constructor
67  explicit MultiscaleSolver();
68 
69  //! Destructor
70  virtual ~MultiscaleSolver() {}
71 
72  //@}
73 
74 
75  //! @name Methods
76  //@{
77 
78  //! Setup the problem
79  /*!
80  * @param fileName Name of the data file.
81  * @param problemName the name of the problem (used to save data in a specific folder).
82  * @param coresPerNode number of cores for each node (this is mandatory when running on clusters for a correct distribution of the models among the nodes).
83  */
84  void setupProblem ( const std::string& fileName, const std::string& problemName, const UInt& coresPerNode );
85 
86  //! Run the time-loop to solve the Multiscale problem
87  /*!
88  * If the provided reference solution is positive, the solver make also a check on the last computed solution.
89  * @param referenceSolution the reference coupling variables norm 2.
90  * @param tolerance the tolerance to check the reference solution with respect to the computed one.
91  * @return 0: EXIT_SUCCESS, 1: EXIT_FAILURE
92  */
93  bool solveProblem ( const Real& referenceSolution = -1., const Real& tolerance = 1e-8 );
94 
95  //! Display some information about the Multiscale problem (should be called after setupProblem)
96  void showMe() const;
97 
98  //@}
99 
100 
101  //! @name Set Methods
102  //@{
103 
104  //! Set the epetra communicator for the Multiscale problem
105  /*!
106  * @param comm Epetra communicator
107  */
109  {
110  M_comm = comm;
111  }
112 
113  //@}
114 
115 private:
116 
117  //! @name Unimplemented Methods
118  //@{
119 
120  MultiscaleSolver ( const MultiscaleSolver& solver );
121 
122  MultiscaleSolver& operator= ( const MultiscaleSolver& solver );
123 
124  //@}
125 
126 
127  //! @name Private methods
128  //@{
129 
130  //! Save CPU time at each time step
131  /*!
132  * @param totalCPUTime total CPU time of the iteration
133  * @param buildUpdateCPUTime CPU time to build/update the problem
134  * @param solveCPUTime CPU time to solve the problem
135  * @param updateSolutionCPUTime CPU time to update the solution of the problem
136  * @param saveCPUTime CPU time to save the solution
137  */
138  void saveCPUTime ( const Real& totalCPUTime, const Real& buildUpdateCPUTime, const Real& solveCPUTime,
139  const Real& updateSolutionCPUTime, const Real& saveCPUTime ) const;
140 
141  //! Import iteration number from the CPU file
142  void importIterationNumber();
143 
144  //@}
145 
146 
147  // The main model (can be a specific model or a Multiscale model)
149 
150  // Container of global data
152 
153  // Communicator
155 };
156 
157 } // Namespace multiscale
158 } // Namespace LifeV
159 
160 #endif /* MultiscaleSolver_H */
void showMe() const
Display some information about the Multiscale problem (should be called after setupProblem) ...
Displayer::commPtr_Type multiscaleCommPtr_Type
MultiscaleSolver & operator=(const MultiscaleSolver &solver)
std::shared_ptr< multiscaleData_Type > multiscaleDataPtr_Type
void importIterationNumber()
Import iteration number from the CPU file.
void updateInverseJacobian(const UInt &iQuadPt)
std::shared_ptr< multiscaleModel_Type > multiscaleModelPtr_Type
bool solveProblem(const Real &referenceSolution=-1., const Real &tolerance=1e-8)
Run the time-loop to solve the Multiscale problem.
void saveCPUTime(const Real &totalCPUTime, const Real &buildUpdateCPUTime, const Real &solveCPUTime, const Real &updateSolutionCPUTime, const Real &saveCPUTime) const
Save CPU time at each time step.
MultiscaleSolver(const MultiscaleSolver &solver)
double Real
Generic real data.
Definition: LifeV.hpp:175
void setCommunicator(const multiscaleCommPtr_Type &comm)
Set the epetra communicator for the Multiscale problem.
MultiscaleSolver - The Multiscale solver.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191