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> 60 #include <lifev/structure/solver/StructuralConstitutiveLaw.hpp> 61 #include <lifev/structure/solver/StructuralOperator.hpp> 64 #include <lifev/structure/solver/VenantKirchhoffMaterialLinear.hpp> 65 #include <lifev/structure/solver/VenantKirchhoffMaterialNonLinear.hpp> 66 #include <lifev/structure/solver/NeoHookeanMaterialNonLinear.hpp> 67 #include <lifev/structure/solver/ExponentialMaterialNonLinear.hpp> 69 #include <lifev/core/filter/ExporterEnsight.hpp> 71 #include <lifev/core/filter/ExporterHDF5.hpp> 73 #include <lifev/core/filter/ExporterEmpty.hpp> 78 using namespace LifeV;
84 std::string stringList = list;
85 std::set<UInt> setList;
91 while ( commaPos != std::string::npos )
93 commaPos = stringList.find (
"," );
94 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
95 stringList = stringList.substr ( commaPos + 1 );
97 setList.insert ( atoi ( stringList.c_str() ) );
129 std::shared_ptr<Epetra_Comm> structComm );
188 std::shared_ptr<Epetra_Comm> structComm) :
192 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
193 GetPot dataFile ( data_file_name );
194 parameters->data_file_name = data_file_name;
196 parameters->rho = dataFile (
"solid/physics/density", 1. );
197 parameters->young = dataFile (
"solid/physics/young", 1. );
198 parameters->poisson = dataFile (
"solid/physics/poisson", 1. );
199 parameters->bulk = dataFile (
"solid/physics/bulk", 1. );
200 parameters->alpha = dataFile (
"solid/physics/alpha", 1. );
201 parameters->gamma = dataFile (
"solid/physics/gamma", 1. );
203 std::cout <<
"density = " << parameters->rho << std::endl
204 <<
"young = " << parameters->young << std::endl
205 <<
"poisson = " << parameters->poisson << std::endl
206 <<
"bulk = " << parameters->bulk << std::endl
207 <<
"alpha = " << parameters->alpha << std::endl
208 <<
"gamma = " << parameters->gamma << std::endl;
210 parameters->comm = structComm;
211 int ntasks = parameters->comm->NumProc();
213 if (!parameters->comm->MyPID() )
215 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
224 std::cout <<
"2D cylinder test case is not available yet\n";
233 typedef StructuralOperator<mesh_Type >::vector_Type vector_Type;
234 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
236 typedef std::shared_ptr<solidFESpace_Type> solidFESpacePtr_Type;
238 typedef ETFESpace< RegionMesh<LinearTetra>, MapEpetra, 3, 3 > solidETFESpace_Type;
239 typedef std::shared_ptr<solidETFESpace_Type> solidETFESpacePtr_Type;
241 bool verbose = (parameters->comm->MyPID() == 0);
244 GetPot dataFile ( parameters->data_file_name.c_str() );
245 std::shared_ptr<StructuralConstitutiveLawData> dataStructure (
new StructuralConstitutiveLawData( ) );
246 dataStructure->setup (dataFile);
250 meshData.setup (dataFile,
"solid/space_discretization");
252 std::shared_ptr<mesh_Type > fullMeshPtr (
new RegionMesh<LinearTetra> ( ( parameters->comm ) ) );
253 readMesh (*fullMeshPtr, meshData);
258 std::string dOrder = dataFile (
"solid/space_discretization/order",
"P1");
259 solidFESpacePtr_Type dFESpace (
new solidFESpace_Type (meshPart, dOrder, 3, parameters->comm) );
260 solidETFESpacePtr_Type dETFESpace (
new solidETFESpace_Type (meshPart, & (dFESpace->refFE() ), & (dFESpace->fe().geoMap() ), parameters->comm) );
265 std::cout << std::endl;
269 StructuralOperator<RegionMesh<LinearTetra> > solid;
272 std::shared_ptr<BCHandler> BCh (
new BCHandler() );
275 solid.setup (dataStructure,
282 std::string
const filename = dataFile (
"importer/filename",
"structure");
283 std::string
const importerType = dataFile (
"importer/type",
"hdf5");
285 std::string iterationString;
289 std::cout <<
"The filename is : " << filename << std::endl;
290 std::cout <<
"The importerType is: " << importerType << std::endl;
294 if (importerType.compare (
"hdf5") == 0)
296 M_importer.reset (
new hdf5Filter_Type (dataFile, filename) );
301 if (importerType.compare (
"none") == 0)
303 M_importer.reset (
new emptyFilter_Type ( dataFile, dFESpace->mesh(),
"solid", dFESpace->map().comm().MyPID() ) );
307 M_importer.reset (
new ensightFilter_Type ( dataFile, filename ) );
310 M_importer->setMeshProcId (dFESpace->mesh(), dFESpace->map().comm().MyPID() );
313 vectorPtr_Type solidDisp (
new vector_Type (dFESpace->map(), LifeV::Unique ) );
316 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
318 std::string
const exporterType = dataFile (
"exporter/type",
"hdf5");
319 std::string
const nameExporter = dataFile (
"exporter/name",
"jacobian");
322 if (exporterType.compare (
"hdf5") == 0)
324 M_exporter.reset (
new hdf5Filter_Type ( dataFile, nameExporter ) );
329 if (exporterType.compare (
"none") == 0)
331 M_exporter.reset (
new emptyFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
336 M_exporter.reset (
new ensightFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
340 M_exporter->setMeshProcId (dFESpace->mesh(), dFESpace->map().comm().MyPID() );
342 vectorPtr_Type jacobianVector (
new vector_Type (solid.displacement(), LifeV::Unique ) );
343 vectorPtr_Type meshColors (
new vector_Type (solid.displacement(), LifeV::Unique ) );
345 M_exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"determinantF", dFESpace, jacobianVector, UInt (0) );
346 M_exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"colors", dFESpace, meshColors, UInt (0) );
347 M_exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"displacementField", dFESpace, solidDisp, UInt (0) );
349 M_exporter->postProcess ( 0.0 );
355 MPI_Barrier (MPI_COMM_WORLD);
358 LifeV::Real dt = dataFile (
"solid/time_discretization/timestep", 0.0);
359 std::string
const nameField = dataFile (
"importer/nameField",
"displacement");
362 iterationString = dataFile (
"importer/iteration",
"00000");
363 LifeV::Real time = dataFile (
"importer/time", 1.0);
366 LifeV::ExporterData<
mesh_Type> solutionDispl (LifeV::ExporterData<mesh_Type>::VectorField, nameField +
"." + iterationString, dFESpace, solidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
369 M_importer->readVariable (solutionDispl);
370 M_importer->closeFile();
373 solid.jacobianDistribution ( solidDisp, *jacobianVector);
376 solid.colorMesh ( *meshColors );
379 std::cout << std::endl;
380 std::cout <<
"Norm of the J = det(F) : " << jacobianVector->norm2() << std::endl;
382 M_exporter->postProcess ( time );
386 std::cout <<
"Analysis Completed!" << std::endl;
390 M_exporter->closeFile();
394 std::cout <<
"finished" << std::endl;
397 MPI_Barrier (MPI_COMM_WORLD);
406 MPI_Init (&argc, &argv);
407 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
408 if ( Comm->MyPID() == 0 )
410 std::cout <<
"% using MPI" << std::endl;
413 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
414 std::cout <<
"% using serial Version" << std::endl;
417 Structure structure ( argc, argv, Comm );
std::shared_ptr< Epetra_Comm > comm
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
Structure(int argc, char **argv, std::shared_ptr< Epetra_Comm > structComm)
std::shared_ptr< emptyFilter_Type > emptyFilterPtr_Type
FESpace - Short description here please!
int main(int argc, char **argv)
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
filterPtr_Type M_importer
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::string data_file_name
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.
std::shared_ptr< Private > parameters
std::set< UInt > parseList(const std::string &list)
filterPtr_Type M_exporter
std::shared_ptr< LifeV::Exporter< mesh_Type > > filterPtr_Type