36 #ifndef TIMEITERATIONPOLICYLINEAR_HPP 37 #define TIMEITERATIONPOLICYLINEAR_HPP 41 #include <boost/shared_ptr.hpp> 45 #include <Epetra_MpiComm.h> 47 #include <Epetra_SerialComm.h> 50 #include <Teuchos_ParameterList.hpp> 51 #include <Teuchos_XMLParameterListHelpers.hpp> 52 #include <Teuchos_RCP.hpp> 55 #include <lifev/core/LifeV.hpp> 56 #include <lifev/core/array/MatrixEpetra.hpp> 57 #include <lifev/core/array/VectorEpetra.hpp> 58 #include <lifev/core/util/Displayer.hpp> 59 #include <lifev/core/util/LifeChrono.hpp> 60 #include <lifev/core/mesh/RegionMesh.hpp> 61 #include <lifev/core/fem/FESpace.hpp> 62 #include <lifev/core/fem/TimeAdvanceBDF.hpp> 63 #include <lifev/core/fem/BCHandler.hpp> 64 #include <lifev/navier_stokes/solver/NavierStokesSolver/SolverPolicyLinearSolver.hpp> 94 const Real& currentTime );
108 template<
class mesh_Type,
class AssemblyPolicy,
class SolverPolicy >
114 M_computeResidual = list.get (
"Compute exact residual",
false );
117 M_solutionMap.reset (
new map_Type ( uFESpace()->map() + pFESpace()->map() ) );
120 Teuchos::ParameterList assemblyList = list.sublist (
"Assembly: Parameter list" );
121 AssemblyPolicy::initAssembly ( assemblyList );
124 Teuchos::ParameterList solverList = list.sublist (
"Solver: Parameter list" );
125 SolverPolicy::initSolver ( solverList );
126 M_rhs.reset (
new vector_Type ( *M_solutionMap, Unique ) );
129 template<
class mesh_Type,
class AssemblyPolicy,
class SolverPolicy >
134 const Real& currentTime )
136 Real rhsIterNorm ( 0.0 );
141 displayer().leaderPrint (
"Updating the system... " );
143 M_systemMatrix.reset (
new matrix_Type ( *M_solutionMap ) );
144 AssemblyPolicy::assembleSystem (
M_systemMatrix,
M_rhs, solution, SolverPolicy::preconditioner() );
151 bcManage ( *M_systemMatrix, *M_rhs, *uFESpace()->mesh(), uFESpace()->dof(), *bchandler, uFESpace()->feBd(), 1.0, currentTime );
152 M_systemMatrix->globalAssemble();
158 rhsIterNorm = M_rhs->norm2();
164 displayer().leaderPrint (
"Solving the system... \n" );
171 M_systemMatrix->matrixPtr()->Apply ( solution->epetraVector(), Ax.epetraVector() );
172 res.epetraVector().Update ( -1, Ax.epetraVector(), 1 );
175 residual /= rhsIterNorm;
176 displayer().leaderPrint (
"Scaled residual: ", residual,
"\n" );
VectorEpetra - The Epetra Vector format Wrapper.
matrixPtr_Type M_systemMatrix
std::shared_ptr< matrix_Type > matrixPtr_Type
std::shared_ptr< VectorEpetra > vectorPtr_Type
virtual Displayer displayer()=0
void iterate(vectorPtr_Type solution, bcContainerPtr_Type bchandler, const Real ¤tTime)
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
BCHandler - class for handling boundary conditions.
virtual fespacePtr_Type uFESpace() const =0
void updateInverseJacobian(const UInt &iQuadPt)
MatrixEpetra< Real > matrix_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
void norm2(Real *result) const
Compute and store the norm 2 in the given pointed variable.
std::shared_ptr< fespace_Type > fespacePtr_Type
void initTimeIteration(Teuchos::ParameterList &list)
std::shared_ptr< bcContainer_Type > bcContainerPtr_Type
double Real
Generic real data.
std::shared_ptr< map_Type > mapPtr_Type
std::shared_ptr< bdf_Type > bdfPtr_Type
FESpace< mesh_Type, map_Type > fespace_Type
TimeAdvanceBDF< vector_Type > bdf_Type
mapPtr_Type M_solutionMap
MeshPartitioner< mesh_Type > meshPartitioner_Type
virtual fespacePtr_Type pFESpace() const =0
Displayer - This class is used to display messages in parallel simulations.
BCHandler bcContainer_Type