71 #define HAVE_NS_PREC 1
76 #include <boost/timer.hpp> 78 #include <Epetra_ConfigDefs.h> 81 #include <Epetra_MpiComm.h> 83 #include <Epetra_SerialComm.h> 89 #include <lifev/core/fem/FESpace.hpp> 90 #include <lifev/core/array/MapEpetra.hpp> 91 #include <lifev/core/fem/BCHandler.hpp> 92 #include <lifev/core/LifeV.hpp> 94 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 95 #include <lifev/core/algorithm/PreconditionerML.hpp> 97 #include <lifev/core/algorithm/PreconditionerPCD.hpp> 100 #include <lifev/fsi/solver/FSISolver.hpp> 101 #include <lifev/structure/solver/StructuralOperator.hpp> 102 #include <lifev/fsi/solver/FSIMonolithicGI.hpp> 104 #include <lifev/core/filter/ExporterEnsight.hpp> 105 #include <lifev/core/filter/ExporterEmpty.hpp> 107 #include <lifev/core/filter/ExporterHDF5.hpp> 117 typedef std::shared_ptr<LifeV::FSISolver> FSISolverPtr_Type;
119 typedef LifeV::FSIOperator::data_Type data_Type;
120 typedef LifeV::FSIOperator::dataPtr_Type dataPtr_Type;
122 typedef LifeV::FSIOperator::vector_Type vector_Type;
123 typedef LifeV::FSIOperator::vectorPtr_Type vectorPtr_Type;
125 typedef std::shared_ptr< LifeV::Exporter<LifeV::RegionMesh<LifeV::LinearTetra> > > filterPtr_Type;
127 typedef LifeV::ExporterEnsight<LifeV::FSIOperator::mesh_Type> ensightFilter_Type;
128 typedef std::shared_ptr<ensightFilter_Type> ensightFilterPtr_Type;
130 typedef LifeV::ExporterHDF5<LifeV::FSIOperator::mesh_Type> hdf5Filter_Type;
131 typedef std::shared_ptr<hdf5Filter_Type> hdf5FilterPtr_Type;
133 typedef LifeV::FactorySingleton<LifeV::Factory<LifeV::FSIOperator, std::string> > FSIFactory_Type;
134 typedef LifeV::RegionMesh<LifeV::LinearTetra> mesh_Type;
135 typedef LifeV::MapEpetra map_Type;
136 typedef LifeV::FESpace<mesh_Type, map_Type> fespace_Type;
146 Problem ( GetPot
const& data_file ) :
151 using namespace LifeV;
153 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"linearVenantKirchhoff", &FSIOperator::createVenantKirchhoffLinear );
154 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"exponential", &FSIOperator::createExponentialMaterialNonLinear );
155 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"neoHookean", &FSIOperator::createNeoHookeanMaterialNonLinear );
156 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"nonLinearVenantKirchhoff", &FSIOperator::createVenantKirchhoffNonLinear );
158 std::cout <<
"register MonolithicGE : " << FSIMonolithicGE::S_register << std::endl;
159 std::cout <<
"register MonolithicGI : " << FSIMonolithicGI::S_register << std::endl;
161 std::cout <<
"register PCD : " << PreconditionerPCD::S_register << std::endl;
166 M_data = dataPtr_Type (
new data_Type() );
167 M_data->setup ( data_file );
169 M_fsi = FSISolverPtr_Type (
new FSISolver( ) );
170 MPI_Barrier ( MPI_COMM_WORLD );
172 M_fsi->setData ( M_data );
173 M_fsi->FSIOper()->setDataFile ( data_file );
177 std::string fluidMeshPartitioned = data_file (
"problem/fluidMeshPartitioned",
"none" );
178 std::string solidMeshPartitioned = data_file (
"problem/solidMeshPartitioned",
"none" );
180 if ( fluidMeshPartitioned.compare (
"none" ) )
182 FSIOperator::meshFilter_Type fluidMeshFilter ( data_file, fluidMeshPartitioned );
183 fluidMeshFilter.setComm ( M_fsi->FSIOper()->worldComm() );
184 FSIOperator::meshFilter_Type solidMeshFilter ( data_file, solidMeshPartitioned );
185 solidMeshFilter.setComm ( M_fsi->FSIOper( )->worldComm( ) );
186 M_fsi->FSIOper( )->partitionMeshes ( fluidMeshFilter, solidMeshFilter );
187 M_fsi->FSIOper( )->setupFEspace( );
188 M_fsi->FSIOper( )->setupDOF ( fluidMeshFilter );
189 fluidMeshFilter.closeFile( );
190 solidMeshFilter.closeFile( );
195 M_fsi->FSIOper( )->partitionMeshes( );
196 M_fsi->FSIOper( )->setupFEspace( );
197 M_fsi->FSIOper( )->setupDOF( );
200 MPI_Barrier ( MPI_COMM_WORLD );
202 M_fsi->setFluidBC ( BCh_monolithicFlux( ) );
203 M_fsi->setSolidBC ( BCh_monolithicSolid ( *M_fsi->FSIOper( ) ) );
207 M_fsi->setFluidBC ( BCh_monolithicFluid ( *M_fsi->FSIOper( ) ) );
208 M_fsi->setHarmonicExtensionBC ( BCh_harmonicExtension ( *M_fsi->FSIOper( ) ) );
210 dynamic_cast<LifeV::FSIMonolithic*> (M_fsi->FSIOper().get() )->mergeBCHandlers();
212 std::string
const exporterType = data_file (
"exporter/type",
"ensight" );
213 std::string
const fluidName = data_file (
"exporter/fluid/filename",
"fluid" );
214 std::string
const solidName = data_file (
"exporter/solid/filename",
"solid" );
217 if (exporterType.compare (
"hdf5") == 0)
219 M_exporterFluid.reset (
new hdf5Filter_Type ( data_file, fluidName) );
220 M_exporterSolid.reset (
new hdf5Filter_Type ( data_file, solidName) );
225 if (exporterType.compare (
"none") == 0)
227 M_exporterFluid.reset (
new ExporterEmpty<RegionMesh<LinearTetra> > ( data_file, M_fsi->FSIOper()->uFESpace().mesh(), fluidName, M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) );
228 M_exporterSolid.reset (
new ExporterEmpty<RegionMesh<LinearTetra> > ( data_file, M_fsi->FSIOper()->dFESpace().mesh(), solidName, M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) );
232 M_exporterFluid.reset (
new ensightFilter_Type ( data_file, fluidName) );
233 M_exporterSolid.reset (
new ensightFilter_Type ( data_file, solidName) );
239 M_saveEvery = data_file (
"exporter/saveEvery", 1);
240 M_tol = data_file (
"exporter/tolSave", 1);
243 std::string restartType (data_file (
"importer/restartType",
"newSimulation") );
244 std::cout <<
"The load state is: " << restartType << std::endl;
246 if (!restartType.compare (
"Stokes") )
248 initializeStokes (data_file);
250 else if (!restartType.compare (
"restartFSI") )
252 restartFSI (data_file);
258 M_velAndPressure.reset (
new vector_Type ( M_fsi->FSIOper()->fluid().getMap(), M_exporterFluid->mapType() ) );
260 M_fluidDisp.reset (
new vector_Type ( M_fsi->FSIOper()->mmFESpace().map(), M_exporterFluid->mapType() ) );
262 M_solidDisp.reset (
new vector_Type ( M_fsi->FSIOper()->dFESpace().map(), M_exporterSolid->mapType() ) );
266 M_exporterFluid->setMeshProcId (M_fsi->FSIOper()->uFESpace().mesh(), M_fsi->FSIOper()->uFESpace().map().comm().MyPID() );
267 M_exporterSolid->setMeshProcId (M_fsi->FSIOper()->dFESpace().mesh(), M_fsi->FSIOper()->dFESpace().map().comm().MyPID() );
268 M_exporterFluid->addVariable ( ExporterData<FSIOperator::mesh_Type>::VectorField,
"f-velocity",
269 M_fsi->FSIOper()->uFESpacePtr(), M_velAndPressure, UInt (0) );
270 M_exporterFluid->addVariable ( ExporterData<FSIOperator::mesh_Type>::ScalarField,
"f-pressure",
271 M_fsi->FSIOper()->pFESpacePtr(), M_velAndPressure,
272 UInt (3 * M_fsi->FSIOper()->uFESpace().dof().numTotalDof() ) );
274 M_exporterFluid->addVariable ( ExporterData<FSIOperator::mesh_Type>::VectorField,
"f-displacement",
275 M_fsi->FSIOper()->mmFESpacePtr(), M_fluidDisp, UInt (0) );
282 M_exporterSolid->addVariable ( ExporterData<FSIOperator::mesh_Type>::VectorField,
"s-displacement",
283 M_fsi->FSIOper()->dFESpacePtr(), M_solidDisp, UInt (0) );
292 M_data->dataFluid()->dataTime()->setInitialTime ( M_data->dataFluid()->dataTime()->initialTime() );
293 M_data->dataFluid()->dataTime()->setTime ( M_data->dataFluid()->dataTime()->initialTime() );
295 M_data->dataSolid()->dataTime()->setTime ( M_data->dataFluid()->dataTime()->initialTime() );
296 M_data->dataSolid()->dataTime()->setInitialTime ( M_data->dataFluid()->dataTime()->initialTime() );
298 M_data->timeDataALE()->setInitialTime ( M_data->dataFluid()->dataTime()->initialTime() );
299 M_data->timeDataALE()->setTime ( M_data->dataFluid()->dataTime()->initialTime() );
308 boost::timer _overall_timer;
310 LifeV::UInt iter = 1;
311 LifeV::UInt offset =
dynamic_cast<LifeV::FSIMonolithic*> (M_fsi->FSIOper().get() )->offset();
318 LifeV::UInt sizeTA (M_fsi->FSIOper()->solidTimeAdvance()->size() );
319 LifeV::UInt tol (sizeTA + M_tol);
322 dynamic_cast<LifeV::FSIMonolithic*> (M_fsi->FSIOper().get() )->enableStressComputation (1);
332 for ( ; M_data->dataFluid()->dataTime()->canAdvance(); M_data->dataFluid()->dataTime()->updateTime(), M_data->dataSolid()->dataTime()->updateTime(), ++iter)
350 r = iter % M_saveEvery;
353 if ( (iter - d) <= tol || ( (std::floor (d / M_saveEvery) + 1) *M_saveEvery - iter ) <= tol )
355 *M_fluidDisp = M_fsi->FSIOper()->meshDisp();
356 M_fsi->FSIOper()->exportSolidDisplacement (*M_solidDisp);
358 M_fsi->FSIOper()->exportFluidVelocityAndPressure (*M_velAndPressure);
360 M_exporterSolid->postProcess ( M_data->dataFluid()->dataTime()->time() );
361 M_exporterFluid->postProcess ( M_data->dataFluid()->dataTime()->time() );
367 M_fsi->FSIOper()->displayer().leaderPrintMax (
"[fsi_run] Iteration ", iter);
368 M_fsi->FSIOper()->displayer().leaderPrintMax (
" was done in : ", _timer.elapsed() );
374 if (M_data->method().compare (
"monolithicGI") )
376 vectorPtr_Type solution (
new vector_Type ( (*M_fsi->FSIOper()->couplingVariableMap() ) ) );
377 M_fsi->FSIOper()->extrapolation ( *solution );
378 M_fsi->FSIOper()->iterateMesh (*solution);
380 M_solidDisp->subset (*solution, offset);
385 *M_velAndPressure = *solution;
386 M_exporterSolid->postProcess ( M_data->dataFluid()->dataTime()->time() );
387 *M_fluidDisp = M_fsi->FSIOper()->meshMotion().disp();
388 M_exporterFluid->postProcess ( M_data->dataFluid()->dataTime()->time() );
391 std::cout <<
"Total computation time = " 392 << _overall_timer.elapsed() <<
"s" <<
"\n";
397 void initializeStokes ( GetPot
const& data_file);
398 void restartFSI ( GetPot
const& data_file);
400 FSISolverPtr_Type M_fsi;
403 filterPtr_Type M_exporterSolid;
404 filterPtr_Type M_exporterFluid;
405 filterPtr_Type M_importerSolid;
406 filterPtr_Type M_importerFluid;
407 vectorPtr_Type M_velAndPressure;
408 vectorPtr_Type M_fluidDisp;
409 vectorPtr_Type M_solidDisp;
411 std::vector<vectorPtr_Type> M_solidStencil;
412 std::vector<vectorPtr_Type> M_fluidStencil;
413 std::vector<vectorPtr_Type> M_ALEStencil;
416 LifeV::Real M_Tstart;
418 LifeV::UInt M_saveEvery;
421 struct RESULT_CHANGED_EXCEPTION
424 RESULT_CHANGED_EXCEPTION (LifeV::Real time)
426 std::cout <<
"Some modifications led to changes in the l2 norm of the solution at time" << time << std::endl;
439 std::shared_ptr<Problem> fsip;
443 fsip = std::shared_ptr<Problem> (
new Problem ( data_file ) );
447 catch ( std::exception
const& _ex )
449 std::cout <<
"caught exception : " << _ex.what() <<
"\n";
470 int main (
int argc,
char** argv)
473 MPI_Init (&argc, &argv);
475 std::cout <<
"% using serial Version" << std::endl;
479 const bool check = command_line
.search (2
, "-c", "--check");
498 const std::string data_file_name = command_line
.follow ("data", 2
, "-f", "--file");
511 void Problem::restartFSI ( GetPot
const& data_file)
514 using namespace LifeV;
516 typedef FSIOperator::mesh_Type mesh_Type;
519 std::string
const importerType = data_file (
"importer/type",
"ensight");
520 std::string
const fluidName = data_file (
"importer/fluid/filename",
"fluid");
521 std::string
const solidName = data_file (
"importer/solid/filename",
"solid");
523 std::string
const loadInitSol = data_file (
"importer/initSol",
"00000");
524 std::string
const loadInitSolFD = data_file (
"importer/initSolFD",
"-1");
525 std::string iterationString;
527 M_Tstart = data_file (
"fluid/time_discretization/initialtime", 0.);
529 std::cout <<
"The file for fluid is : " << fluidName << std::endl;
530 std::cout <<
"The file for solid is : " << solidName << std::endl;
531 std::cout <<
"The importerType is : " << importerType << std::endl;
532 std::cout <<
"The iteration is : " << loadInitSol << std::endl;
533 std::cout <<
"For the fluid disp is : " << loadInitSolFD << std::endl;
534 std::cout <<
"Starting time : " << M_Tstart << std::endl;
537 if (importerType.compare (
"hdf5") == 0)
539 M_importerFluid.reset (
new hdf5Filter_Type ( data_file, fluidName) );
540 M_importerSolid.reset (
new hdf5Filter_Type ( data_file, solidName) );
545 if (importerType.compare (
"none") == 0)
547 M_importerFluid.reset (
new ExporterEmpty<mesh_Type > ( data_file, M_fsi->FSIOper()->uFESpace().mesh(),
"fluid", M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) );
548 M_importerSolid.reset (
new ExporterEmpty<mesh_Type > ( data_file, M_fsi->FSIOper()->dFESpace().mesh(),
"solid", M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) );
552 M_importerFluid.reset (
new ensightFilter_Type ( data_file, fluidName) );
553 M_importerSolid.reset (
new ensightFilter_Type ( data_file, solidName) );
557 M_importerFluid->setMeshProcId (M_fsi->FSIOper()->uFESpace().mesh(), M_fsi->FSIOper()->uFESpace().map().comm().MyPID() );
558 M_importerSolid->setMeshProcId (M_fsi->FSIOper()->dFESpace().mesh(), M_fsi->FSIOper()->dFESpace().map().comm().MyPID() );
568 vectorPtr_Type fluidSol (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique) );
569 vectorPtr_Type initFluid (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
570 vectorPtr_Type HarmonicSol (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
571 vectorPtr_Type structureSol (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
572 vectorPtr_Type temporarySol (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
574 vectorPtr_Type vel (
new vector_Type (M_fsi->FSIOper()->uFESpace().map(), M_importerFluid->mapType() ) );
575 vectorPtr_Type pressure (
new vector_Type (M_fsi->FSIOper()->pFESpace().map(), M_importerFluid->mapType() ) );
576 vectorPtr_Type solidDisp (
new vector_Type (M_fsi->FSIOper()->dFESpace().map(), M_importerSolid->mapType() ) );
577 vectorPtr_Type fluidDisp (
new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), M_importerFluid->mapType() ) );
579 vectorPtr_Type firstFluidDisp (
new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), M_importerFluid->mapType() ) );
581 UInt offset =
dynamic_cast<LifeV::FSIMonolithic*> (M_fsi->FSIOper().get() )->offset();
583 iterationString = loadInitSol;
584 std::cout <<
"Fluid size TimeAdvance:" << M_fsi->FSIOper()->fluidTimeAdvance()->size() << std::endl;
585 for (UInt iterInit = 0; iterInit < M_fsi->FSIOper()->fluidTimeAdvance()->size(); iterInit++ )
591 temporarySol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
592 fluidSol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique) );
593 initFluid.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
596 LifeV::ExporterData<mesh_Type> initSolFluidVel (LifeV::ExporterData<mesh_Type>::VectorField, std::string (
"f-velocity." + iterationString), M_fsi->FSIOper()->uFESpacePtr(), vel, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
597 LifeV::ExporterData<mesh_Type> initSolFluidPress (LifeV::ExporterData<mesh_Type>::ScalarField, std::string (
"f-pressure." + iterationString), M_fsi->FSIOper()->pFESpacePtr(), pressure, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
600 M_importerFluid->readVariable (initSolFluidVel);
601 M_importerFluid->readVariable (initSolFluidPress);
603 fluidSol.reset (
new vector_Type (*pressure, Unique, Zero) );
604 initFluid->subset (*fluidSol, fluidSol->map(), UInt (0), (UInt) 3 * M_fsi->FSIOper()->uFESpace().dof().numTotalDof() );
605 vector_Type tmpVec (*initFluid);
607 fluidSol.reset (
new vector_Type (*vel, Unique, Zero) );
609 *initFluid += tmpVec;
614 std::cout <<
"Norm of first Fluid sol: " << initFluid->norm2() << std::endl;
615 *temporarySol = *initFluid;
622 M_fluidStencil.push_back (temporarySol);
624 int iterations = std::atoi (iterationString.c_str() );
627 std::ostringstream iter;
629 iter << std::setw (5) << ( iterations );
630 iterationString = iter.str();
634 iterationString = loadInitSol;
635 for (UInt iterInit = 0; iterInit < M_fsi->FSIOper()->solidTimeAdvance()->size(); iterInit++ )
640 temporarySol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
641 structureSol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
645 LifeV::ExporterData<mesh_Type> initSolSolidDisp (LifeV::ExporterData<mesh_Type>::VectorField,
"s-displacement." + iterationString, M_fsi->FSIOper()->dFESpacePtr(), solidDisp, UInt (0) , LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
648 M_importerSolid->readVariable (initSolSolidDisp);
650 structureSol->subset (*solidDisp, solidDisp->map(), (UInt) 0, offset);
652 *temporarySol = *structureSol / (M_fsi->FSIOper()->solid().rescaleFactor() );
654 M_solidStencil.push_back (temporarySol);
657 UInt iterations = std::atoi (iterationString.c_str() );
660 std::ostringstream iter;
662 iter << std::setw (5) << ( iterations );
663 iterationString = iter.str();
667 Int convectiveTerm = 0;
668 if (!M_data->dataFluid()->domainVelImplicit() )
672 HarmonicSol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique, Zero) );
674 iterationString = loadInitSolFD;
676 for (UInt iterInit = 0; iterInit < M_fsi->FSIOper()->ALETimeAdvance()->size() + convectiveTerm + 1; iterInit++ )
678 temporarySol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV:: Unique, Zero) );
683 LifeV::ExporterData<mesh_Type> initSolFluidDisp (LifeV::ExporterData<mesh_Type>::VectorField,
"f-displacement." + iterationString, M_fsi->FSIOper()->mmFESpacePtr(), fluidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
686 M_importerFluid->readVariable (initSolFluidDisp);
688 std::cout <<
"Reloaded Harmonic sol norm: " << fluidDisp->norm2() << std::endl;
691 HarmonicSol->subset (*fluidDisp, fluidDisp->map(), (UInt) 0,
dynamic_cast<LifeV::FSIMonolithicGI*> (M_fsi->FSIOper().get() )->mapWithoutMesh().map (Unique)->NumGlobalElements() );
694 *firstFluidDisp = *fluidDisp;
697 else if (convectiveTerm && iterInit == 1)
699 *firstFluidDisp = *fluidDisp;
703 M_ALEStencil.push_back (fluidDisp);
706 int iterations = std::atoi (iterationString.c_str() );
709 std::ostringstream iter;
711 iter << std::setw (5) << ( iterations );
712 iterationString = iter.str();
715 *M_fluidStencil[0] += *M_solidStencil[0];
716 *M_fluidStencil[0] += *HarmonicSol;
719 M_fsi->initialize (M_fluidStencil, M_solidStencil, M_ALEStencil);
721 if (!M_data->dataFluid()->domainVelImplicit() )
724 M_fsi->FSIOper()->ALETimeAdvance()->updateRHSFirstDerivative ( M_data->dataSolid()->dataTime()->timeStep() );
725 M_fsi->FSIOper()->ALETimeAdvance()->shiftRight (*firstFluidDisp);
728 M_velAndPressure.reset (
new vector_Type ( M_fsi->FSIOper()->fluid().getMap(), M_importerFluid->mapType() ) );
729 M_velAndPressure->subset (*pressure, pressure->map(), UInt (0), (UInt) 3 * M_fsi->FSIOper()->uFESpace().dof().numTotalDof() );
730 *M_velAndPressure += *vel;
732 M_fluidDisp.reset (
new vector_Type ( *fluidDisp, M_importerFluid->mapType() ) );
734 M_solidDisp.reset (
new vector_Type ( *solidDisp, M_importerSolid->mapType() ) );
736 M_data->dataFluid()->dataTime()->updateTime(), M_data->dataSolid()->dataTime()->updateTime();
740 void Problem::initializeStokes ( GetPot
const& data_file)
743 using namespace LifeV;
745 typedef FSIOperator::mesh_Type mesh_Type;
749 filterPtr_Type importer;
750 std::string
const importerType = data_file (
"importer/type",
"hdf5");
751 std::string
const filename = data_file (
"importer/fluid/filename",
"fluid");
753 std::string
const loadInitSol = data_file (
"importer/initSol",
"00000");
754 std::string
const loadInitSolFD = data_file (
"importer/initSolFD",
"-1");
755 std::string iterationString;
757 std::cout <<
"The filename is : " << filename << std::endl;
758 std::cout <<
"The importerType is: " << importerType << std::endl;
761 if (importerType.compare (
"hdf5") == 0)
763 importer.reset (
new hdf5Filter_Type ( data_file, filename) );
768 if (importerType.compare (
"none") == 0)
770 importer.reset (
new ExporterEmpty<RegionMesh<LinearTetra> > ( data_file, M_fsi->FSIOper()->uFESpace().mesh(),
"fluid", M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) );
774 importer.reset (
new ensightFilter_Type ( data_file, filename) );
778 importer->setMeshProcId (M_fsi->FSIOper()->uFESpace().mesh(), M_fsi->FSIOper()->uFESpace().map().comm().MyPID() );
781 std::vector<vectorPtr_Type> fluidStencil;;
783 vectorPtr_Type temporarySol (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), LifeV::Unique) );
787 iterationString = loadInitSol;
788 for (UInt iterInit = 0; iterInit < M_fsi->FSIOper()->fluidTimeAdvance()->size(); ++iterInit )
794 temporarySol.reset (
new vector_Type (*M_fsi->FSIOper()->couplingVariableMap(), Unique) );
796 vectorPtr_Type vel (
new vector_Type (M_fsi->FSIOper()->uFESpace().map(), M_importerFluid->mapType() ) );
797 vectorPtr_Type pressure (
new vector_Type (M_fsi->FSIOper()->pFESpace().map(), M_importerFluid->mapType() ) );
802 LifeV::ExporterData<mesh_Type> initSolFluidVel (LifeV::ExporterData<mesh_Type>::VectorField, std::string (
"f-velocity." + iterationString), M_fsi->FSIOper()->uFESpacePtr(), vel, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
803 LifeV::ExporterData<mesh_Type> initSolFluidPress (LifeV::ExporterData<mesh_Type>::ScalarField, std::string (
"f-pressure." + iterationString), M_fsi->FSIOper()->pFESpacePtr(), pressure, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
806 importer->readVariable (initSolFluidVel);
807 importer->readVariable (initSolFluidPress);
809 int iterations = std::atoi (iterationString.c_str() );
812 std::ostringstream iter;
814 iter << std::setw (5) << ( iterations );
815 iterationString = iter.str();
817 *temporarySol = *vel + *pressure;
818 fluidStencil.push_back (temporarySol);
int main(int argc, char **argv)
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
static const LifeV::UInt elm_nodes_num[]
FSIChecker(GetPot const &_data_file)
GetPot(const char *FileName, const char *CommentStart=0x0, const char *CommentEnd=0x0, const char *FieldSeparator=0x0)
bool search(unsigned No, const char *P,...)
GetPot(const STRING_VECTOR &FileNameList)
const std::string follow(const char *Default, unsigned No, const char *Option,...)