33 #error example_computeWSS cannot be compiled in 2D
36 #include <Epetra_ConfigDefs.h> 39 #include <Epetra_MpiComm.h> 41 #include <Epetra_SerialComm.h> 44 #include <lifev/core/LifeV.hpp> 47 #include <lifev/core/array/MapEpetra.hpp> 48 #include <lifev/core/array/VectorEpetra.hpp> 49 #include <lifev/core/array/MatrixSmall.hpp> 50 #include <lifev/core/array/VectorSmall.hpp> 53 #include <lifev/core/mesh/MeshData.hpp> 54 #include <lifev/core/mesh/RegionMesh.hpp> 55 #include <lifev/core/mesh/MeshPartitioner.hpp> 58 #include <lifev/core/fem/FESpace.hpp> 59 #include <lifev/eta/fem/ETFESpace.hpp> 63 #include <lifev/navier_stokes/solver/OseenData.hpp> 66 #include <lifev/eta/expression/Evaluate.hpp> 67 #include <lifev/eta/expression/Integrate.hpp> 69 #include <lifev/core/filter/ExporterEnsight.hpp> 71 #include <lifev/core/filter/ExporterHDF5.hpp> 73 #include <lifev/core/filter/ExporterEmpty.hpp> 77 using namespace LifeV;
83 std::string stringList = list;
84 std::set<UInt> setList;
90 while ( commaPos != std::string::npos )
92 commaPos = stringList.find (
"," );
93 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
94 stringList = stringList.substr ( commaPos + 1 );
96 setList.insert ( atoi ( stringList.c_str() ) );
127 std::shared_ptr<Epetra_Comm> structComm );
178 std::shared_ptr<Epetra_Comm> structComm) :
182 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
183 GetPot dataFile ( data_file_name );
184 parameters->data_file_name = data_file_name;
186 parameters->comm = structComm;
187 int ntasks = parameters->comm->NumProc();
189 if (!parameters->comm->MyPID() )
191 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
200 std::cout <<
"2D WSS example is not available yet\n";
209 typedef std::shared_ptr<VectorEpetra> vectorPtr_Type;
212 typedef std::shared_ptr<wssFESpace_Type> wssFESpacePtr_Type;
214 typedef ETFESpace< RegionMesh<LinearTetra>, MapEpetra, 3, 3 > vectorialETFESpace_Type;
215 typedef std::shared_ptr<vectorialETFESpace_Type> vectorialETFESpacePtr_Type;
217 typedef ETFESpace< RegionMesh<LinearTetra>, MapEpetra, 3, 1 > scalarETFESpace_Type;
218 typedef std::shared_ptr<scalarETFESpace_Type> scalarETFESpacePtr_Type;
220 bool verbose = (parameters->comm->MyPID() == 0);
223 GetPot dataFile ( parameters->data_file_name.c_str() );
224 std::shared_ptr<OseenData> dataClass (
new OseenData( ) );
225 dataClass->setup (dataFile);
231 meshData.setup (dataFile,
"fluid/space_discretization");
233 std::shared_ptr<mesh_Type > fullMeshPtr (
new RegionMesh<LinearTetra> ( ( parameters->comm ) ) );
234 readMesh (*fullMeshPtr, meshData);
238 wssFESpacePtr_Type velFESpace (
new wssFESpace_Type (meshPart, dataClass->uOrder() , 3, parameters->comm) );
241 wssFESpacePtr_Type quadFESpace (
new wssFESpace_Type (meshPart, dataClass->uOrder() , 2, parameters->comm) );
243 vectorialETFESpacePtr_Type uETFESpace (
new vectorialETFESpace_Type (meshPart, & (velFESpace->refFE() ),
244 & (velFESpace->fe().geoMap() ), parameters->comm) );
247 std::string
const filename = dataFile (
"importer/filename",
"noNameFile");
248 std::string
const importerType = dataFile (
"importer/type",
"hdf5");
253 std::string readType = dataFile (
"importer/analysis",
"instant");
258 if( !readType.compare(
"instant") )
261 ASSERT( numberOfSol,
"You did not set any solution to read!! ");
265 start = dataFile
( "importer/iterationStart" , 0
);
266 end = dataFile
( "importer/iterationEnd" , 0
);
267 numberOfSol = end - start;
269 ASSERT( numberOfSol,
"You did not set any solution to read!! ");
273 std::cout <<
"The filename is : " << filename << std::endl;
274 std::cout <<
"The importerType is: " << importerType << std::endl;
278 if (importerType.compare (
"hdf5") == 0)
280 M_importer.reset (
new hdf5Filter_Type (dataFile, filename) );
285 if (importerType.compare (
"none") == 0)
287 M_importer.reset (
new emptyFilter_Type ( dataFile, velFESpace->mesh(),
"WSS", velFESpace->map().comm().MyPID() ) );
291 M_importer.reset (
new ensightFilter_Type ( dataFile, filename ) );
294 M_importer->setMeshProcId (velFESpace->mesh(), velFESpace->map().comm().MyPID() );
297 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
299 std::string
const exporterType = dataFile (
"exporter/type",
"hdf5");
300 std::string
const nameExporter = dataFile (
"exporter/name",
"jacobian");
303 if (exporterType.compare (
"hdf5") == 0)
305 exporter.reset (
new hdf5Filter_Type ( dataFile, nameExporter) );
310 if (exporterType.compare (
"none") == 0)
312 exporter.reset (
new emptyFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
317 exporter.reset (
new ensightFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
320 exporter->setMeshProcId (velFESpace->mesh(), velFESpace->map().comm().MyPID() );
323 vectorPtr_Type patchAreaVector;
325 vectorPtr_Type velocity;
326 vectorPtr_Type velocityRead;
328 vectorPtr_Type WSSvector;
330 patchAreaVector.reset (
new vector_Type ( uETFESpace->map() ) );
331 velocity.reset(
new vector_Type( velFESpace->map() ) );
332 velocityRead.reset(
new vector_Type( velFESpace->map() ) );
334 WSSvector.reset (
new vector_Type ( uETFESpace->map() ) );
336 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"WSS",
337 velFESpace, WSSvector, UInt (0) );
340 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"velocityRead",
341 velFESpace, velocityRead, UInt (0) );
343 exporter->postProcess ( 0.0 );
349 MPI_Barrier (MPI_COMM_WORLD);
354 firstPoint[0] = 0.0; firstPoint[1] = 0.0;; firstWeight = ( 0.5 ) / 3;
358 secondPoint[0] = 1.0; secondPoint[1] = 0.0; secondWeight = ( 0.5 ) / 3;
362 thirdPoint[0] = 0.0; thirdPoint[1] = 1.0; thirdWeight = ( 0.5 ) / 3;
365 std::vector<GeoVector> coordinates( 3 );
366 coordinates[0] = firstPoint;
367 coordinates[1] = secondPoint;
368 coordinates[2] = thirdPoint;
369 std::vector<Real> weights ( 3 , 1.0 / 6.0 );
371 fakeQuadratureRule.setPoints(coordinates, weights);
372 QuadratureBoundary adaptedBDQuadRule( buildTetraBDQR( fakeQuadratureRule ) );
377 MatrixSmall<3,3> identity;
378 identity (0, 0) = 1.0;
379 identity (0, 1) = 0.0;
380 identity (0, 2) = 0.0;
381 identity (1, 0) = 0.0;
382 identity (1, 1) = 1.0;
383 identity (1, 2) = 0.0;
384 identity (2, 0) = 0.0;
385 identity (2, 1) = 0.0;
386 identity (2, 2) = 1.0;
389 evaluateNode( boundary( uETFESpace->mesh(), 200 ),
393 ) >> patchAreaVector;
394 patchAreaVector->globalAssemble();
396 std::string
const nameField = dataFile (
"importer/nameField",
"f-velocity");
399 for( i=0,k =0; i < numberOfSol; i++, k++ )
407 if( !readType.compare(
"interval") )
413 current = dataFile
( "importer/iteration" , 100000
, i );
416 std::string iterationString;
417 std::ostringstream number;
419 number << std::setw (5) << ( current );
420 iterationString = number.str();
422 std::cout <<
"Current reading: " << iterationString << std::endl;
425 LifeV::ExporterData<
mesh_Type> solutionVel (LifeV::ExporterData<mesh_Type>::VectorField,nameField +
"." + iterationString,
426 velFESpace, velocity, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
430 M_importer->readVariable (solutionVel);
431 *velocityRead = *velocity;
433 Real dynamicViscosity = dataClass->viscosity( );
435 std::cout <<
"Viscosity: " << dataClass->viscosity( ) << std::endl;
437 evaluateNode( boundary( uETFESpace->mesh(), 200 ),
440 meas_BDk * dot ( value(dynamicViscosity) * ( grad(uETFESpace, *velocity) + transpose(grad(uETFESpace, *velocity)) ) * Nface -
441 dot( value(dynamicViscosity) * ( grad(uETFESpace, *velocity) + transpose(grad(uETFESpace, *velocity)) ) * Nface , Nface ) * Nface, phi_i )
443 WSSvector->globalAssemble();
444 *WSSvector = *WSSvector / *patchAreaVector;
455 exporter->postProcess( dataClass->dataTime()->initialTime() + k * dataClass->dataTime()->timeStep() );
461 std::cout <<
"Analysis Completed!" << std::endl;
465 exporter->closeFile( );
466 M_importer->closeFile( );
468 MPI_Barrier (MPI_COMM_WORLD);
477 MPI_Init (&argc, &argv);
478 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
479 if ( Comm->MyPID() == 0 )
481 std::cout <<
"% using MPI" << std::endl;
484 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
485 std::cout <<
"% using serial Version" << std::endl;
488 WSS wss ( argc, argv, Comm );
VectorEpetra - The Epetra Vector format Wrapper.
LifeV::Exporter< mesh_Type > filter_Type
class ExpressionEmult Class for representing the transpose operation of an expression ...
ExporterEnsight data exporter.
FESpace - Short description here please!
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > fct_type
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
std::shared_ptr< Epetra_Comm > comm
std::shared_ptr< ensightFilter_Type > ensightFilterPtr_Type
boost::numeric::ublas::vector< Real > GeoVector
filterPtr_Type M_importer
QuadratureRule(const QuadratureRule &qr)
Copy constructor.
std::set< UInt > parseList(const std::string &list)
WSS(int argc, char **argv, std::shared_ptr< Epetra_Comm > structComm)
Epetra_Import const & importer()
Getter for the Epetra_Import.
QuadraturePoint - Simple container for a point of a quadrature rule.
std::shared_ptr< LifeV::Exporter< mesh_Type > > filterPtr_Type
std::string data_file_name
std::shared_ptr< std::vector< Int > > M_isOnProc
MeshData - class for handling spatial discretization.
ExpressionMeasBDCurrentFE - Expression for the measure of the element.
LifeV::ExporterEnsight< mesh_Type > ensightFilter_Type
std::shared_ptr< Private > parameters
double Real
Generic real data.
const QuadratureRule quadRuleTria3pt(pt_tria_3pt, 2, "Quadrature rule 3 points on a triangle", TRIANGLE, 3, 2)
LifeV::ExporterEmpty< mesh_Type > emptyFilter_Type
int operator()(const char *VarName, int Default, unsigned Idx) const
int operator()(const char *VarName, int Default) const
QuadraturePoint(const GeoVector &coor, const Real &weight)
Full multidimension constructor.
void run2d()
run the 2D driven cylinder simulation
QuadratureRule - The basis class for storing and accessing quadrature rules.
std::shared_ptr< emptyFilter_Type > emptyFilterPtr_Type
int main(int argc, char **argv)
void run3d()
run the 3D driven cylinder simulation
uint32_type UInt
generic unsigned integer (used mainly for addressing)
LifeV::RegionMesh< LinearTetra > mesh_Type
unsigned vector_variable_size(const char *VarName) const