43 #error test_structure cannot be compiled in 2D
47 #pragma GCC diagnostic ignored "-Wunused-variable" 48 #pragma GCC diagnostic ignored "-Wunused-parameter" 50 #include <Epetra_ConfigDefs.h> 53 #include <Epetra_MpiComm.h> 55 #include <Epetra_SerialComm.h> 59 #pragma GCC diagnostic warning "-Wunused-variable" 60 #pragma GCC diagnostic warning "-Wunused-parameter" 62 #include <lifev/core/LifeV.hpp> 63 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 64 #include <lifev/core/algorithm/PreconditionerML.hpp> 68 #include <lifev/core/array/MapEpetra.hpp> 70 #include <lifev/core/mesh/MeshData.hpp> 71 #include <lifev/core/mesh/MeshPartitioner.hpp> 72 #include <lifev/core/filter/MeshWriter.hpp> 74 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp> 75 #include <lifev/structure/solver/StructuralConstitutiveLaw.hpp> 76 #include <lifev/structure/solver/StructuralOperator.hpp> 78 #include <lifev/structure/solver/isotropic/ExponentialMaterialNonLinear.hpp> 81 #include <lifev/core/filter/ExporterEnsight.hpp> 83 #include <lifev/core/filter/ExporterHDF5.hpp> 85 #include <lifev/core/filter/ExporterEmpty.hpp> 91 using namespace LifeV;
97 template <
typename MeshEntityType,
98 typename ComparisonPolicyType =
std::
function <
bool (
121 barycenter += entity.point ( k ).coordinates();
130 entity.setMarkerID ( newMarker );
143 template <
typename MeshEntityType,
144 typename ComparisonPolicyType =
std::
function <
bool (
167 barycenter += entity.point ( k ).coordinates();
186 std::string stringList = list;
187 std::set<UInt> setList;
193 while ( commaPos != std::string::npos )
195 commaPos = stringList.find (
"," );
196 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
197 stringList = stringList.substr ( commaPos + 1 );
199 setList.insert ( atoi ( stringList.c_str() ) );
215 std::shared_ptr<Epetra_Comm> structComm );
267 std::shared_ptr<Epetra_Comm> structComm) :
271 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
272 GetPot dataFile ( data_file_name );
273 parameters->data_file_name = data_file_name;
275 parameters->comm = structComm;
276 int ntasks = parameters->comm->NumProc();
278 if (!parameters->comm->MyPID() )
280 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
289 std::cout <<
"2D cylinder test case is not available yet\n";
297 typedef StructuralOperator<mesh_Type >::vector_Type vector_Type;
298 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
300 typedef std::shared_ptr<solidFESpace_Type> solidFESpacePtr_Type;
301 typedef ETFESpace< RegionMesh<LinearTetra>, MapEpetra, 3, 3 > solidETFESpace_Type;
302 typedef std::shared_ptr<solidETFESpace_Type> solidETFESpacePtr_Type;
304 typedef LifeV::RegionMesh<LinearTetra> mesh_Type;
307 typedef LifeV::Exporter<mesh_Type > filter_Type;
308 typedef std::shared_ptr< LifeV::Exporter<mesh_Type > > filterPtr_Type;
310 typedef LifeV::ExporterEmpty<mesh_Type > emptyFilter_Type;
311 typedef std::shared_ptr<emptyFilter_Type> emptyFilterPtr_Type;
312 typedef LifeV::ExporterEnsight<mesh_Type > ensightFilter_Type;
313 typedef std::shared_ptr<ensightFilter_Type> ensightFilterPtr_Type;
316 typedef LifeV::ExporterHDF5<mesh_Type > hdf5Filter_Type;
317 typedef std::shared_ptr<hdf5Filter_Type> hdf5FilterPtr_Type;
320 bool verbose = (parameters->comm->MyPID() == 0);
323 GetPot dataFile ( parameters->data_file_name.c_str() );
324 std::shared_ptr<StructuralConstitutiveLawData> dataStructure (
new StructuralConstitutiveLawData( ) );
325 dataStructure->setup (dataFile);
328 meshData.setup (dataFile,
"solid/space_discretization");
331 std::shared_ptr<RegionMesh<LinearTetra> > fullMeshPtr (
new RegionMesh<LinearTetra> ( ( parameters->comm ) ) );
332 std::shared_ptr<RegionMesh<LinearTetra> > localMeshPtr (
new RegionMesh<LinearTetra> ( ( parameters->comm ) ) );
334 readMesh (*fullMeshPtr, meshData);
340 std::cout << std::endl;
349 SphereCounter<mesh_Type::element_Type> countVolumesFunctor ( center, radius );
351 UInt numExtractedVolumes = fullMeshPtr->elementList().countAccordingToPredicate ( countVolumesFunctor );
353 std::cout <<
" The Number of volumes inside the sphere is: " << numExtractedVolumes << std::endl;
357 SphereInterrogator<mesh_Type::element_Type> setSphereInterrogator ( center, radius );
360 fullMeshPtr->elementList().changeAccordingToFunctor ( setSphereInterrogator );
363 std::string
const nameExportMesh = dataFile (
"exporter/modifiedMesh",
"damagedMesh");
364 MeshWriter::writeMeshMedit<RegionMesh<LinearTetra> > ( nameExportMesh , *fullMeshPtr );
368 MeshPartitioner< mesh_Type > meshPart ( fullMeshPtr, parameters->comm );
369 localMeshPtr = meshPart.meshPartition();
371 std::string dOrder = dataFile (
"solid/space_discretization/order",
"P1");
372 solidFESpacePtr_Type dFESpace (
new solidFESpace_Type (localMeshPtr, dOrder, 3, parameters->comm) );
373 solidETFESpacePtr_Type dETFESpace (
new solidETFESpace_Type (meshPart, & (dFESpace->refFE() ), & (dFESpace->fe().geoMap() ), parameters->comm) );
376 StructuralOperator<RegionMesh<LinearTetra> > solid;
379 std::shared_ptr<BCHandler> BCh (
new BCHandler() );
382 solid.setup (dataStructure,
389 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
391 std::string
const exporterType = dataFile (
"exporter/type",
"hdf5");
392 std::string
const nameExporter = dataFile (
"exporter/name",
"");
395 if (exporterType.compare (
"hdf5") == 0)
397 exporter.reset (
new hdf5Filter_Type ( dataFile, nameExporter ) );
402 if (exporterType.compare (
"none") == 0)
404 exporter.reset (
new emptyFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
409 exporter.reset (
new ensightFilter_Type ( dataFile, meshPart.meshPartition(), nameExporter, parameters->comm->MyPID() ) ) ;
413 exporter->setMeshProcId (dFESpace->mesh(), dFESpace->map().comm().MyPID() );
415 vectorPtr_Type meshColors (
new vector_Type (solid.displacement(), LifeV::Unique ) );
416 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"colors", dFESpace, meshColors, UInt (0) );
418 exporter->postProcess ( 0.0 );
419 MPI_Barrier (MPI_COMM_WORLD);
422 solid.colorMesh ( *meshColors );
424 exporter->postProcess ( 1000.0 );
427 exporter->closeFile();
431 std::cout <<
"finished" << std::endl;
434 MPI_Barrier (MPI_COMM_WORLD);
448 MPI_Init (&argc, &argv);
449 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
450 if ( Comm->MyPID() == 0 )
452 std::cout <<
"% using MPI" << std::endl;
455 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
456 std::cout <<
"% using serial Version" << std::endl;
459 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)
bool operator()(const meshEntity_Type &entity) const
FESpace - Short description here please!
int main(int argc, char **argv)
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
SphereCounter(Vector3D const ¢er, Real radius, comparisonPolicy_Type const &policy=std::less< Real >())
SphereInterrogator(Vector3D const ¢er, Real radius, comparisonPolicy_Type const &policy=std::less< Real >())
std::shared_ptr< hdf5Filter_Type > hdf5FilterPtr_Type
ComparisonPolicyType comparisonPolicy_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
VectorSmall(VectorSmall< 3 > const &vector)
Copy constructor.
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
MeshData - class for handling spatial discretization.
std::shared_ptr< Private > parameters
double Real
Generic real data.
const comparisonPolicy_Type M_policy
const comparisonPolicy_Type M_policy
std::set< UInt > parseList(const std::string &list)
VectorSmall< 3 > Vector3D
MeshEntityType meshEntity_Type
void operator()(meshEntity_Type &entity) const
ComparisonPolicyType comparisonPolicy_Type
MeshEntityType meshEntity_Type
VectorSmall(Real const &x, Real const &y, Real const &z)
Full constructor with all components explicitly initialized.
uint32_type UInt
generic unsigned integer (used mainly for addressing)