38 #include <lifev/multiscale/models/MultiscaleModelFSI3D.hpp> 48 MultiscaleModelFSI3D::MultiscaleModelFSI3D() :
49 multiscaleModel_Type (),
50 MultiscaleInterface (),
52 M_data (
new data_Type() ),
57 #ifndef FSI_WITH_EXTERNALPRESSURE 58 M_boundaryStressFunctions (),
59 M_externalPressureScalar (),
61 #ifndef FSI_WITHOUT_VELOCITYPROFILE 62 M_boundaryFlowRateFunctions (),
63 M_boundaryFlowRateType (),
66 M_boundaryAreaFunctions (),
67 M_boundaryFlagsArea (),
70 M_wallTensionEstimator (
new wallTensionEstimator_Type() ),
74 M_fluidDisplacement (),
76 M_solidDisplacement (),
84 M_solidStressVonMises (),
87 M_nonLinearRichardsonIteration ( 0 ),
88 M_fluidBC (
new bcInterface_Type() ),
89 M_solidBC (
new bcInterface_Type() ),
90 M_harmonicExtensionBC (
new bcInterface_Type() ),
97 #ifdef HAVE_LIFEV_DEBUG 98 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::MultiscaleModelFSI3D() \n";
103 FSIOperator_Type::factory_Type::instance().registerProduct (
"monolithicGE", &createFSIMonolithicGE );
104 FSIOperator_Type::factory_Type::instance().registerProduct (
"monolithicGI", &createFSIMonolithicGI );
106 BlockPrecFactory::instance().registerProduct (
"AdditiveSchwarz", &MonolithicBlockMatrix::createAdditiveSchwarz) ;
107 BlockPrecFactory::instance().registerProduct (
"AdditiveSchwarzRN", &MonolithicBlockMatrixRN::createAdditiveSchwarzRN ) ;
108 BlockPrecFactory::instance().registerProduct (
"ComposedDN", &MonolithicBlockComposedDN::createComposedDN ) ;
109 BlockPrecFactory::instance().registerProduct (
"ComposedDN2", &MonolithicBlockComposedDN::createComposedDN2 );
110 BlockPrecFactory::instance().registerProduct (
"ComposedDNND", &MonolithicBlockComposedDNND::createComposedDNND);
112 MonolithicBlockMatrix::Factory_Type::instance().registerProduct (
"AdditiveSchwarz", &MonolithicBlockMatrix::createAdditiveSchwarz ) ;
113 MonolithicBlockMatrix::Factory_Type::instance().registerProduct (
"AdditiveSchwarzRN", &MonolithicBlockMatrixRN::createAdditiveSchwarzRN ) ;
115 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"linearVenantKirchhoff", &FSIOperator::createVenantKirchhoffLinear );
116 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"exponential", &FSIOperator::createExponentialMaterialNonLinear );
117 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"neoHookean", &FSIOperator::createNeoHookeanMaterialNonLinear );
118 FSIOperator::solid_Type::material_Type::isotropicLaw_Type::StructureIsotropicMaterialFactory::instance().registerProduct (
"nonLinearVenantKirchhoff", &FSIOperator::createVenantKirchhoffNonLinear );
126 MultiscaleModelFSI3D::setupData (
const std::string& fileName )
129 #ifdef HAVE_LIFEV_DEBUG 130 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::setupData( fileName ) \n";
133 multiscaleModel_Type::setupData ( fileName );
135 GetPot dataFile ( fileName );
138 M_data->setup ( dataFile );
139 if ( M_globalData.get() )
141 setupGlobalData ( fileName );
145 M_FSIoperator = FSIOperatorPtr_Type ( FSIOperator_Type::factory_Type::instance().createObject ( M_data->method() ) );
151 M_FSIoperator->setData ( M_data );
152 M_FSIoperator->setDataFile ( dataFile );
155 setupBC ( fileName );
158 if ( M_FSIoperator->isFluid() )
160 setupExporter ( M_exporterFluid, dataFile );
161 setupImporter ( M_importerFluid, dataFile );
163 if ( M_FSIoperator->isSolid() )
165 setupExporter ( M_exporterSolid, dataFile,
"_Solid" );
166 setupImporter ( M_importerSolid, dataFile,
"_Solid" );
169 #ifndef FSI_WITHOUT_VELOCITYPROFILE 170 std::map< std::string, FSI3DBoundaryFlowRate_Type > boundaryFlowRateMap;
171 boundaryFlowRateMap[
"Weak"] = Weak;
172 boundaryFlowRateMap[
"Semiweak"] = Semiweak;
173 boundaryFlowRateMap[
"Strong"] = Strong;
175 M_boundaryFlowRateType.reserve ( M_boundaryFlags.size() );
176 for ( UInt j ( 0 ); j < M_boundaryFlags.size(); ++j )
178 M_boundaryFlowRateType[j] = boundaryFlowRateMap[dataFile (
"Multiscale/flowRateCouplingType",
"Weak", j )];
183 M_boundaryFlagsArea.reserve ( M_boundaryFlags.size() );
184 M_boundaryFlagsAreaPerturbed.reserve ( M_boundaryFlags.size() );
185 for ( UInt j ( 0 ); j < M_boundaryFlags.size(); ++j )
187 M_boundaryFlagsArea.push_back ( dataFile (
"Multiscale/couplingAreaFlags", 0, j ) );
188 M_boundaryFlagsAreaPerturbed.push_back (
false );
194 MultiscaleModelFSI3D::setupModel()
197 #ifdef HAVE_LIFEV_DEBUG 198 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::setupProblem() \n";
203 M_FSIoperator->solidMesh().meshTransformer().transformMesh ( M_geometryScale, M_geometryRotate, M_geometryTranslate );
206 M_FSIoperator->partitionMeshes();
209 M_FSIoperator->fluidLocalMesh().meshTransformer().transformMesh ( M_geometryScale, M_geometryRotate, M_geometryTranslate );
213 M_FSIoperator->setupFEspace();
214 M_FSIoperator->setupDOF();
217 M_fluidBC->setPhysicalSolver ( M_FSIoperator );
218 M_solidBC->setPhysicalSolver ( M_FSIoperator );
219 M_harmonicExtensionBC->setPhysicalSolver ( M_FSIoperator );
222 M_FSIoperator->setupFluidSolid ( M_FSIoperator->imposedFluxes() );
223 M_FSIoperator->setupSystem();
227 for ( boundaryAreaFunctionsContainerIterator_Type i = M_boundaryAreaFunctions.begin(); i < M_boundaryAreaFunctions.end(); ++i )
234 M_wallTensionEstimator->setup ( M_FSIoperator->solid().data(), M_FSIoperator->dFESpacePtr(), M_FSIoperator->dFESpaceETPtr(), M_comm,
static_cast<UInt> ( 0 ) );
238 if ( M_FSIoperator->isFluid() )
240 setExporterFluid ( M_exporterFluid );
243 if ( M_FSIoperator->isSolid() )
245 setExporterSolid ( M_exporterSolid );
249 initializeSolution();
256 MultiscaleModelFSI3D::buildModel()
259 #ifdef HAVE_LIFEV_DEBUG 260 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::buildModel() \n";
267 M_FSIoperator->buildSystem();
268 M_FSIoperator->updateSystem();
275 MultiscaleModelFSI3D::updateModel()
278 #ifdef HAVE_LIFEV_DEBUG 279 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::updateModel() \n";
283 M_FSIoperator->updateSystem();
291 M_FSIoperator->precPtrView()->setRecompute ( 1,
true );
292 M_nonLinearRichardsonIteration = 0;
296 MultiscaleModelFSI3D::solveModel()
299 #ifdef HAVE_LIFEV_DEBUG 300 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::solveModel() \n";
303 displayModelStatus (
"Solve" );
308 if ( M_nonLinearRichardsonIteration != 0 )
310 M_FSIoperator->resetRHS();
311 M_FSIoperator->updateRHS();
312 M_FSIoperator->applyBoundaryConditions();
316 UInt maxSubIterationNumber = M_data->maxSubIterationNumber();
317 M_FSIoperator->extrapolation ( *M_stateVariable );
319 NonLinearRichardson ( *M_stateVariable, *M_FSIoperator,
320 M_data->absoluteTolerance(), M_data->relativeTolerance(),
321 maxSubIterationNumber, M_data->errorTolerance(),
322 M_data->NonLinearLineSearch(),
323 M_nonLinearRichardsonIteration,
330 M_FSIoperator->precPtrView()->setRecompute ( 1,
false );
331 M_nonLinearRichardsonIteration = 1;
334 for ( UInt j ( 0 ); j < M_boundaryFlagsAreaPerturbed.size(); ++j )
336 M_boundaryFlagsAreaPerturbed[j] =
false;
342 MultiscaleModelFSI3D::updateSolution()
345 #ifdef HAVE_LIFEV_DEBUG 346 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::updateSolution() \n";
349 M_FSIoperator->updateSolution ( *M_stateVariable );
353 MultiscaleModelFSI3D::saveSolution()
356 #ifdef HAVE_LIFEV_DEBUG 357 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::saveSolution() \n";
360 exportFluidSolution();
361 if ( M_FSIoperator->isFluid() )
363 M_exporterFluid->postProcess ( M_data->dataFluid()->dataTime()->time() );
366 exportSolidSolution();
367 if ( M_FSIoperator->isSolid() )
369 M_exporterSolid->postProcess ( M_data->dataSolid()->dataTime()->time() );
373 if ( M_data->dataFluid()->dataTime()->isLastTimeStep() )
375 if ( M_FSIoperator->isFluid() )
377 M_exporterFluid->closeFile();
379 if ( M_FSIoperator->isSolid() )
381 M_exporterSolid->closeFile();
389 MultiscaleModelFSI3D::showMe()
391 if ( M_comm->MyPID() == 0 )
393 multiscaleModel_Type::showMe();
395 std::cout <<
"FSI method = " << M_data->method() << std::endl << std::endl;
397 std::cout <<
"Velocity FE order = " << M_FSIoperator->dataFluid()->uOrder() << std::endl
398 <<
"Pressure FE order = " << M_FSIoperator->dataFluid()->pOrder() << std::endl
399 <<
"Structure FE order = " << M_FSIoperator->dataSolid()->order() << std::endl << std::endl;
401 std::cout <<
"Velocity DOF = " << 3 * M_FSIoperator->uFESpace().dof().numTotalDof() << std::endl
402 <<
"Pressure DOF = " << M_FSIoperator->pFESpace().dof().numTotalDof() << std::endl
403 <<
"Harmonic ext. DOF = " << M_FSIoperator->mmFESpace().dof().numTotalDof() << std::endl
404 <<
"Structure DOF = " << M_FSIoperator->dFESpace().dof().numTotalDof() << std::endl << std::endl;
406 std::cout <<
"Fluid mesh maxH = " << MeshUtility::MeshStatistics::computeSize ( * ( M_FSIoperator->uFESpace().mesh() ) ).maxH << std::endl
407 <<
"Fluid mesh meanH = " << MeshUtility::MeshStatistics::computeSize ( * ( M_FSIoperator->uFESpace().mesh() ) ).meanH << std::endl
408 <<
"Solid mesh maxH = " << MeshUtility::MeshStatistics::computeSize ( * ( M_FSIoperator->dFESpace().mesh() ) ).maxH << std::endl
409 <<
"Solid mesh meanH = " << MeshUtility::MeshStatistics::computeSize ( * ( M_FSIoperator->dFESpace().mesh() ) ).meanH << std::endl << std::endl;
414 MultiscaleModelFSI3D::checkSolution()
const 416 return M_stateVariable->norm2();
423 MultiscaleModelFSI3D::imposeBoundaryFlowRate (
const multiscaleID_Type& boundaryID,
const function_Type& function )
427 #ifndef FSI_WITHOUT_VELOCITYPROFILE 428 switch ( M_boundaryFlowRateType[boundaryID] )
432 boundaryFlowRateFunctionPtr_Type boundaryFlowRateFunction (
new boundaryFlowRateFunction_Type() );
433 boundaryFlowRateFunction->setModel (
this );
434 boundaryFlowRateFunction->setFluidFlag ( boundaryFlag ( boundaryID ) );
435 boundaryFlowRateFunction->setFunction ( function);
436 boundaryFlowRateFunction->setBoundaryFlowRateType ( Strong );
438 M_boundaryFlowRateFunctions.push_back ( boundaryFlowRateFunction );
440 base.setFunction ( std::bind ( &FSI3DBoundaryFlowRateFunction::function, M_boundaryFlowRateFunctions.back(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
441 M_fluidBC->handler()->addBC (
"CouplingFlowRate_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), boundaryFlag ( boundaryID ), EssentialVertices, Full, base, 3 );
449 boundaryFlowRateFunctionPtr_Type boundaryFlowRateFunction (
new boundaryFlowRateFunction_Type() );
450 boundaryFlowRateFunction->setModel (
this );
451 boundaryFlowRateFunction->setFluidFlag ( boundaryFlag ( boundaryID ) );
452 boundaryFlowRateFunction->setFunction ( function);
453 boundaryFlowRateFunction->setBoundaryFlowRateType ( Semiweak );
455 M_boundaryFlowRateFunctions.push_back ( boundaryFlowRateFunction );
457 base.setFunction ( std::bind ( &FSI3DBoundaryFlowRateFunction::function, M_boundaryFlowRateFunctions.back(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
458 M_fluidBC->handler()->addBC (
"CouplingFlowRate_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), boundaryFlag ( boundaryID ), Flux, Full, base, 3 );
465 base.setFunction ( function );
466 M_fluidBC->handler()->addBC (
"CouplingFlowRate_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), boundaryFlag ( boundaryID ), Flux, Full, base, 3 );
471 base.setFunction ( function );
472 M_fluidBC->handler()->addBC (
"CouplingFlowRate_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), boundaryFlag ( boundaryID ), Flux, Full, base, 3 );
477 MultiscaleModelFSI3D::imposeBoundaryMeanNormalStress (
const multiscaleID_Type& boundaryID,
const function_Type& function )
480 #ifdef FSI_WITH_EXTERNALPRESSURE 481 base.setFunction ( function );
483 boundaryStressFunctionPtr_Type boundaryStressFunction (
new boundaryStressFunction_Type() );
484 boundaryStressFunction->setDelta ( M_data->dataSolid()->externalPressure() );
485 boundaryStressFunction->setFunction ( function);
487 M_boundaryStressFunctions.push_back ( boundaryStressFunction );
489 base.setFunction ( std::bind ( &FSI3DBoundaryStressFunction::function, M_boundaryStressFunctions.back(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
491 M_fluidBC->handler()->addBC (
"BoundaryStress_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), boundaryFlag ( boundaryID ), Natural, Normal, base );
495 MultiscaleModelFSI3D::imposeBoundaryArea (
const multiscaleID_Type& boundaryID,
const function_Type& function )
498 boundaryAreaFunctionPtr_Type boundaryAreaFunction (
new boundaryAreaFunction_Type() );
499 boundaryAreaFunction->setModel (
this );
500 boundaryAreaFunction->setFluidFlag ( boundaryFlag ( boundaryID ) );
501 boundaryAreaFunction->setFunction ( function);
503 M_boundaryAreaFunctions.push_back ( boundaryAreaFunction );
506 base.setFunction ( std::bind ( &FSI3DBoundaryAreaFunction::function, M_boundaryAreaFunctions.back(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
507 M_solidBC->handler()->addBC (
"BoundaryArea_Model_" + number2string ( M_ID ) +
"_BoundaryID_" + number2string ( boundaryID ), M_boundaryFlagsArea[boundaryID], EssentialEdges, Full, base, 3 );
512 MultiscaleModelFSI3D::boundaryMeanNormalStress (
const multiscaleID_Type& boundaryID )
const 514 #ifdef FSI_WITH_EXTERNALPRESSURE 515 return M_FSIoperator->fluid().meanNormalStress ( boundaryFlag ( boundaryID ), *M_fluidBC->handler(), *M_stateVariable );
517 return M_FSIoperator->fluid().meanNormalStress ( boundaryFlag ( boundaryID ), *M_fluidBC->handler(), *M_stateVariable ) - M_externalPressureScalar;
522 MultiscaleModelFSI3D::boundaryMeanTotalNormalStress (
const multiscaleID_Type& boundaryID )
const 524 #ifdef FSI_WITH_EXTERNALPRESSURE 525 return M_FSIoperator->fluid().meanTotalNormalStress ( boundaryFlag ( boundaryID ), *M_fluidBC->handler(), *M_stateVariable );
527 return M_FSIoperator->fluid().meanTotalNormalStress ( boundaryFlag ( boundaryID ), *M_fluidBC->handler(), *M_stateVariable ) - M_externalPressureScalar;
532 MultiscaleModelFSI3D::boundaryDeltaFlowRate (
const multiscaleID_Type& boundaryID,
bool& solveLinearSystem )
534 solveLinearModel ( solveLinearSystem );
536 return M_FSIoperator->fluid().flux ( boundaryFlag ( boundaryID ), *M_linearSolution );
540 MultiscaleModelFSI3D::boundaryDeltaMeanNormalStress (
const multiscaleID_Type& boundaryID,
bool& solveLinearSystem )
542 solveLinearModel ( solveLinearSystem );
544 return M_FSIoperator->fluid().linearMeanNormalStress ( boundaryFlag ( boundaryID ), *M_linearFluidBC, *M_linearSolution );
548 MultiscaleModelFSI3D::boundaryDeltaMeanTotalNormalStress (
const multiscaleID_Type& boundaryID,
bool& solveLinearSystem )
550 solveLinearModel ( solveLinearSystem );
552 return M_FSIoperator->fluid().linearMeanTotalNormalStress ( boundaryFlag ( boundaryID ), *M_linearFluidBC, *M_stateVariable, *M_linearSolution );
559 MultiscaleModelFSI3D::boundaryPressure (
const multiscaleID_Type& boundaryID )
const 561 #ifdef FSI_WITH_EXTERNALPRESSURE 562 return M_FSIoperator->fluid().pressure ( boundaryFlag ( boundaryID ), *M_stateVariable );
564 return M_FSIoperator->fluid().pressure ( boundaryFlag ( boundaryID ), *M_stateVariable ) + M_externalPressureScalar;
569 MultiscaleModelFSI3D::boundaryTotalPressure (
const multiscaleID_Type& boundaryID )
const 571 #ifdef FSI_WITH_EXTERNALPRESSURE 572 return M_FSIoperator->fluid().pressure ( boundaryFlag ( boundaryID ), *M_stateVariable )
573 + M_FSIoperator->fluid().kineticNormalStress ( boundaryFlag ( boundaryID ), *M_stateVariable );
575 return M_FSIoperator->fluid().pressure ( boundaryFlag ( boundaryID ), *M_stateVariable )
576 + M_FSIoperator->fluid().kineticNormalStress ( boundaryFlag ( boundaryID ), *M_stateVariable ) + M_externalPressureScalar;
581 MultiscaleModelFSI3D::externalPressure()
const 583 #ifndef FSI_WITH_EXTERNALPRESSURE 584 return M_externalPressureScalar;
586 return M_data->dataSolid()->externalPressure();
594 MultiscaleModelFSI3D::setupGlobalData (
const std::string& fileName )
596 GetPot dataFile ( fileName );
599 M_data->dataFluid()->setTimeData ( M_globalData->dataTime() );
600 M_data->dataSolid()->setTimeData ( M_globalData->dataTime() );
601 M_data->setTimeDataALE ( M_globalData->dataTime() );
604 if ( !dataFile.checkVariable (
"fluid/physics/density" ) )
606 M_data->dataFluid()->setDensity ( M_globalData->fluidDensity() );
608 if ( !dataFile.checkVariable (
"fluid/physics/viscosity" ) )
610 M_data->dataFluid()->setViscosity ( M_globalData->fluidViscosity() );
614 if ( !dataFile.checkVariable (
"solid/physics/density" ) )
616 M_data->dataSolid()->setDensity ( M_globalData->solidDensity() );
618 if ( !dataFile.checkVariable (
"solid/physics/externalPressure" ) )
620 M_data->dataSolid()->setExternalPressure ( M_globalData->solidExternalPressure() );
623 std::vector< UInt > materialFlags;
624 if ( !dataFile.checkVariable (
"solid/physics/material_flag" ) )
626 materialFlags.push_back ( 1 );
629 for ( UInt i ( 0 ) ; i < dataFile.vector_variable_size (
"solid/physics/material_flag" ) ; ++i )
631 materialFlags.push_back ( dataFile (
"solid/physics/material_flag", 1, i ) );
634 for ( std::vector< UInt >::const_iterator i = materialFlags.begin(); i != materialFlags.end() ; ++i )
636 if ( !dataFile.checkVariable (
"solid/physics/poisson" ) )
638 M_data->dataSolid()->setPoisson ( M_globalData->solidPoissonCoefficient(), *i );
640 if ( !dataFile.checkVariable (
"solid/physics/young" ) )
642 M_data->dataSolid()->setYoung ( M_globalData->solidYoungModulus(), *i );
648 MultiscaleModelFSI3D::initializeSolution()
651 #ifdef HAVE_LIFEV_DEBUG 652 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::initializeSolution() \n";
655 #ifndef FSI_WITH_EXTERNALPRESSURE 657 M_externalPressureScalar = M_data->dataSolid()->externalPressure();
658 M_data->dataSolid()->setExternalPressure ( 0.0 );
661 if ( multiscaleProblemStep > 0 )
663 M_importerFluid->setMeshProcId ( M_FSIoperator->uFESpace().mesh(), M_FSIoperator->uFESpace().map().comm().MyPID() );
664 M_importerSolid->setMeshProcId ( M_FSIoperator->dFESpace().mesh(), M_FSIoperator->dFESpace().map().comm().MyPID() );
666 M_importerFluid->addVariable ( IOData_Type::VectorField,
"Velocity (fluid)", M_FSIoperator->uFESpacePtr(), M_fluidVelocity,
static_cast <UInt> (0) );
667 M_importerFluid->addVariable ( IOData_Type::ScalarField,
"Pressure (fluid)", M_FSIoperator->pFESpacePtr(), M_fluidPressure,
static_cast <UInt> (0) );
668 M_importerFluid->addVariable ( IOData_Type::VectorField,
"Displacement (fluid)", M_FSIoperator->mmFESpacePtr(), M_fluidDisplacement,
static_cast <UInt> (0) );
669 M_importerSolid->addVariable ( IOData_Type::VectorField,
"Displacement (solid)", M_FSIoperator->dFESpacePtr(), M_solidDisplacement,
static_cast <UInt> (0) );
672 for ( UInt i (0); i < M_FSIoperator->fluidTimeAdvance()->size() ; ++i )
674 UInt iterationImported (0);
675 iterationImported = M_importerFluid->importFromTime ( M_data->dataFluid()->dataTime()->initialTime() - i * M_data->dataFluid()->dataTime()->timeStep() );
676 iterationImported = M_importerSolid->importFromTime ( M_data->dataSolid()->dataTime()->initialTime() - i * M_data->dataSolid()->dataTime()->timeStep() );
679 M_exporterFluid->setTimeIndex ( iterationImported + 1 );
680 M_exporterSolid->setTimeIndex ( iterationImported + 1 );
683 #ifndef FSI_WITH_EXTERNALPRESSURE 685 *M_fluidPressure -= M_externalPressureScalar;
688 M_FSIoperator->setFluidVectorInStencil ( M_fluidVelocity, M_fluidPressure, i );
689 M_FSIoperator->setSolidVectorInStencil ( M_solidDisplacement, i );
693 M_importerSolid->importFromTime ( M_data->dataSolid()->dataTime()->initialTime() - M_FSIoperator->fluidTimeAdvance()->size() * M_data->dataSolid()->dataTime()->timeStep() );
694 M_FSIoperator->setSolidVectorInStencil ( M_solidDisplacement, M_FSIoperator->fluidTimeAdvance()->size() );
697 for ( UInt i (0); i < M_FSIoperator->ALETimeAdvance()->size() ; ++i )
699 M_importerFluid->importFromTime ( M_data->dataFluid()->dataTime()->initialTime() - (i + 1) * M_data->dataFluid()->dataTime()->timeStep() );
701 M_FSIoperator->setALEVectorInStencil ( M_fluidDisplacement, i,
false );
705 M_importerFluid->importFromTime ( M_data->dataSolid()->dataTime()->initialTime() );
708 if ( M_data->method().compare (
"monolithicGI") == 0 )
711 M_FSIoperator->setALEVectorInStencil ( M_fluidDisplacement, 10,
true );
715 M_FSIoperator->ALETimeAdvance()->shiftRight ( *M_fluidDisplacement );
718 M_FSIoperator->finalizeRestart();
721 exportFluidSolution();
722 exportSolidSolution();
725 if ( M_FSIoperator->isFluid() )
727 M_importerFluid->closeFile();
729 if ( M_FSIoperator->isSolid() )
731 M_importerSolid->closeFile();
739 *M_fluidVelocity *= 0.0;
740 *M_fluidPressure = M_data->dataSolid()->externalPressure();
741 *M_solidDisplacement *= 0.0;
742 *M_fluidDisplacement *= 0.0;
744 for ( UInt i (0); i < M_FSIoperator->fluidTimeAdvance()->size() ; ++i )
746 M_FSIoperator->setFluidVectorInStencil ( M_fluidVelocity, M_fluidPressure, i );
747 M_FSIoperator->setSolidVectorInStencil ( M_solidDisplacement, i );
750 M_FSIoperator->setSolidVectorInStencil ( M_solidDisplacement, M_FSIoperator->fluidTimeAdvance()->size() );
752 for ( UInt i (0); i < M_FSIoperator->ALETimeAdvance()->size() ; ++i )
754 M_FSIoperator->setALEVectorInStencil ( M_fluidDisplacement, i,
false );
758 if ( M_data->method().compare (
"monolithicGI") == 0 )
761 M_FSIoperator->setALEVectorInStencil ( M_fluidDisplacement, 10,
true );
765 M_FSIoperator->ALETimeAdvance()->shiftRight ( *M_fluidDisplacement );
768 M_FSIoperator->finalizeRestart();
772 M_stateVariable.reset (
new vector_Type ( M_FSIoperator->fluidTimeAdvance()->singleElement (0) ) );
776 MultiscaleModelFSI3D::setupCommunicator()
778 M_FSIoperator->setFluid (
true );
779 M_FSIoperator->setSolid (
true );
781 M_FSIoperator->setFluidLeader ( 0 );
782 M_FSIoperator->setSolidLeader ( 0 );
784 M_FSIoperator->setComm ( M_comm, M_comm );
788 MultiscaleModelFSI3D::setupBC (
const std::string& fileName )
790 if ( M_FSIoperator->isFluid() )
792 M_fluidBC->createHandler();
793 M_fluidBC->fillHandler ( fileName,
"fluid" );
795 M_FSIoperator->setFluidBC ( M_fluidBC->handler() );
797 M_harmonicExtensionBC->createHandler();
798 M_harmonicExtensionBC->fillHandler ( fileName,
"mesh_motion" );
800 M_FSIoperator->setHarmonicExtensionBC ( M_harmonicExtensionBC->handler() );
803 if ( M_FSIoperator->isSolid() )
805 M_solidBC->createHandler();
806 M_solidBC->fillHandler ( fileName,
"solid" );
808 M_FSIoperator->setSolidBC ( M_solidBC->handler() );
813 MultiscaleModelFSI3D::updateBC()
815 #ifndef FSI_WITHOUT_VELOCITYPROFILE 816 for ( boundaryFlowRateFunctionsContainerIterator_Type i = M_boundaryFlowRateFunctions.begin() ; i != M_boundaryFlowRateFunctions.end() ; ++i )
818 ( *i )->updateParameters();
822 if ( M_FSIoperator->isFluid() )
824 M_fluidBC->updatePhysicalSolverVariables();
825 M_harmonicExtensionBC->updatePhysicalSolverVariables();
827 if ( M_FSIoperator->isSolid() )
829 M_solidBC->updatePhysicalSolverVariables();
834 MultiscaleModelFSI3D::setupExporter ( IOFilePtr_Type& exporter,
const GetPot& dataFile,
const std::string& label )
836 const std::string exporterType = dataFile (
"exporter/type",
"ensight" );
838 if ( exporterType.compare (
"hdf5" ) == 0 )
840 exporter.reset (
new hdf5IOFile_Type() );
844 exporter.reset (
new ensightIOFile_Type() );
846 exporter->setDataFromGetPot ( dataFile );
847 exporter->setPrefix ( multiscaleProblemPrefix +
"_Model_" + number2string ( M_ID ) + label +
"_" + number2string ( multiscaleProblemStep ) );
848 exporter->setPostDir ( multiscaleProblemFolder );
852 MultiscaleModelFSI3D::setupImporter ( IOFilePtr_Type& importer,
const GetPot& dataFile,
const std::string& label )
854 const std::string importerType = dataFile (
"exporter/type",
"ensight" );
856 if ( importerType.compare (
"hdf5" ) == 0 )
858 importer.reset (
new hdf5IOFile_Type() );
862 importer.reset (
new ensightIOFile_Type() );
864 importer->setDataFromGetPot ( dataFile );
865 importer->setPrefix ( multiscaleProblemPrefix +
"_Model_" + number2string ( M_ID ) + label +
"_" + number2string ( multiscaleProblemStep - 1 ) );
866 importer->setPostDir ( multiscaleProblemFolder );
870 MultiscaleModelFSI3D::setExporterFluid (
const IOFilePtr_Type& exporter )
872 M_fluidVelocity.reset (
new vector_Type ( M_FSIoperator->uFESpace().map(), M_exporterFluid->mapType() ) );
873 M_fluidPressure.reset (
new vector_Type ( M_FSIoperator->pFESpace().map(), M_exporterFluid->mapType() ) );
874 M_fluidDisplacement.reset (
new vector_Type ( M_FSIoperator->mmFESpace().map(), M_exporterFluid->mapType() ) );
876 exporter->setMeshProcId ( M_FSIoperator->uFESpace().mesh(), M_FSIoperator->uFESpace().map().comm().MyPID() );
878 exporter->addVariable ( IOData_Type::VectorField,
"Velocity (fluid)", M_FSIoperator->uFESpacePtr(), M_fluidVelocity,
static_cast<UInt> ( 0 ) );
879 exporter->addVariable ( IOData_Type::ScalarField,
"Pressure (fluid)", M_FSIoperator->pFESpacePtr(), M_fluidPressure,
static_cast<UInt> ( 0 ) );
880 exporter->addVariable ( IOData_Type::VectorField,
"Displacement (fluid)", M_FSIoperator->mmFESpacePtr(), M_fluidDisplacement,
static_cast<UInt> ( 0 ) );
884 MultiscaleModelFSI3D::setExporterSolid (
const IOFilePtr_Type& exporter )
886 M_solidDisplacement.reset (
new vector_Type ( M_FSIoperator->dFESpace().map(), M_exporterSolid->mapType() ) );
887 M_solidVelocity.reset (
new vector_Type ( M_FSIoperator->dFESpace().map(), M_exporterSolid->mapType() ) );
890 M_solidStressXX.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
891 M_solidStressXY.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
892 M_solidStressXZ.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
893 M_solidStressYY.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
894 M_solidStressYZ.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
895 M_solidStressZZ.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
896 M_solidStressVonMises.reset (
new vector_Type ( M_wallTensionEstimator->feSpaceScalar().map(), M_exporterSolid->mapType() ) );
899 exporter->setMeshProcId ( M_FSIoperator->dFESpace().mesh(), M_FSIoperator->dFESpace().map().comm().MyPID() );
901 exporter->addVariable ( IOData_Type::VectorField,
"Displacement (solid)", M_FSIoperator->dFESpacePtr(), M_solidDisplacement,
static_cast<UInt> ( 0 ) );
902 exporter->addVariable ( IOData_Type::VectorField,
"Velocity (solid)", M_FSIoperator->dFESpacePtr(), M_solidVelocity,
static_cast<UInt> ( 0 ) );
905 exporter->addVariable ( IOData_Type::ScalarField,
"Stress XX (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressXX,
static_cast<UInt> ( 0 ) );
906 exporter->addVariable ( IOData_Type::ScalarField,
"Stress XY (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressXY,
static_cast<UInt> ( 0 ) );
907 exporter->addVariable ( IOData_Type::ScalarField,
"Stress XZ (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressXZ,
static_cast<UInt> ( 0 ) );
908 exporter->addVariable ( IOData_Type::ScalarField,
"Stress YY (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressYY,
static_cast<UInt> ( 0 ) );
909 exporter->addVariable ( IOData_Type::ScalarField,
"Stress YZ (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressYZ,
static_cast<UInt> ( 0 ) );
910 exporter->addVariable ( IOData_Type::ScalarField,
"Stress ZZ (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressZZ,
static_cast<UInt> ( 0 ) );
911 exporter->addVariable ( IOData_Type::ScalarField,
"Stress Von Mises (solid)", M_wallTensionEstimator->feSpaceScalarPtr(), M_solidStressVonMises,
static_cast<UInt> ( 0 ) );
916 MultiscaleModelFSI3D::exportFluidSolution()
918 if ( M_FSIoperator->isFluid() )
920 M_FSIoperator->exportFluidVelocity ( *M_fluidVelocity );
921 M_FSIoperator->exportFluidPressure ( *M_fluidPressure );
922 M_FSIoperator->exportFluidDisplacement ( *M_fluidDisplacement );
924 #ifndef FSI_WITH_EXTERNALPRESSURE 926 *M_fluidPressure += M_externalPressureScalar;
932 MultiscaleModelFSI3D::exportSolidSolution()
934 if ( M_FSIoperator->isSolid() )
936 M_FSIoperator->exportSolidDisplacement ( *M_solidDisplacement );
937 M_FSIoperator->exportSolidVelocity ( *M_solidVelocity );
940 M_wallTensionEstimator->setDisplacement ( *M_solidDisplacement );
941 M_wallTensionEstimator->analyzeTensionsRecoveryVonMisesStress ( );
943 M_wallTensionEstimator->exportStressXX ( *M_solidStressXX );
944 M_wallTensionEstimator->exportStressXY ( *M_solidStressXY );
945 M_wallTensionEstimator->exportStressXZ ( *M_solidStressXZ );
946 M_wallTensionEstimator->exportStressYY ( *M_solidStressYY );
947 M_wallTensionEstimator->exportStressYZ ( *M_solidStressYZ );
948 M_wallTensionEstimator->exportStressZZ ( *M_solidStressZZ );
949 M_wallTensionEstimator->exportStressVonMises ( *M_solidStressVonMises );
955 MultiscaleModelFSI3D::setupLinearModel()
958 #ifdef HAVE_LIFEV_DEBUG 959 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::setupLinearModel() \n";
963 M_linearFluidBC.reset (
new bc_Type ( *M_fluidBC->handler() ) );
964 M_linearSolidBC.reset (
new bc_Type ( *M_solidBC->handler() ) );
967 BCFunctionBase bcBaseDeltaZero;
968 bcBaseDeltaZero.setFunction ( std::bind ( &MultiscaleModelFSI3D::bcFunctionDeltaZero,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
970 for ( bc_Type::bcBaseIterator_Type i = M_linearFluidBC->begin() ; i != M_linearFluidBC->end() ; ++i )
972 i->setBCFunction ( bcBaseDeltaZero );
975 for ( bc_Type::bcBaseIterator_Type i = M_linearSolidBC->begin() ; i != M_linearSolidBC->end() ; ++i )
977 i->setBCFunction ( bcBaseDeltaZero );
981 M_linearSolution.reset (
new vector_Type ( *M_FSIoperator->couplingVariableMap() ) );
982 M_linearRHS.reset (
new vector_Type ( *M_FSIoperator->couplingVariableMap() ) );
986 MultiscaleModelFSI3D::updateLinearModel()
989 #ifdef HAVE_LIFEV_DEBUG 990 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::updateLinearModel() \n";
995 M_FSIoperator->bcManageVectorRHS ( M_linearFluidBC, M_linearSolidBC, *M_linearRHS );
999 MultiscaleModelFSI3D::solveLinearModel (
bool& solveLinearSystem )
1002 #ifdef HAVE_LIFEV_DEBUG 1003 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::solveLinearModel() \n";
1006 if ( !solveLinearSystem )
1011 imposePerturbation();
1013 updateLinearModel();
1016 displayModelStatus (
"Solve linear" );
1017 M_FSIoperator->solveJac ( *M_linearSolution, *M_linearRHS, 0. );
1019 resetPerturbation();
1022 solveLinearSystem =
false;
1026 MultiscaleModelFSI3D::imposePerturbation()
1029 #ifdef HAVE_LIFEV_DEBUG 1030 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::imposePerturbation() \n";
1033 for ( multiscaleCouplingsContainerConstIterator_Type i = M_couplings.begin(); i < M_couplings.end(); ++i )
1034 if ( ( *i )->isPerturbed() )
1036 BCFunctionBase bcBaseDeltaOne;
1038 multiscaleID_Type boundaryID ( ( *i )->boundaryID ( ( *i )->modelGlobalToLocalID ( M_ID ) ) );
1039 if ( M_boundaryFlagsAreaPerturbed[boundaryID] ==
true )
1041 for ( boundaryAreaFunctionsContainerIterator_Type j = M_boundaryAreaFunctions.begin(); j < M_boundaryAreaFunctions.end(); ++j )
1042 if ( ( *j )->fluidFlag() == boundaryFlag ( boundaryID ) )
1044 bcBaseDeltaOne.setFunction ( std::bind ( &FSI3DBoundaryAreaFunction::functionLinear, *j, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
1045 M_linearSolidBC->findBCWithFlag ( M_boundaryFlagsArea[boundaryID] ).setBCFunction ( bcBaseDeltaOne );
1050 bcBaseDeltaOne.setFunction ( std::bind ( &MultiscaleModelFSI3D::bcFunctionDeltaOne,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
1051 M_linearFluidBC->findBCWithFlag ( boundaryFlag ( boundaryID ) ).setBCFunction ( bcBaseDeltaOne );
1059 MultiscaleModelFSI3D::resetPerturbation()
1062 #ifdef HAVE_LIFEV_DEBUG 1063 debugStream ( 8140 ) <<
"MultiscaleModelFSI3D::resetPerturbation() \n";
1066 for ( multiscaleCouplingsContainerConstIterator_Type i = M_couplings.begin(); i < M_couplings.end(); ++i )
1067 if ( ( *i )->isPerturbed() )
1069 BCFunctionBase bcBaseDeltaZero;
1070 bcBaseDeltaZero.setFunction ( std::bind ( &MultiscaleModelFSI3D::bcFunctionDeltaZero,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
1072 multiscaleID_Type boundaryID ( ( *i )->boundaryID ( ( *i )->modelGlobalToLocalID ( M_ID ) ) );
1073 if ( M_boundaryFlagsAreaPerturbed[boundaryID] ==
true )
1075 M_linearSolidBC->findBCWithFlag ( M_boundaryFlagsArea[boundaryID] ).setBCFunction ( bcBaseDeltaZero );
1079 M_linearFluidBC->findBCWithFlag ( boundaryFlag ( boundaryID ) ).setBCFunction ( bcBaseDeltaZero );
1080 M_boundaryFlagsAreaPerturbed[boundaryID] =
true;
#define FSI_WITH_BOUNDARYAREA
#define FSI_WITH_STRESSOUTPUT