36 #ifndef ASSEMBLYPOLICYSTOKES_HPP 37 #define ASSEMBLYPOLICYSTOKES_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/mesh/RegionMesh.hpp> 60 #include <lifev/core/fem/FESpace.hpp> 61 #include <lifev/core/fem/TimeAdvanceBDF.hpp> 62 #include <lifev/core/util/LifeChrono.hpp> 63 #include <lifev/core/algorithm/Preconditioner.hpp> 64 #include <lifev/navier_stokes/solver/OseenAssembler.hpp> 66 #include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp> 72 template<
class mesh_Type >
111 template<
class mesh_Type >
116 std::string diffusionType = list.get (
"Diffusion type",
"Viscous stress" );
117 bool useMinusDiv = list.get (
"Use minus divergence",
true );
122 displayer().leaderPrint (
"\n[Matrices Assembly]\n" );
127 displayer().leaderPrint (
"Setting up assembler... " );
128 M_assembler.reset (
new assembler_Type );
129 M_assembler->setup ( uFESpace(), pFESpace() );
132 displayer().leaderPrint (
"Defining the matrices... " );
134 M_stokesMatrix.reset (
new matrix_Type ( solutionMap ) );
135 M_stokesMatrix->zero();
139 if ( diffusionType ==
"Viscous stress" )
141 displayer().leaderPrint (
"Adding the viscous stress... " );
142 M_assembler->addViscousStress ( *M_stokesMatrix, problem()->viscosity() / problem()->density() );
145 else if ( diffusionType ==
"Stiff strain" )
147 displayer().leaderPrint (
"Adding the stiff strain... " );
148 M_assembler->addStiffStrain ( *M_stokesMatrix, problem()->viscosity() / problem()->density() );
153 displayer().leaderPrint (
"[Error] Diffusion type unknown\n" );
157 displayer().leaderPrint (
"Adding the gradient of the pressure... " );
158 M_assembler->addGradPressure ( *M_stokesMatrix );
161 displayer().leaderPrint (
"Adding the divergence free constraint... " );
164 M_assembler->addDivergence ( *M_stokesMatrix, -1.0 );
168 M_assembler->addDivergence ( *M_stokesMatrix, 1.0 );
172 displayer().leaderPrint (
"Closing the matrices... " );
173 M_stokesMatrix->globalAssemble();
177 displayer().leaderPrintMax (
"Matrices assembly time: ", assemblyChrono
.diff(),
" s.\n");
180 template<
class mesh_Type >
187 *systemMatrix += *M_stokesMatrix;
189 M_assembler->addMassRhs ( *rhs, problem()->force(), currentTime() );
void assembleSystem(matrixPtr_Type systemMatrix, vectorPtr_Type rhs, vectorPtr_Type solution, preconditionerPtr_Type preconditioner)
VectorEpetra - The Epetra Vector format Wrapper.
std::shared_ptr< assembler_Type > assemblerPtr_Type
void start()
Start the timer.
virtual fespacePtr_Type uFESpace() const =0
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
virtual Real currentTime() const =0
std::shared_ptr< map_Type > mapPtr_Type
MatrixEpetra< Real > matrix_Type
void initAssembly(Teuchos::ParameterList &list)
std::shared_ptr< NavierStokesProblem< mesh_Type > > NSProblemPtr_Type
OseenAssembler< mesh_Type, matrix_Type, vector_Type > assembler_Type
void updateInverseJacobian(const UInt &iQuadPt)
FESpace< mesh_Type, map_Type > fespace_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
std::shared_ptr< preconditioner_Type > preconditionerPtr_Type
std::shared_ptr< VectorEpetra > vectorPtr_Type
std::shared_ptr< bdf_Type > bdfPtr_Type
Real diff()
Compute the difference in time between start and stop.
assemblerPtr_Type M_assembler
std::shared_ptr< fespace_Type > fespacePtr_Type
MeshPartitioner< mesh_Type > meshPartitioner_Type
double Real
Generic real data.
virtual NSProblemPtr_Type problem() const =0
Preconditioner preconditioner_Type
Preconditioner - Abstract preconditioner class.
std::shared_ptr< matrix_Type > matrixPtr_Type
void stop()
Stop the timer.
virtual fespacePtr_Type pFESpace() const =0
TimeAdvanceBDF< vector_Type > bdf_Type
virtual Displayer displayer()=0
Displayer - This class is used to display messages in parallel simulations.
matrixPtr_Type M_stokesMatrix