38 #include <lifev/eta/fem/ETFESpace.hpp> 39 #include <lifev/eta/expression/Integrate.hpp> 51 using namespace LifeV;
84 ETA_Blocks2DTest::ETA_Blocks2DTest ()
88 M_comm.reset (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
90 M_comm.reset (
new Epetra_SerialComm() );
100 ETA_Blocks2DTest::run()
102 bool verbose (M_comm->MyPID() == 0);
110 std::cout <<
" -- Building and partitioning the mesh ... " << std::flush;
113 const UInt Nelements (10);
115 std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type);
117 regularMesh2D ( *fullMeshPtr, 0, Nelements, Nelements,
false,
121 std::shared_ptr< mesh_Type > meshPtr;
123 MeshPartitioner<
mesh_Type > meshPart (fullMeshPtr, M_comm);
124 meshPtr = meshPart.meshPartition();
131 std::cout <<
" done ! " << std::endl;
144 std::cout <<
" -- Building the spaces ... " << std::flush;
147 std::string uOrder (
"P2");
148 std::shared_ptr<FESpace< mesh_Type, MapEpetra > > uSpace
149 (
new FESpace< mesh_Type, MapEpetra > (meshPtr, uOrder, 1, M_comm) );
151 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 2, 2 > > ETuSpace
152 (
new ETFESpace< mesh_Type, MapEpetra, 2, 2 > (meshPtr, &feTriaP2, & (uSpace->fe().geoMap() ), M_comm) );
154 std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 2, 1 > > ETpSpace
155 (
new ETFESpace< mesh_Type, MapEpetra, 2, 1 > (meshPtr, &feTriaP1, & (uSpace->fe().geoMap() ), M_comm) );
159 std::cout <<
" done ! " << std::endl;
163 std::cout <<
" ---> Velocity dofs: " << ETuSpace->dof().numTotalDof() << std::endl;
167 std::cout <<
" ---> Pressure dofs: " << ETpSpace->dof().numTotalDof() << std::endl;
179 std::cout <<
" -- Assembly of the Stokes matrix ... " << std::flush;
182 std::shared_ptr<blockMatrix_Type> ETsystemMatrix (
new blockMatrix_Type ( ETuSpace->map() | ETpSpace->map() ) );
183 *ETsystemMatrix *= 0.0;
195 using namespace ExpressionAssembly;
197 integrate ( elements (ETuSpace->mesh() ),
202 dot ( grad (phi_i) , grad (phi_j) )
205 >> ETsystemMatrix->block (0, 0);
207 integrate ( elements (ETuSpace->mesh() ),
215 >> ETsystemMatrix->block (0, 1);
217 integrate ( elements (ETuSpace->mesh() ),
225 >> ETsystemMatrix->block (1, 0);
228 ETsystemMatrix->globalAssemble();
232 std::cout <<
" done! " << std::endl;
240 Real matrixNorm (ETsystemMatrix->normInf() );
242 std::cout.precision (15);
245 std::cout <<
" Matrix norm " << matrixNorm << std::endl;
256 std::cout <<
" -- Building the rhs ... " << std::flush;
259 vector_Type fInterpolated (ETuSpace->map(), Repeated);
261 fInterpolated *= 0.0;
263 uSpace->interpolate (
static_cast<FESpace< mesh_Type, MapEpetra >::function_Type> (forceFct), fInterpolated, 0.0);
269 using namespace ExpressionAssembly;
271 integrate ( elements (ETuSpace->mesh() ),
274 dot (value (ETuSpace, fInterpolated), phi_i)
279 ETrhs.globalAssemble();
283 std::cout <<
" done! " << std::endl;
294 Real rhsNorm (ETrhsUnique.normInf() );
298 std::cout <<
" Rhs norm " << rhsNorm << std::endl;
305 std::vector<Real> errorNorms (2);
306 errorNorms[0] = matrixNorm;
307 errorNorms[1] = rhsNorm;
MatrixEpetraStructured< Real > blockMatrix_Type
MatrixEpetra< Real > matrix_Type
Real forceFct(const Real &, const Real &, const Real &y, const Real &, const ID &)
Functions.
double Real
Generic real data.
RegionMesh< LinearTriangle > mesh_Type
VectorEpetraStructured blockVector_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)