39 #error test_structure cannot be compiled in 2D
43 #pragma GCC diagnostic ignored "-Wunused-variable" 44 #pragma GCC diagnostic ignored "-Wunused-parameter" 46 #include <Epetra_ConfigDefs.h> 49 #include <Epetra_MpiComm.h> 51 #include <Epetra_SerialComm.h> 55 #pragma GCC diagnostic warning "-Wunused-variable" 56 #pragma GCC diagnostic warning "-Wunused-parameter" 58 #include <lifev/core/LifeV.hpp> 60 #include <lifev/core/array/MapEpetra.hpp> 61 #include <lifev/core/array/VectorEpetra.hpp> 63 #include <lifev/core/mesh/MeshData.hpp> 64 #include <lifev/core/mesh/MeshPartitioner.hpp> 65 #include <lifev/core/filter/PartitionIO.hpp> 67 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp> 68 #include <lifev/structure/solver/StructuralConstitutiveLaw.hpp> 70 #include <lifev/core/filter/ExporterEnsight.hpp> 72 #include <lifev/core/filter/ExporterHDF5.hpp> 74 #include <lifev/core/filter/ExporterEmpty.hpp> 82 using namespace LifeV;
86 std::string stringList = list;
87 std::set<UInt> setList;
93 while ( commaPos != std::string::npos )
95 commaPos = stringList.find (
"," );
96 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
97 stringList = stringList.substr ( commaPos + 1 );
99 setList.insert ( atoi ( stringList.c_str() ) );
141 std::shared_ptr<Epetra_Comm> structComm );
170 std::shared_ptr<Private> parameters;
178 rho (1), poisson (1), young (1), bulk (1), alpha (1), gamma (1)
180 double rho, poisson, young, bulk, alpha, gamma;
182 std::string data_file_name;
184 std::shared_ptr<Epetra_Comm> comm;
191 std::shared_ptr<Epetra_Comm> structComm) :
195 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
196 GetPot dataFile ( data_file_name );
197 parameters->data_file_name = data_file_name;
199 parameters->comm = structComm;
200 int ntasks = parameters->comm->NumProc();
202 if (!parameters->comm->MyPID() )
204 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
213 std::cout <<
"2D cylinder test case is not available yet\n";
221 bool verbose = (parameters->comm->MyPID() == 0);
224 GetPot dataFile ( parameters->data_file_name.c_str() );
227 const std::string partitioningMesh = dataFile (
"partitioningOffline/loadMesh",
"no");
230 std::shared_ptr<MeshPartitioner<mesh_Type> > meshPart;
231 std::shared_ptr<mesh_Type> pointerToMesh;
233 if ( ! (partitioningMesh.compare (
"no") ) )
235 std::shared_ptr<mesh_Type > fullMeshPtr (
new mesh_Type ( ( parameters->comm ) ) );
238 meshData.setup (dataFile,
"solid/space_discretization");
239 readMesh (*fullMeshPtr, meshData);
241 meshPart.reset (
new MeshPartitioner<mesh_Type> (fullMeshPtr, parameters->comm ) );
243 pointerToMesh = meshPart->meshPartition();
248 const std::string partsFileName (dataFile (
"partitioningOffline/hdf5_file_name",
"NO_DEFAULT_VALUE.h5") );
250 std::shared_ptr<Epetra_MpiComm> mpiComm =
251 std::dynamic_pointer_cast<Epetra_MpiComm>(parameters->comm);
252 PartitionIO<mesh_Type> partitionIO (partsFileName, mpiComm);
255 partitionIO.read (pointerToMesh);
259 std::string dOrder = dataFile (
"solid/space_discretization/order",
"P1");
262 solidFESpacePtr_Type dFESpace (
new solidFESpace_Type (pointerToMesh, dOrder, 3, parameters->comm) );
263 solidFESpacePtr_Type dScalarFESpace (
new solidFESpace_Type (pointerToMesh, dOrder, 1, parameters->comm) );
265 UInt numberOfFibersFamilies = dataFile
( "solid/model/fibers/numberFamilies" , 0
);
266 ASSERT( numberOfFibersFamilies,
"This test should be used to check at least one fiber family!! Check the data file, please.")
270 (*pointerToVectorOfFamilies).resize( numberOfFibersFamilies );
273 fiberDirections.resize( numberOfFibersFamilies );
276 std::cout <<
"Size of the number of families: " << (*pointerToVectorOfFamilies).size() << std::endl;
278 fibersDirectionList setOfFiberFunctions;
282 for( UInt k(1); k <= pointerToVectorOfFamilies->size( ); k++ )
285 std::string family=
"Family";
287 std::string familyNumber;
288 std::ostringstream number;
290 familyNumber = number.str();
293 std::string creationString = family + familyNumber;
294 (*pointerToVectorOfFamilies)[ k-1 ].reset(
new fiberFunction_Type() );
295 (*pointerToVectorOfFamilies)[ k-1 ] = setOfFiberFunctions.fiberDefinition( creationString );
297 fiberDirections[ k-1 ].reset(
new vector_Type( dFESpace->map() ) );
301 thetaSection.reset(
new vector_Type( dScalarFESpace->map() ) );
303 thetaRotation.reset(
new vector_Type( dScalarFESpace->map() ) );
305 sphereIndicator.reset(
new vector_Type( dScalarFESpace->map() ) );
307 positionCenterVector.reset(
new vector_Type( dFESpace->map() ) );
309 localPositionVector.reset(
new vector_Type( dFESpace->map() ) );
311 MPI_Barrier (MPI_COMM_WORLD);
313 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
315 std::string
const exporterType = dataFile (
"exporter/type",
"ensight");
316 std::string
const exportFileName = dataFile (
"exporter/nameFile",
"structure");
318 if (exporterType.compare (
"hdf5") == 0)
320 exporter.reset (
new ExporterHDF5<RegionMesh<LinearTetra> > ( dataFile, exportFileName ) );
325 if (exporterType.compare (
"none") == 0)
327 exporter.reset (
new ExporterEmpty<RegionMesh<LinearTetra> > ( dataFile, pointerToMesh, exportFileName, parameters->comm->MyPID() ) );
332 exporter.reset (
new ExporterEnsight<RegionMesh<LinearTetra> > ( dataFile, pointerToMesh, exportFileName, parameters->comm->MyPID() ) );
336 exporter->setPostDir (
"./" );
337 exporter->setMeshProcId ( pointerToMesh, parameters->comm->MyPID() );
341 for( UInt k(1); k <= pointerToVectorOfFamilies->size( ); k++ )
344 std::string family=
"Family-";
346 std::string familyNumber;
347 std::ostringstream number;
349 familyNumber = number.str();
352 std::string creationString = family + familyNumber;
353 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField, creationString, dFESpace, fiberDirections[ k-1 ], UInt (0) );
356 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::ScalarField,
"sphereIndicator", dScalarFESpace, sphereIndicator, UInt (0) );
357 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::ScalarField,
"thetaSection", dScalarFESpace, thetaSection, UInt (0) );
358 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::ScalarField,
"thetaRotation", dScalarFESpace, thetaRotation, UInt (0) );
359 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"positionCenter", dFESpace, positionCenterVector, UInt (0) );
360 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"localPosition", dFESpace, localPositionVector, UInt (0) );
362 dScalarFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( thetaFunction ),
366 dScalarFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( thetaRotationFunction ),
370 dScalarFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( sphereIndicatorFunction ),
374 dFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( positionCenterSpherical ),
375 *positionCenterVector,
378 dFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( localPositionSpherical ),
379 *localPositionVector,
383 for( UInt k(1); k <= pointerToVectorOfFamilies->size( ); k++ )
386 dFESpace->interpolate (
static_cast<solidFESpace_Type::function_Type>( *(*pointerToVectorOfFamilies)[k - 1] ),
387 *fiberDirections[ k-1 ],
391 exporter->postProcess ( 0.0 );
392 std::cout.precision(16);
394 MPI_Barrier (MPI_COMM_WORLD);
403 MPI_Init (&argc, &argv);
404 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
405 if ( Comm->MyPID() == 0 )
407 std::cout <<
"% using MPI" << std::endl;
410 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
411 std::cout <<
"% using serial Version" << std::endl;
414 Structure structure ( argc, argv, Comm );
420 return EXIT_SUCCESS ;
VectorEpetra - The Epetra Vector format Wrapper.
Structure(int argc, char **argv, std::shared_ptr< Epetra_Comm > structComm)
ExporterEnsight data exporter.
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
LifeV::ExporterEnsight< mesh_Type > ensightFilter_Type
std::shared_ptr< fiberFunction_Type > fiberFunctionPtr_Type
std::shared_ptr< hdf5Filter_Type > hdf5FilterPtr_Type
FESpace< RegionMesh< LinearTetra >, MapEpetra > solidFESpace_Type
std::set< UInt > parseList(const std::string &list)
void run3d()
run the 3D driven cylinder simulation
LifeV::RegionMesh< LinearTetra > mesh_Type
void run2d()
run the 2D driven cylinder simulation
std::shared_ptr< ensightFilter_Type > ensightFilterPtr_Type
MeshData - class for handling spatial discretization.
LifeV::ExporterEmpty< mesh_Type > emptyExporter_Type
std::shared_ptr< vector_Type > vectorPtr_Type
void setupFiberDefinitions(const UInt nbFamilies)
std::shared_ptr< emptyExporter_Type > emptyExporterPtr_Type
int operator()(const char *VarName, int Default) const
std::vector< vectorPtr_Type > listOfFiberDirections_Type
int main(int argc, char **argv)
std::shared_ptr< solidFESpace_Type > solidFESpacePtr_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)
std::shared_ptr< vectorFiberFunction_Type > vectorFiberFunctionPtr_Type
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > fiberFunction_Type
std::vector< fiberFunctionPtr_Type > vectorFiberFunction_Type