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> 59 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 60 #include <lifev/core/algorithm/PreconditionerML.hpp> 62 #include <lifev/core/array/MapEpetra.hpp> 63 #include <lifev/core/array/VectorSmall.hpp> 65 #include <lifev/core/mesh/MeshData.hpp> 66 #include <lifev/core/mesh/MeshPartitioner.hpp> 68 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp> 70 #include <lifev/structure/solver/StructuralConstitutiveLaw.hpp> 71 #include <lifev/structure/solver/StructuralOperator.hpp> 72 #include <lifev/structure/solver/isotropic/VenantKirchhoffMaterialLinear.hpp> 75 #include <lifev/core/filter/ExporterEnsight.hpp> 77 #include <lifev/core/filter/ExporterHDF5.hpp> 79 #include <lifev/core/filter/ExporterEmpty.hpp> 82 #include <lifev/eta/fem/ETFESpace.hpp> 88 using namespace LifeV;
99 std::string stringList = list;
100 std::set<UInt> setList;
106 while ( commaPos != std::string::npos )
108 commaPos = stringList.find (
"," );
109 setList.insert ( atoi ( stringList.substr ( 0, commaPos ).c_str() ) );
110 stringList = stringList.substr ( commaPos + 1 );
112 setList.insert ( atoi ( stringList.c_str() ) );
151 std::shared_ptr<Epetra_Comm> structComm );
211 ERROR_MSG (
"This entry is not allowed: ud_functions.hpp");
222 evaluationOfF
[ 0
] = 1.0;
223 evaluationOfF
[ 1
] = 1.0;
224 evaluationOfF
[ 2
] = 1.0;
226 return evaluationOfF;
236 std::shared_ptr<Epetra_Comm> structComm) :
240 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
241 GetPot dataFile ( data_file_name );
242 parameters->data_file_name = data_file_name;
244 parameters->comm = structComm;
245 int ntasks = parameters->comm->NumProc();
247 if (!parameters->comm->MyPID() )
249 std::cout <<
"My PID = " << parameters->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
258 std::cout <<
"2D cylinder test case is not available yet\n";
266 bool verbose = (parameters->comm->MyPID() == 0);
269 GetPot dataFile ( parameters->data_file_name.c_str() );
272 std::shared_ptr<BCHandler> BCh (
new BCHandler() );
274 std::shared_ptr<StructuralConstitutiveLawData> dataStructure (
new StructuralConstitutiveLawData( ) );
275 dataStructure->setup (dataFile);
277 dataStructure->showMe();
280 meshData.setup (dataFile,
"solid/space_discretization");
282 std::shared_ptr<RegionMesh<LinearTetra> > fullMeshPtr (
new RegionMesh<LinearTetra> ( parameters->comm ) );
283 readMesh (*fullMeshPtr, meshData);
285 MeshPartitioner< RegionMesh<LinearTetra> > meshPart ( fullMeshPtr, parameters->comm );
286 std::shared_ptr<RegionMesh<LinearTetra> > localMeshPtr (
new RegionMesh<LinearTetra> ( parameters->comm ) );
287 localMeshPtr = meshPart.meshPartition();
289 std::string dOrder = dataFile (
"solid/space_discretization/order",
"P1");
292 solidFESpacePtr_Type dFESpace (
new solidFESpace_Type (localMeshPtr, dOrder, 3, parameters->comm) );
293 solidETFESpacePtr_Type dETFESpace (
new solidETFESpace_Type (meshPart, & (dFESpace->refFE() ), & (dFESpace->fe().geoMap() ), parameters->comm) );
296 StructuralOperator< RegionMesh<LinearTetra> > solid;
299 solid.setup (dataStructure,
306 solid.setDataFromGetPot (dataFile);
309 vectorPtr_Type rhs (
new vector_Type (solid.displacement(), Unique) );
310 vectorPtr_Type disp (
new vector_Type (solid.displacement(), Unique) );
313 bool bodyForce = dataFile
( "solid/physics/bodyForce" , false );
316 solid.setHavingSourceTerm( bodyForce );
319 solid.setSourceTerm( bodyTerm );
323 solid.computeMassMatrix ( 1.0 );
326 solid.updateRightHandSideWithBodyForce( 1.0, *rhs );
328 MPI_Barrier (MPI_COMM_WORLD);
330 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporter;
331 std::shared_ptr< Exporter<RegionMesh<LinearTetra> > > exporterCheck;
333 std::string
const exporterType = dataFile (
"exporter/type",
"ensight");
334 std::string
const exporterNameFile = dataFile (
"exporter/nameFile",
"structure");
337 if (exporterType.compare (
"hdf5") == 0)
339 exporter.reset (
new ExporterHDF5<RegionMesh<LinearTetra> > ( dataFile, exporterNameFile ) );
344 if (exporterType.compare (
"none") == 0)
346 exporter.reset (
new ExporterEmpty<RegionMesh<LinearTetra> > ( dataFile, meshPart.meshPartition(),
"structure", parameters->comm->MyPID() ) );
351 exporter.reset (
new ExporterEnsight<RegionMesh<LinearTetra> > ( dataFile, meshPart.meshPartition(),
"structure", parameters->comm->MyPID() ) );
355 exporter->setPostDir (
"./" );
356 exporter->setMeshProcId ( meshPart.meshPartition(), parameters->comm->MyPID() );
359 vectorPtr_Type solutionLinearSystem (
new vector_Type ( solid.map() ) );
360 vectorPtr_Type bodyForcePointer (
new vector_Type ( solid.map() ) );
363 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"scalarProduct", dFESpace, scalarProduct, UInt (0) );
364 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"solution", dFESpace, solutionLinearSystem, UInt (0) );
365 exporter->addVariable ( ExporterData<RegionMesh<LinearTetra> >::VectorField,
"assembledBodyForce", dFESpace, bodyForcePointer, UInt (0) );
367 exporter->postProcess ( 0 );
368 std::cout.precision(16);
371 dFESpace->interpolate (
static_cast< FESpace<RegionMesh<LinearTetra> , MapEpetra>::function_Type> ( Private::lifeVedF ), *interpolatedF, 0.0);
372 *solutionLinearSystem = *( solid.massMatrix( ) ) * (*interpolatedF);
375 *bodyForcePointer = solid.bodyForce();
378 dFESpace->l2ScalarProduct(
static_cast< FESpace<RegionMesh<LinearTetra> , MapEpetra>::function_Type> ( Private::lifeVedF ), *scalarProduct, 0.0);
382 exporter->postProcess ( 1.0 );
385 MPI_Barrier (MPI_COMM_WORLD);
394 MPI_Init (&argc, &argv);
395 std::shared_ptr<Epetra_MpiComm> Comm (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
396 if ( Comm->MyPID() == 0 )
398 std::cout <<
"% using MPI" << std::endl;
401 std::shared_ptr<Epetra_SerialComm> Comm (
new Epetra_SerialComm() );
402 std::cout <<
"% using serial Version" << std::endl;
405 Structure structure ( argc, argv, Comm );
411 return EXIT_SUCCESS ;
StructuralOperator< RegionMesh< LinearTetra > >::matrix_Type matrix_Type
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::function< VectorSmall< 3 > Real const &, Real const &, Real const &, Real const &) > bodyFunction_Type
int main(int argc, char **argv)
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
static const LifeV::UInt elm_nodes_num[]
std::shared_ptr< hdf5Filter_Type > hdf5FilterPtr_Type
FESpace< RegionMesh< LinearTetra >, MapEpetra > solidFESpace_Type
std::shared_ptr< analyticalFunction_Type > analyticalFunctionPtr_Type
Real & operator[](UInt const &i)
Operator [].
void run3d()
run the 3D driven cylinder simulation
ETFESpace< RegionMesh< LinearTetra >, MapEpetra, 3, 3 > solidETFESpace_Type
std::string data_file_name
void run2d()
run the 2D driven cylinder simulation
StructuralOperator< RegionMesh< LinearTetra > >::matrixPtr_Type matrixPtr_Type
MeshData - class for handling spatial discretization.
std::shared_ptr< bodyFunction_Type > bodyFunctionPtr_Type
std::shared_ptr< Private > parameters
std::shared_ptr< vector_Type > vectorPtr_Type
double Real
Generic real data.
static VectorSmall< 3 > f(const Real &t, const Real &x, const Real &y, const Real &z)
std::set< UInt > parseList(const std::string &list)
std::shared_ptr< solidETFESpace_Type > solidETFESpacePtr_Type
static Real lifeVedF(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > analyticalFunction_Type
std::vector< vectorPtr_Type > listOfFiberDirections_Type
bool operator()(const char *VarName, bool Default) const
StructuralOperator< RegionMesh< LinearTetra > >::vector_Type vector_Type
std::shared_ptr< solidFESpace_Type > solidFESpacePtr_Type
std::shared_ptr< vectorFiberFunction_Type > vectorFiberFunctionPtr_Type
std::vector< fiberFunctionPtr_Type > vectorFiberFunction_Type