35 #ifndef INITPOLICYPROJECTION_HPP 36 #define INITPOLICYPROJECTION_HPP 39 #include <boost/shared_ptr.hpp> 43 #include <Epetra_MpiComm.h> 45 #include <Epetra_SerialComm.h> 48 #include <Teuchos_ParameterList.hpp> 49 #include <Teuchos_XMLParameterListHelpers.hpp> 50 #include <Teuchos_RCP.hpp> 53 #include <lifev/core/LifeV.hpp> 54 #include <lifev/core/array/VectorEpetra.hpp> 55 #include <lifev/core/array/MatrixEpetra.hpp> 56 #include <lifev/core/util/Displayer.hpp> 57 #include <lifev/core/mesh/RegionMesh.hpp> 58 #include <lifev/core/fem/FESpace.hpp> 59 #include <lifev/core/fem/TimeAdvanceBDF.hpp> 60 #include <lifev/core/fem/BCHandler.hpp> 62 #include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp> 63 #include <lifev/navier_stokes/solver/NavierStokesSolver/SolverPolicyLinearSolver.hpp> 64 #include <lifev/navier_stokes/solver/NavierStokesSolver/AssemblyPolicyStokes.hpp> 91 void setupInit ( Teuchos::ParameterList& list );
109 template<
class mesh_Type,
class SolverPolicy >
114 Teuchos::ParameterList assemblyList = list.sublist (
"Assembly: Parameter list" );
118 template<
class mesh_Type,
class SolverPolicy >
124 ASSERT ( problem()->hasExactSolution(),
"Error: You cannot use the projection method if the problem has not an analytical solution." );
130 rhs.reset (
new vector_Type ( uFESpace()->map() + pFESpace()->map(), Unique ) );
133 velocity.reset (
new vector_Type ( uFESpace()->map(), Unique ) );
136 pressure.reset (
new vector_Type ( pFESpace()->map(), Unique ) );
139 uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
140 pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
142 solution->add ( *velocity );
143 solution->add ( *pressure, pressureOffset );
144 bdf()->setInitialCondition ( *solution );
147 AssemblyPolicyStokes< mesh_Type >::initAssembly ( M_list );
149 displayer().leaderPrint (
"Creating the mass matrix... " );
152 massMatrix.reset (
new matrix_Type ( solutionMap ) );
154 AssemblyPolicyStokes< mesh_Type >::M_assembler->addMass ( *massMatrix, 1.0 );
155 massMatrix->globalAssemble();
167 uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
168 pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
169 solution->add ( *velocity );
170 solution->add ( *pressure, pressureOffset );
172 uFESpace()->interpolate ( problem()->uderexact(), *rhs, currentTime );
173 rhs->globalAssemble();
175 *rhs = ( *massMatrix ) * ( *rhs );
177 displayer().leaderPrint (
"Updating the system... " );
178 systemMatrix.reset (
new matrix_Type ( solutionMap ) );
179 AssemblyPolicyStokes< mesh_Type >::assembleSystem ( systemMatrix, rhs, solution, SolverPolicy::preconditioner() );
182 AssemblyPolicyStokes< mesh_Type >::M_assembler->addConvection ( *systemMatrix, 1.0, *solution );
184 if ( SolverPolicy::preconditioner()->preconditionerType() ==
"PCD" )
186 vector_Type beta ( systemMatrix->map(), Repeated );
196 bcManage ( *systemMatrix, *rhs, *uFESpace()->mesh(), uFESpace()->dof(), *bchandler, uFESpace()->feBd(), 1.0, currentTime );
198 displayer().leaderPrintMax (
"Time to impose BC: ", imposingBCChrono
.diff(),
" s.\n" );
200 systemMatrix->globalAssemble();
202 displayer().leaderPrint (
"Solving the system... \n" );
204 SolverPolicy::solve ( systemMatrix, rhs, solution );
207 bdf()->shiftRight ( *solution );
VectorEpetra - The Epetra Vector format Wrapper.
PreconditionerPCD(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
default constructor
std::shared_ptr< bcContainer_Type > bcContainerPtr_Type
void start()
Start the timer.
Teuchos::ParameterList M_list
std::shared_ptr< bdf_Type > bdfPtr_Type
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 Real initialTime() const =0
virtual bdfPtr_Type bdf() const =0
virtual Displayer displayer()=0
virtual fespacePtr_Type pFESpace() const =0
void updateInverseJacobian(const UInt &iQuadPt)
BCHandler bcContainer_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
MatrixEpetra< Real > matrix_Type
virtual NSProblemPtr_Type problem() const =0
Real diff()
Compute the difference in time between start and stop.
virtual Real timestep() const =0
std::shared_ptr< matrix_Type > matrixPtr_Type
void setupInit(Teuchos::ParameterList &list)
std::shared_ptr< fespace_Type > fespacePtr_Type
TimeAdvanceBDF< vector_Type > bdf_Type
double Real
Generic real data.
std::shared_ptr< NavierStokesProblem< mesh_Type > > NSProblemPtr_Type
std::shared_ptr< map_Type > mapPtr_Type
virtual ~InitPolicyProjection()
FESpace< mesh_Type, map_Type > fespace_Type
void stop()
Stop the timer.
void initSimulation(bcContainerPtr_Type bchandler, vectorPtr_Type solution)
virtual fespacePtr_Type uFESpace() const =0
MeshPartitioner< mesh_Type > meshPartitioner_Type
void updateBeta(const vector_Type &beta)
Update the vector beta of the convective term in Fp.
Displayer - This class is used to display messages in parallel simulations.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
std::shared_ptr< vector_Type > vectorPtr_Type