36 #ifndef ASSEMBLYPOLICYGENERALIZEDSTOKES_HPP 37 #define ASSEMBLYPOLICYGENERALIZEDSTOKES_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/algorithm/Preconditioner.hpp> 63 #include <lifev/core/util/LifeChrono.hpp> 64 #include <lifev/navier_stokes/solver/OseenAssembler.hpp> 66 #include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp> 72 template<
class mesh_Type >
115 template<
class mesh_Type >
120 std::string diffusionType = list.get (
"Diffusion type",
"Viscous stress" );
121 bool useMinusDiv = list.get (
"Use minus divergence",
true );
126 displayer().leaderPrint (
"\n[Matrices Assembly]\n" );
131 displayer().leaderPrint (
"Setting up assembler... " );
132 M_assembler.reset (
new assembler_Type );
133 M_assembler->setup ( uFESpace(), pFESpace() );
136 displayer().leaderPrint (
"Defining the matrices... " );
138 M_stokesMatrix.reset (
new matrix_Type ( solutionMap ) );
139 M_stokesMatrix->zero();
143 if ( diffusionType ==
"Viscous stress" )
145 displayer().leaderPrint (
"Adding the viscous stress... " );
146 M_assembler->addViscousStress ( *M_stokesMatrix, problem()->viscosity() / problem()->density() );
149 else if ( diffusionType ==
"Stiff strain" )
151 displayer().leaderPrint (
"Adding the stiff strain... " );
152 M_assembler->addStiffStrain ( *M_stokesMatrix, problem()->viscosity() / problem()->density() );
157 displayer().leaderPrint (
"[Error] Diffusion type unknown\n" );
161 displayer().leaderPrint (
"Adding the gradient of the pressure... " );
162 M_assembler->addGradPressure ( *M_stokesMatrix );
165 displayer().leaderPrint (
"Adding the divergence free constraint... " );
168 M_assembler->addDivergence ( *M_stokesMatrix, -1.0 );
172 M_assembler->addDivergence ( *M_stokesMatrix, 1.0 );
177 M_assembler->addMass ( *M_stokesMatrix, 1.0 / timestep() );
180 displayer().leaderPrint (
"Closing the matrices... " );
181 M_stokesMatrix->globalAssemble();
185 displayer().leaderPrintMax (
"Matrices assembly time: ", assemblyChrono
.diff(),
" s.\n");
188 template<
class mesh_Type >
195 *systemMatrix += *M_stokesMatrix;
197 M_assembler->addMassRhs ( *rhs, problem()->force(), currentTime() );
std::shared_ptr< assembler_Type > assemblerPtr_Type
VectorEpetra - The Epetra Vector format Wrapper.
MeshPartitioner< mesh_Type > meshPartitioner_Type
void start()
Start the timer.
assemblerPtr_Type M_assembler
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
std::shared_ptr< VectorEpetra > vectorPtr_Type
std::shared_ptr< bdf_Type > bdfPtr_Type
MatrixEpetra< Real > matrix_Type
void updateInverseJacobian(const UInt &iQuadPt)
virtual Real timestep() const =0
virtual fespacePtr_Type pFESpace() const =0
Epetra_Import const & importer()
Getter for the Epetra_Import.
virtual ~AssemblyPolicyGeneralizedStokes()
Real diff()
Compute the difference in time between start and stop.
void initAssembly(Teuchos::ParameterList &list)
std::shared_ptr< preconditioner_Type > preconditionerPtr_Type
virtual fespacePtr_Type uFESpace() const =0
OseenAssembler< mesh_Type, matrix_Type, vector_Type > assembler_Type
Preconditioner preconditioner_Type
std::shared_ptr< matrix_Type > matrixPtr_Type
std::shared_ptr< NavierStokesProblem< mesh_Type > > NSProblemPtr_Type
double Real
Generic real data.
std::shared_ptr< fespace_Type > fespacePtr_Type
AssemblyPolicyGeneralizedStokes()
matrixPtr_Type M_stokesMatrix
TimeAdvanceBDF< vector_Type > bdf_Type
Preconditioner - Abstract preconditioner class.
void stop()
Stop the timer.
std::shared_ptr< map_Type > mapPtr_Type
FESpace< mesh_Type, map_Type > fespace_Type
virtual Real currentTime() const =0
void assembleSystem(matrixPtr_Type systemMatrix, vectorPtr_Type rhs, vectorPtr_Type solution, preconditionerPtr_Type preconditioner)
virtual NSProblemPtr_Type problem() const =0
Displayer - This class is used to display messages in parallel simulations.
virtual Displayer displayer()=0