33 #error test_structure cannot be compiled in 2D
37 #pragma GCC diagnostic ignored "-Wunused-variable" 38 #pragma GCC diagnostic ignored "-Wunused-parameter" 40 #include <Epetra_ConfigDefs.h> 43 #include <Epetra_MpiComm.h> 45 #include <Epetra_SerialComm.h> 49 #pragma GCC diagnostic warning "-Wunused-variable" 50 #pragma GCC diagnostic warning "-Wunused-parameter" 52 #include <lifev/core/LifeV.hpp> 54 #include <lifev/core/array/MapEpetra.hpp> 56 #include <lifev/core/mesh/MeshData.hpp> 57 #include <lifev/core/mesh/MeshPartitioner.hpp> 59 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp> 61 #include <lifev/structure/solver/StructuralConstitutiveLaw.hpp> 62 #include <lifev/structure/solver/VenantKirchhoffMaterialLinear.hpp> 63 #include <lifev/structure/solver/VenantKirchhoffMaterialNonLinear.hpp> 64 #include <lifev/structure/solver/NeoHookeanMaterialNonLinear.hpp> 65 #include <lifev/structure/solver/ExponentialMaterialNonLinear.hpp> 67 #include <lifev/structure/solver/WallTensionEstimatorCylindricalCoordinates.hpp> 68 #include <lifev/structure/solver/WallTensionEstimatorData.hpp> 70 #include <lifev/core/filter/ExporterEnsight.hpp> 72 #include <lifev/core/filter/ExporterHDF5.hpp> 74 #include <lifev/core/filter/ExporterEmpty.hpp> 79 using namespace LifeV;
85 std::string stringList = list;
86 std::set<UInt> setList;
92 while ( commaPos != std::string::npos )
94 commaPos = stringList.find (
"," );
95 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
96 stringList = stringList.substr ( commaPos + 1 );
98 setList.insert ( atoi ( stringList.c_str() ) );
130 std::shared_ptr<Epetra_Comm> structComm );
159 std::shared_ptr<Private> parameters;
177 double rho, poisson, young, bulk, alpha, gamma;
179 std::string data_file_name;
181 std::shared_ptr<Epetra_Comm> comm;
189 std::shared_ptr<Epetra_Comm> structComm) :
193 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
194 GetPot dataFile ( data_file_name );
195 parameters->data_file_name = data_file_name;
197 parameters->rho = dataFile (
"solid/physics/density", 1. );
198 parameters->young = dataFile (
"solid/physics/young", 1. );
199 parameters->poisson = dataFile (
"solid/physics/poisson", 1. );
200 parameters->bulk = dataFile (
"solid/physics/bulk", 1. );
201 parameters->alpha = dataFile (
"solid/physics/alpha", 1. );
202 parameters->gamma = dataFile (
"solid/physics/gamma", 1. );
204 std::cout <<
"density = " << parameters->rho << std::endl
205 <<
"young = " << parameters->young << std::endl
206 <<
"poisson = " << parameters->poisson << std::endl
207 <<
"bulk = " << parameters->bulk << std::endl
208 <<
"alpha = " << parameters->alpha << std::endl
209 <<
"gamma = " << parameters->gamma << std::endl;
211 parameters->comm = structComm;
212 int ntasks = parameters->comm->NumProc();
214 if (!parameters->comm->MyPID() )
216 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
225 std::cout <<
"2D cylinder test case is not available yet\n";
234 typedef WallTensionEstimatorCylindricalCoordinates< mesh_Type >::solutionVect_Type vector_Type;
235 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
237 typedef std::shared_ptr<solidFESpace_Type> solidFESpacePtr_Type;
239 typedef ETFESpace< RegionMesh<LinearTetra>, MapEpetra, 3, 3 > solidETFESpace_Type;
240 typedef std::shared_ptr<solidETFESpace_Type> solidETFESpacePtr_Type;
242 bool verbose = (parameters->comm->MyPID() == 0);
245 GetPot dataFile ( parameters->data_file_name.c_str() );
247 std::shared_ptr<StructuralConstitutiveLawData> dataStructure (
new StructuralConstitutiveLawData( ) );
248 dataStructure->setup (dataFile);
251 std::shared_ptr<WallTensionEstimatorData> tensionData (
new WallTensionEstimatorData( ) );
252 tensionData->setup (dataFile);
254 tensionData->showMe();
257 meshData.setup (dataFile,
"solid/space_discretization");
259 std::shared_ptr<mesh_Type > fullMeshPtr (
new RegionMesh<LinearTetra> ( ( parameters->comm ) ) );
260 readMesh (*fullMeshPtr, meshData);
265 std::string dOrder = dataFile (
"solid/space_discretization/order",
"P1");
266 solidFESpacePtr_Type dFESpace (
new solidFESpace_Type (meshPart, dOrder, 3, parameters->comm) );
267 solidETFESpacePtr_Type dETFESpace (
new solidETFESpace_Type (meshPart, & (dFESpace->refFE() ), & (dFESpace->fe().geoMap() ), parameters->comm) );
271 std::cout << std::endl;
276 UInt marker = dataFile
( "solid/physics/material_flag", 1
);
279 std::shared_ptr<WallTensionEstimatorCylindricalCoordinates< mesh_Type > >
280 solid (
new WallTensionEstimatorCylindricalCoordinates< mesh_Type >() );
283 solid->setup (dataStructure,
291 std::string
const filename = tensionData->nameFile();
292 std::string
const importerType = tensionData->typeFile();
294 std::string iterationString;
298 std::cout <<
"The filename is : " << filename << std::endl;
299 std::cout <<
"The importerType is: " << importerType << std::endl;
303 if (importerType.compare (
"hdf5") == 0)
305 M_importer.reset (
new hdf5Filter_Type (dataFile, filename) );
310 if (importerType.compare (
"none") == 0)
312 M_importer.reset (
new emptyFilter_Type ( dataFile, solid->dFESpace().mesh(),
"solid", solid->dFESpace().map().comm().MyPID() ) );
316 M_importer.reset (
new ensightFilter_Type ( dataFile, filename ) );
319 M_importer->setMeshProcId (solid->dFESpace().mesh(), solid->dFESpace().map().comm().MyPID() );
322 vectorPtr_Type solidDisp (
new vector_Type (solid->dFESpace().map(), M_importer->mapType() ) );
326 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
328 std::string
const exporterType = dataFile (
"exporter/type",
"hdf5");
329 std::string
const nameExporter = dataFile (
"exporter/name",
"tensions");
332 if (exporterType.compare (
"hdf5") == 0)
334 M_exporter.reset (
new hdf5Filter_Type ( dataFile, nameExporter ) );
339 if (exporterType.compare (
"none") == 0)
341 M_exporter.reset (
new emptyFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
346 M_exporter.reset (
new ensightFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
350 M_exporter->setMeshProcId (solid->dFESpace().mesh(), solid->dFESpace().map().comm().MyPID() );
352 vectorPtr_Type solidTensions (
new vector_Type (solid->principalStresses(), M_exporter->mapType() ) );
354 M_exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"vonMises", dFESpace, solidTensions, UInt (0) );
355 M_exporter->postProcess ( 0.0 );
394 MPI_Barrier (MPI_COMM_WORLD);
398 std::string
const nameField = dataFile (
"solid/analysis/nameField",
"NO_DEFAULT_VALUE");
400 if ( !tensionData->analysisType().compare (
"istant") )
403 iterationString = tensionData->iterStart (0);
404 LifeV::Real startTime = tensionData->initialTime (0);
407 LifeV::ExporterData<
mesh_Type> solutionDispl (LifeV::ExporterData<mesh_Type>::VectorField, nameField +
"." + iterationString, solid->dFESpacePtr(), solidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
410 M_importer->readVariable (solutionDispl);
411 M_importer->closeFile();
428 solid->setDisplacement (*solidDisp);
430 std::cout <<
"The norm of the set displacement, at time " << startTime <<
", is: " << solid->displacement().norm2() << std::endl;
433 solid->analyzeTensions();
445 std::cout << std::endl;
446 std::cout <<
"Norm of the tension vector: " << solid->principalStresses().norm2() << std::endl;
448 *solidTensions = solid->principalStresses();
449 M_exporter->postProcess ( startTime );
453 std::cout <<
"Analysis Completed!" << std::endl;
457 M_exporter->closeFile();
467 std::cout <<
"we are still working idiot! " << std::endl;
472 std::cout <<
"finished" << std::endl;
475 MPI_Barrier (MPI_COMM_WORLD);
484 MPI_Init (&argc, &argv);
485 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
486 if ( Comm->MyPID() == 0 )
488 std::cout <<
"% using MPI" << std::endl;
491 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
492 std::cout <<
"% using serial Version" << std::endl;
495 Structure structure ( argc, argv, Comm );
Structure(int argc, char **argv, std::shared_ptr< Epetra_Comm > structComm)
ExporterEnsight data exporter.
std::shared_ptr< emptyFilter_Type > emptyFilterPtr_Type
FESpace - Short description here please!
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > fct_type
LifeV::ExporterEnsight< mesh_Type > ensightFilter_Type
LifeV::Exporter< mesh_Type > filter_Type
std::shared_ptr< hdf5Filter_Type > hdf5FilterPtr_Type
std::set< UInt > parseList(const std::string &list)
LifeV::ExporterEmpty< mesh_Type > emptyFilter_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
void run3d()
run the 3D driven cylinder simulation
LifeV::RegionMesh< LinearTetra > mesh_Type
std::shared_ptr< std::vector< Int > > M_isOnProc
void run2d()
run the 2D driven cylinder simulation
std::shared_ptr< ensightFilter_Type > ensightFilterPtr_Type
MeshData - class for handling spatial discretization.
int operator()(const char *VarName, int Default) const
std::shared_ptr< LifeV::Exporter< mesh_Type > > filterPtr_Type
int main(int argc, char **argv)
uint32_type UInt
generic unsigned integer (used mainly for addressing)