8 #include <Epetra_ConfigDefs.h> 11 #include <Epetra_MpiComm.h> 13 #include <Epetra_SerialComm.h> 18 #include <lifev/core/LifeV.hpp> 22 #include <lifev/core/filter/ExporterEnsight.hpp> 23 #include <lifev/core/filter/ExporterEmpty.hpp> 25 #include <lifev/core/filter/ExporterHDF5.hpp> 29 #include <lifev/core/mesh/MeshData.hpp> 30 #include <lifev/core/mesh/MeshPartitioner.hpp> 31 #include <lifev/core/fem/TimeAndExtrapolationHandlerQuadPts.hpp> 33 using namespace LifeV;
41 int main (
int argc,
char** argv)
45 MPI_Init (&argc, &argv);
46 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
47 bool verbose = Comm->MyPID() == 0;
49 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_SerialComm() );
54 const bool check = command_line
.search (2
, "-c", "--check");
56 const std::string dataFile = command_line
.follow ("data_TimeAndExtrapolationHandler", 2
, "-d", "--data_TimeAndExtrapolationHandler");
64 meshDataFluid.setup(data_file,
"mesh_fluid");
69 std::cout <<
"\n[Loading the mesh ] .." << std::flush;
71 fluidMeshFull.reset(
new mesh_Type());
72 readMesh(*fluidMeshFull, meshDataFluid);
75 std::cout <<
" done! \n\n" << std::flush;
86 std::cout <<
"[Partitioning the fluid mesh ] \n\n";
88 MeshPartitioner<
mesh_Type > fluidPartio(fluidMeshFull, Comm);
92 fluidMeshLocal.reset(
new mesh_Type(*fluidPartio.meshPartition()));
97 const UInt sizeField = 3;
99 velocityFESpace.reset (
new FESpace_Type (fluidMeshLocal, data_file(
"mesh_fluid/fe_order",
"P1"), sizeField, Comm) );
107 std::cout <<
"[Test with empty constructor ]";
109 UInt orderBDF = data_file
("dataTimeHandler/orderBDF",2
);
110 UInt orderExtrapolation = data_file
("dataTimeHandler/orderExtrapolation",2
);
114 timeVelocity.setBDForder(orderBDF);
117 timeVelocity.setTimeStep(0.2);
119 std::vector<std::vector<VectorSmall<sizeField>>> firstVector;
120 std::vector<std::vector<VectorSmall<sizeField>>> secondVector;
121 std::vector<std::vector<VectorSmall<sizeField>>> thirdVector;
123 firstVector.resize(fluidMeshLocal->numElements());
124 secondVector.resize(fluidMeshLocal->numElements());
125 thirdVector.resize(fluidMeshLocal->numElements());
128 for (
int i = 0 ; i < fluidMeshLocal->numElements() ; ++i )
130 firstVector[i].resize(velocityFESpace->qr().nbQuadPt());
131 secondVector[i].resize(velocityFESpace->qr().nbQuadPt());
132 thirdVector[i].resize(velocityFESpace->qr().nbQuadPt());
134 for (
int j = 0 ; j < velocityFESpace->qr().nbQuadPt(); ++j )
136 for (
int k = 0 ; k < sizeField; ++k )
138 firstVector[i][j](k) = 1.0;
139 secondVector[i][j](k) = 2.0;
140 thirdVector[i][j](k) = 3.0;
146 std::vector<std::vector<std::vector<VectorSmall<sizeField>>>> initialState;
147 initialState.push_back(firstVector);
148 initialState.push_back(secondVector);
149 timeVelocity.initialize(initialState);
155 timeVelocity.shift(thirdVector);
158 std::vector<std::vector<VectorSmall<sizeField>>> rhsTerm;
159 rhsTerm.resize(fluidMeshLocal->numElements());
160 for (
int i = 0 ; i < fluidMeshLocal->numElements() ; ++i )
162 rhsTerm[i].resize(velocityFESpace->qr().nbQuadPt());
165 timeVelocity.rhsContribution(rhsTerm);
167 for (
int i = 0; i < fluidMeshLocal->numElements(); ++i )
169 for (
int j = 0; j < velocityFESpace->qr().nbQuadPt(); ++j )
172 for (
int k = 0; k < sizeField; ++k )
174 std::cout <<
" " << rhsTerm[i][j](k);
184 std::cout <<
"\nAlpha = " << timeVelocity.alpha() <<
"\n\n";
VectorEpetra - The Epetra Vector format Wrapper.
RegionMesh< LinearTetra > mesh_Type
std::shared_ptr< mesh_Type > meshPtr_Type
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
std::vector< std::vector< VectorSmall< DIM > > > vector_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
MeshData - class for handling spatial discretization.
int operator()(const char *VarName, int Default) const
bool search(unsigned No, const char *P,...)
GetPot(const STRING_VECTOR &FileNameList)
std::shared_ptr< FESpace_Type > FESpacePtr_Type
const std::string follow(const char *Default, unsigned No, const char *Option,...)
int main(int argc, char **argv)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
FESpace< mesh_Type, MapEpetra > FESpace_Type