51 #include <Epetra_ConfigDefs.h>    54 #include <Epetra_MpiComm.h>    56 #include <Epetra_SerialComm.h>    60 #include <lifev/core/LifeV.hpp>    62 #include <lifev/core/mesh/MeshPartitioner.hpp>    63 #include <lifev/core/mesh/RegionMesh3DStructured.hpp>    64 #include <lifev/core/mesh/RegionMesh.hpp>    66 #include <lifev/core/array/MatrixEpetra.hpp>    67 #include <lifev/core/array/VectorEpetra.hpp>    69 #include <lifev/eta/fem/ETFESpace.hpp>    70 #include <lifev/eta/expression/Integrate.hpp>    72 #include <lifev/core/fem/FESpace.hpp>    74 #include <boost/shared_ptr.hpp>    81 using namespace LifeV;
   134         return std::sin ( position
[0
] );
   164         return std::pow ( std::pow ( std::abs (advection_field[0]), M_exponent)
   165                           + std::pow ( std::abs (advection_field[1]), M_exponent)
   166                           + std::pow ( std::abs (advection_field[2]), M_exponent)
   194 int main ( 
int argc, 
char** argv )
   198     MPI_Init (&argc, &argv);
   199     std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
   201     std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm);
   204     const bool verbose (Comm->MyPID() == 0);
   209         std::cout << 
" -- Building and partitioning the mesh ... " << std::flush;
   212     const UInt Nelements (10);
   214     std::shared_ptr< mesh_Type > fullMeshPtr (
new mesh_Type ( Comm ) );
   216     regularMesh3D ( *fullMeshPtr, 1, Nelements, Nelements, Nelements, 
false,
   220     std::shared_ptr< mesh_Type > meshPtr;
   222         MeshPartitioner< mesh_Type >   meshPart (fullMeshPtr, Comm);
   223         meshPtr = meshPart.meshPartition();
   230         std::cout << 
" done ! " << std::endl;
   242         std::cout << 
" -- Building the ETFESpace ... " << std::flush;
   245     std::string uOrder (
"P1");
   246     std::shared_ptr<FESpace< mesh_Type, MapEpetra > > uSpace ( 
new FESpace< mesh_Type, MapEpetra > (meshPtr, uOrder, 1, Comm) );
   248     std::shared_ptr<ETFESpace< mesh_Type, MapEpetra, 3, 1 > > ETuSpace ( 
new ETFESpace< mesh_Type, MapEpetra, 3, 1 > (meshPtr, & (uSpace->refFE() ), & (uSpace->fe().geoMap() ), Comm) );
   252         std::cout << 
" done ! " << std::endl;
   256         std::cout << 
" ---> Dofs: " << ETuSpace->dof().numTotalDof() << std::endl;
   268         std::cout << 
" -- Building the rhs via interpolation ... " << std::flush;
   271     vector_Type fInterpolated (ETuSpace->map(), Repeated);
   273     fInterpolated *= 0.0;
   275     uSpace->interpolate (fFct, fInterpolated, 0.0);
   277     vector_Type rhsET (ETuSpace->map(), Repeated);
   281         using namespace ExpressionAssembly;
   283         integrate ( elements (ETuSpace->mesh() ),
   286                     value (ETuSpace, fInterpolated) *phi_i
   291     rhsET.globalAssemble();
   295         std::cout << 
" done! " << std::endl;
   312         std::cout << 
" -- Building the rhs via functor ... " << std::flush;
   315     vector_Type rhsETfunctor (ETuSpace->map(), Repeated);
   319         using namespace ExpressionAssembly;
   321         std::shared_ptr<fFunctor> ffunctor (
new fFunctor);
   323         integrate ( elements (ETuSpace->mesh() ),
   326                     eval (ffunctor, X) *phi_i
   331     rhsETfunctor.globalAssemble();
   335         std::cout << 
" done! " << std::endl;
   359         std::cout << 
" -- Assembly of the AD-SUPG ... " << std::flush;
   362     std::shared_ptr<matrix_Type> ETsystemMatrix (
new matrix_Type ( ETuSpace->map() ) );
   363     *ETsystemMatrix *= 0.0;
   366         using namespace ExpressionAssembly;
   368         VectorSmall<3> beta (0, 1.0, 2.0);
   370         std::shared_ptr<normFunctor> norm ( 
new normFunctor);
   372         norm->setExponent (2);
   374         integrate ( elements (ETuSpace->mesh() ),
   379                     dot ( grad (phi_i) , grad (phi_j) )
   380                     + dot ( grad (phi_j) , beta ) *phi_i
   381                     + h_K * dot (grad (phi_i), beta) *dot (grad (phi_j), beta) / (2.0 * eval (norm, beta) )
   389         std::cout << 
" done! " << std::endl;
   402         std::cout << 
" -- Computing the error ... " << std::flush;
   405     vector_Type checkRhs (ETuSpace->map(), Repeated);
   409     checkRhs -= rhsETfunctor;
   411     checkRhs.globalAssemble();
   413     vector_Type checkRhsUnique (checkRhs, Unique);
   415     Real diffRhsNorm ( checkRhsUnique.normInf() );
   419         std::cout << 
" done! " << std::endl;
   423         std::cout << 
" Rhs diff : " << diffRhsNorm << std::endl;
   441     Real testTolerance (1e-3);
   443     if (diffRhsNorm < testTolerance)
   445         return ( EXIT_SUCCESS );
   447     return ( EXIT_FAILURE );
 
int main(int argc, char **argv)
MatrixEpetra< Real > matrix_Type
normFunctor(const normFunctor &nf)
Real const  & operator[](UInt const &i) const
Operator []. 
function_Type fFct(fFctRaw)
Real fFctRaw(const Real &, const Real &x, const Real &, const Real &, const ID &)
fFunctor(const fFunctor &)
return_Type operator()(const VectorSmall< 3 > &position)
void setExponent(const UInt &expo)
double Real
Generic real data. 
return_Type operator()(const VectorSmall< 3 > &advection_field)
normFunctor(const UInt &expo=1)
RegionMesh< LinearTetra > mesh_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing) 
FESpace< mesh_Type, MapEpetra >::function_Type function_Type