36 #include <lifev/core/LifeV.hpp> 37 #include <lifev/fsi_blocks/solver/FSIHandler.hpp> 91 M_datafile = dataFile;
98 Teuchos::RCP<Teuchos::ParameterList> solversOptions = Teuchos::getParametersFromXmlFile (
"solversOptionsFast.xml");
99 std::string precType = M_datafile (
"fluid/preconditionerType",
"none");
100 M_prec->setFluidPreconditioner(precType);
101 M_prec->setOptions(*solversOptions);
102 setSolversOptions(*solversOptions);
108 std::shared_ptr<Teuchos::ParameterList> monolithicOptions;
109 monolithicOptions.reset(
new Teuchos::ParameterList(solversOptions.sublist(
"MonolithicOperator")) );
110 M_pListLinSolver = monolithicOptions;
116 M_fluidMesh.reset (
new mesh_Type ( M_comm ) );
117 M_meshDataFluid.reset(
new MeshData ( ) );
118 M_meshDataFluid->setup (M_datafile,
"fluid/space_discretization");
119 readMesh (*M_fluidMesh, *M_meshDataFluid);
120 int severityLevelFluid = M_fluidMesh->check(1,
true,
true);
122 M_displayer.leaderPrintMax (
"\tSeverity Level fluid mesh is: ", severityLevelFluid ) ;
124 M_structureMesh.reset (
new mesh_Type ( M_comm ) );
125 M_meshDataStructure.reset(
new MeshData ( ) );
126 M_meshDataStructure->setup (M_datafile,
"solid/space_discretization");
127 readMesh (*M_structureMesh, *M_meshDataStructure);
128 int severityLevelSolid = M_structureMesh->check(1,
true,
true);
130 M_displayer.leaderPrintMax (
"\tSeverity Level solid mesh is: ", severityLevelSolid ) ;
137 M_fluidPartitioner.reset (
new MeshPartitioner< mesh_Type > (M_fluidMesh, M_comm) );
138 M_fluidLocalMesh.reset (
new mesh_Type ( M_comm ) );
139 M_fluidLocalMesh = M_fluidPartitioner->meshPartition();
141 M_structurePartitioner.reset (
new MeshPartitioner< mesh_Type > (M_structureMesh, M_comm) );
142 M_structureLocalMesh.reset (
new mesh_Type ( M_comm ) );
143 M_structureLocalMesh = M_structurePartitioner->meshPartition();
149 const std::string fluidHdf5File (M_datafile (
"offlinePartioner/fluidPartitionedMesh",
"fluid.h5") );
150 const std::string solidHdf5File (M_datafile (
"offlinePartioner/solidPartitionedMesh",
"solid.h5") );
152 std::shared_ptr<Epetra_MpiComm> comm = std::dynamic_pointer_cast<Epetra_MpiComm>(M_comm);
155 M_displayer.leaderPrint (
"\tReading the fluid mesh parts\n" ) ;
156 PartitionIO<mesh_Type > partitionIO (fluidHdf5File, comm);
157 partitionIO.read (M_fluidLocalMesh);
160 M_displayer.leaderPrint (
"\tReading the solid mesh parts\n" ) ;
161 PartitionIO<mesh_Type > partitionIOstructure (solidHdf5File, comm);
162 partitionIOstructure.read (M_structureLocalMesh);
167 M_useBDF = M_datafile (
"solid/time_discretization/useBDF",
false );
169 M_linearElasticity = M_datafile (
"solid/linear_elasticity",
true );
171 M_saveEvery = M_datafile (
"exporter/save_every", 1 );
173 M_disregardRestart = M_datafile (
"exporter/disregardRestart",
false );
177 M_usePartitionedMeshes = M_datafile (
"offlinePartioner/readPartitionedMeshes",
false );
179 M_restart = M_datafile (
"importer/restart",
false );
182 M_fluid.reset (
new NavierStokesSolverBlocks ( M_datafile, M_comm ) );
183 M_fluid->setup ( M_fluidLocalMesh );
186 M_fluid->pFESpace()->setQuadRule(M_fluid->uFESpace()->qr());
191 M_structure.reset (
new LinearElasticity ( M_comm ) );
195 M_structureNeoHookean.reset (
new NeoHookean ( M_comm ) );
206 M_extrapolateInitialGuess = M_datafile (
"newton/extrapolateInitialGuess",
false );
207 M_orderExtrapolationInitialGuess = M_datafile (
"newton/orderExtrapolation", 3 );
215 M_fluid->setAlpha(M_fluidTimeAdvance->alpha());
216 M_fluid->setTimeStep(M_dt);
217 M_fluid->buildSystem();
218 M_fluid->setupPostProc();
221 M_ale.reset(
new ALESolver ( *M_aleFESpace, M_comm ) );
222 M_ale->setUp( M_datafile );
229 M_structure->assemble_matrices(M_dt, M_structureTimeAdvanceBDF->massCoefficient(), M_structureBC, M_useBDF);
233 M_structure->assemble_matrices(M_dt, M_structureTimeAdvance->get_beta(), M_structureBC, M_useBDF);
238 M_relativeTolerance = M_datafile (
"newton/reltol", 1.e-4);
239 M_absoluteTolerance = M_datafile (
"newton/abstol", 1.e-4);
240 M_etaMax = M_datafile (
"newton/etamax", 1e-4);
241 M_maxiterNonlinear = M_datafile (
"newton/maxiter", 10);
243 M_displayer.leaderPrintMax (
" Maximum Newton iterations = ", M_maxiterNonlinear ) ;
245 M_nonLinearLineSearch = M_datafile (
"newton/NonLinearLineSearch", 0);
246 if (M_comm->MyPID() == 0)
248 M_out_res.open (
"residualsNewton");
249 M_outputLinearIterations.open(
"linearIterations.dat");
250 M_outputPreconditionerComputation.open(
"preconditionerComputation.dat");
251 M_outputTimeLinearSolver.open (
"solutionLinearSystem.dat");
254 M_useShapeDerivatives = M_datafile (
"newton/useShapeDerivatives",
false);
255 M_subiterateFluidDirichlet = M_datafile (
"fluid/subiterateFluidDirichlet",
false);
257 M_printResiduals = M_datafile (
"newton/output_Residuals",
false);
258 M_printSteps = M_datafile (
"newton/output_Steps",
false);
261 M_prec->setUseShapeDerivatives(M_useShapeDerivatives);
264 M_prec->setSubiterateFluidDirichlet(M_subiterateFluidDirichlet);
267 std::string solverType(M_pListLinSolver->get<std::string>(
"Linear Solver Type"));
268 M_invOper.reset(Operators::InvertibleOperatorFactory::instance().createObject(solverType));
269 M_invOper->setParameterList(M_pListLinSolver->sublist(solverType));
272 M_prec->setComm ( M_comm );
275 if(M_comm->MyPID()==0)
277 M_outputTimeStep << std::scientific;
278 M_outputTimeStep.open (
"TimeStep.dat" );
280 if (M_printResiduals)
281 M_outputResiduals.open (
"Residuals.txt" );
284 M_outputSteps.open (
"Steps.txt" );
287 M_moveMesh = M_datafile (
"fluid/mesh/move_mesh",
true);
293 std::string outputNameFluid = M_datafile (
"exporter/fluid_filename",
"fluid");
294 std::string outputNameStructure = M_datafile (
"exporter/structure_filename",
"fluid");
295 instantiateExporter(M_exporterFluid, M_fluidLocalMesh, outputNameFluid);
296 instantiateExporter(M_exporterStructure, M_structureLocalMesh, outputNameStructure);
298 M_fluidVelocity.reset (
new VectorEpetra ( M_fluid->uFESpace()->map(), M_exporterFluid->mapType() ) );
299 M_fluidPressure.reset (
new VectorEpetra ( M_fluid->pFESpace()->map(), M_exporterFluid->mapType() ) );
300 M_fluidDisplacement.reset (
new VectorEpetra ( M_aleFESpace->map(), M_exporterFluid->mapType() ) );
301 M_Lagrange.reset (
new VectorEpetra ( M_fluid->uFESpace()->map(), M_exporterFluid->mapType() ) );
302 M_structureDisplacement.reset (
new VectorEpetra ( M_displacementFESpace->map(), M_exporterStructure->mapType() ) );
303 M_structureVelocity.reset (
new VectorEpetra ( M_displacementFESpace->map(), M_exporterStructure->mapType() ) );
304 M_structureAcceleration.reset (
new VectorEpetra ( M_displacementFESpace->map(), M_exporterStructure->mapType() ) );
306 M_fluidVelocity->zero();
307 M_fluidPressure->zero();
308 M_fluidDisplacement->zero();
310 M_structureDisplacement->zero();
311 M_structureVelocity->zero();
312 M_structureAcceleration->zero();
314 M_exporterFluid->addVariable ( ExporterData<mesh_Type>::VectorField,
"f - velocity", M_fluid->uFESpace(), M_fluidVelocity, UInt (0) );
315 M_exporterFluid->addVariable ( ExporterData<mesh_Type>::ScalarField,
"f - pressure", M_fluid->pFESpace(), M_fluidPressure, UInt (0) );
316 M_exporterFluid->addVariable ( ExporterData<mesh_Type>::VectorField,
"f - displacement", M_aleFESpace, M_fluidDisplacement, UInt (0) );
317 M_exporterFluid->addVariable ( ExporterData<mesh_Type>::VectorField,
"f - lagrange", M_fluid->uFESpace(), M_Lagrange, UInt (0) );
319 M_exporterStructure->addVariable ( ExporterData<mesh_Type>::VectorField,
"s - displacement", M_displacementFESpace, M_structureDisplacement, UInt (0) );
322 M_exporterStructure->addVariable ( ExporterData<mesh_Type>::VectorField,
"s - velocity", M_displacementFESpace, M_structureVelocity, UInt (0) );
323 M_exporterStructure->addVariable ( ExporterData<mesh_Type>::VectorField,
"s - acceleration", M_displacementFESpace, M_structureAcceleration, UInt (0) );
328 FSIHandler::instantiateExporter( std::shared_ptr< Exporter<mesh_Type > >& exporter,
329 const meshPtr_Type& localMesh,
330 const std::string& outputName)
332 std::string
const exporterType = M_datafile (
"exporter/type",
"ensight");
334 if (exporterType.compare (
"hdf5") == 0)
336 exporter.reset (
new ExporterHDF5<mesh_Type > ( M_datafile, outputName ) );
337 exporter->setPostDir (
"./" );
338 exporter->setMeshProcId ( localMesh, M_comm->MyPID() );
340 else if(exporterType.compare (
"vtk") == 0)
343 exporter.reset (
new ExporterVTK<mesh_Type > ( M_datafile, outputName ) );
344 exporter->setPostDir (
"./" );
345 exporter->setMeshProcId ( localMesh, M_comm->MyPID() );
349 void FSIHandler::setupStructure ( )
351 const std::string dOrder = M_datafile (
"solid/space_discretization/order",
"P2");
353 Real density = M_datafile(
"solid/physics/density",0.0);
354 Real young = M_datafile(
"solid/model/young",0.0);
355 Real poisson = M_datafile(
"solid/model/poisson",0.0);
357 if ( M_linearElasticity )
359 M_structure->setCoefficients(density, young, poisson);
361 if ( M_datafile(
"solid/thin_layer/use_thin",
false ) && M_datafile(
"solid/linear_elasticity",
true ) )
363 M_structure->setCoefficientsThinLayer ( M_datafile(
"solid/thin_layer/density",0.0),
364 M_datafile(
"solid/thin_layer/young_thin",0.0),
365 M_datafile(
"solid/thin_layer/poisson_thin",0.0),
366 M_datafile(
"solid/thin_layer/h_thin",0.0),
367 M_datafile(
"interface/flag",0.0) );
370 M_structure->setup(M_structureLocalMesh, dOrder);
371 M_displacementFESpace = M_structure->fespace();
372 M_displacementETFESpace = M_structure->et_fespace();
373 M_displacementFESpaceScalar.reset (
new FESpace_Type (M_structureLocalMesh, dOrder, 1, M_comm) );
377 M_structureNeoHookean->setCoefficients(density, young, poisson);
378 M_structureNeoHookean->setup(M_structureLocalMesh, dOrder);
379 M_displacementFESpace = M_structureNeoHookean->fespace();
380 M_displacementETFESpace = M_structureNeoHookean->et_fespace();
381 M_displacementFESpaceScalar.reset (
new FESpace_Type (M_structureLocalMesh, dOrder, 1, M_comm) );
384 if ( !M_usePartitionedMeshes )
385 M_displacementFESpaceSerial.reset (
new FESpace_Type (M_structureMesh, dOrder, 3, M_comm) );
387 M_displayer.leaderPrintMax (
" Number of DOFs for the structure = ", M_displacementFESpace->dof().numTotalDof()*3 ) ;
391 void FSIHandler::createAleFESpace()
393 const std::string aleOrder = M_datafile (
"ale/space_discretization/order",
"P2");
394 M_aleFESpace.reset (
new FESpace_Type (M_fluidLocalMesh, aleOrder, 3, M_comm) );
395 M_displayer.leaderPrintMax (
" Number of DOFs for the ale = ", M_aleFESpace->dof().numTotalDof()*3 ) ;
398 void FSIHandler::setBoundaryConditions (
const bcPtr_Type& fluidBC,
399 const bcPtr_Type& structureBC,
400 const bcPtr_Type& aleBC )
402 M_fluidBC.reset (
new BCHandler ( ) );
403 M_fluidBC_residual_natural.reset (
new BCHandler ( ) );
404 M_fluidBC_residual_essential.reset (
new BCHandler ( ) );
406 for ( std::vector<BCBase>::iterator it = fluidBC->begin(); it != fluidBC->end(); it++ )
408 if ( it->type() > 3 )
410 M_fluidBC->addBC( *it );
411 M_fluidBC_residual_essential->addBC( *it );
413 else if ( it->type() == 0 )
415 M_fluidBC_residual_natural->addBC( *it );
419 M_structureBC.reset (
new BCHandler ( ) );
420 M_structureBC_residual_natural.reset (
new BCHandler ( ) );
421 M_structureBC_residual_essential.reset (
new BCHandler ( ) );
423 for ( std::vector<BCBase>::iterator it = structureBC->begin(); it != structureBC->end(); it++ )
425 if ( it->type() > 3 )
427 M_structureBC->addBC( *it );
428 M_structureBC_residual_essential->addBC( *it );
430 else if ( it->type() == 0 )
432 M_structureBC_residual_natural->addBC( *it );
436 M_aleBC.reset (
new BCHandler ( ) );
437 M_aleBC_residual_natural.reset (
new BCHandler ( ) );
438 M_aleBC_residual_essential.reset (
new BCHandler ( ) );
440 for ( std::vector<BCBase>::iterator it = aleBC->begin(); it != aleBC->end(); it++ )
442 if ( it->type() > 3 )
444 M_aleBC->addBC( *it );
445 M_aleBC_residual_essential->addBC( *it );
447 else if ( it->type() == 0 )
449 M_aleBC_residual_natural->addBC( *it );
453 for ( std::vector<BCBase>::iterator it = M_interfaceFluidBC->begin(); it != M_interfaceFluidBC->end(); it++ )
455 M_aleBC->addBC( *it );
459 void FSIHandler::updateBoundaryConditions ( )
461 M_fluidBC->bcUpdate ( *M_fluid->uFESpace()->mesh(), M_fluid->uFESpace()->feBd(), M_fluid->uFESpace()->dof() );
462 M_structureBC->bcUpdate ( *M_displacementFESpace->mesh(), M_displacementFESpace->feBd(), M_displacementFESpace->dof() );
463 M_aleBC->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
464 M_aleBC_residual_essential->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
465 M_aleBC_residual_natural->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
468 void FSIHandler::initializeTimeAdvance ( )
471 M_fluidTimeAdvance.reset(
new TimeAndExtrapolationHandler ( ) );
472 M_dt = M_datafile(
"fluid/time_discretization/timestep",0.0);
473 M_t_zero = M_datafile(
"fluid/time_discretization/initialtime",0.0);
474 M_t_end = M_datafile(
"fluid/time_discretization/endtime",0.0);
475 M_orderBDF = M_datafile(
"fluid/time_discretization/BDF_order",2);
478 M_fluidTimeAdvance->setBDForder(M_orderBDF);
479 M_fluidTimeAdvance->setMaximumExtrapolationOrder(M_orderBDF);
480 M_fluidTimeAdvance->setTimeStep(M_dt);
481 vector_Type velocityInitial ( M_fluid->uFESpace()->map() );
482 std::vector<vector_Type> initialStateVelocity;
485 M_aleTimeAdvance.reset(
new TimeAndExtrapolationHandler ( ) );
486 M_aleTimeAdvance->setMaximumExtrapolationOrder(M_orderBDF);
487 M_aleTimeAdvance->setBDForder(M_orderBDF);
488 M_aleTimeAdvance->setTimeStep(M_dt);
489 vector_Type disp_mesh_initial ( M_aleFESpace->map() );
490 std::vector<vector_Type> initialStateALE;
491 std::vector<vector_Type> initialStateSolid;
495 M_structureTimeAdvanceBDF.reset (
new BDFSecondOrderDerivative );
496 M_structureTimeAdvanceBDF->setTimeStep(M_dt);
497 M_orderBDFSolid = M_datafile(
"solid/time_discretization/BDF_order",2);
498 M_structureTimeAdvanceBDF->setBDForder( M_orderBDFSolid );
503 M_structureTimeAdvance.reset (
new Newmark );
504 M_structureTimeAdvance->set_beta(0.49);
505 M_structureTimeAdvance->set_gamma(0.9);
506 M_structureTimeAdvance->set_timestep(M_dt);
512 velocityInitial.zero() ;
513 for ( UInt i = 0; i < M_orderBDF; ++i )
514 initialStateVelocity.push_back(velocityInitial);
517 disp_mesh_initial.zero() ;
518 for ( UInt i = 0; i < M_orderBDF; ++i )
519 initialStateALE.push_back(disp_mesh_initial);
524 vector_Type ds_initial ( M_displacementFESpace->map() );
526 for ( UInt i = 0; i < (M_orderBDFSolid+1); ++i )
527 initialStateSolid.push_back(ds_initial);
531 vectorPtr_Type ds_initial (
new vector_Type ( M_displacementFESpace->map() ) );
532 vectorPtr_Type vs_initial (
new vector_Type ( M_displacementFESpace->map() ) );
533 vectorPtr_Type as_initial (
new vector_Type ( M_displacementFESpace->map() ) );
537 M_structureTimeAdvance->initialize(ds_initial, vs_initial, as_initial);
542 std::string
const importerType = M_datafile (
"importer/type",
"hdf5");
543 std::string
const fileNameFluid = M_datafile (
"importer/fluid_filename",
"SolutionRestarted");
544 std::string
const fileNameStructure = M_datafile (
"importer/structure_filename",
"SolutionRestarted");
545 std::string
const initialLoaded = M_datafile (
"importer/initSol",
"NO_DEFAULT_VALUE");
547 M_importerFluid.reset (
new ExporterHDF5<mesh_Type > ( M_datafile, fileNameFluid) );
548 M_importerFluid->setMeshProcId (M_fluid->uFESpace()->mesh(), M_comm->MyPID() );
550 M_importerStructure.reset (
new ExporterHDF5<mesh_Type > ( M_datafile, fileNameStructure) );
551 M_importerStructure->setMeshProcId (M_displacementFESpace->mesh(), M_comm->MyPID() );
553 std::string iterationString;
554 iterationString = initialLoaded;
558 for (UInt iterInit = 0; iterInit < (M_orderBDF+1); iterInit++ )
560 vectorPtr_Type velocityRestart;
561 velocityRestart.reset (
new vector_Type (M_fluid->uFESpace()->map(), Unique ) );
562 velocityRestart->zero();
564 vectorPtr_Type pressureRestart;
565 pressureRestart.reset (
new vector_Type (M_fluid->pFESpace()->map(), Unique ) );
566 pressureRestart->zero();
568 vectorPtr_Type aleRestart;
569 aleRestart.reset (
new vector_Type (M_aleFESpace->map(), Unique ) );
572 vectorPtr_Type lagrangeRestart;
573 lagrangeRestart.reset (
new vector_Type (M_fluid->uFESpace()->map(), Unique ) );
574 lagrangeRestart->zero();
576 vectorPtr_Type structureRestart;
577 structureRestart.reset (
new vector_Type (M_displacementFESpace->map(), Unique ) );
578 structureRestart->zero();
580 LifeV::ExporterData<mesh_Type> velocityReader (LifeV::ExporterData<mesh_Type>::VectorField,
581 std::string (
"f - velocity." + iterationString),
585 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
587 LifeV::ExporterData<mesh_Type> pressureReader (LifeV::ExporterData<mesh_Type>::ScalarField,
588 std::string (
"f - pressure." + iterationString),
592 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
594 LifeV::ExporterData<mesh_Type> aleReader (LifeV::ExporterData<mesh_Type>::VectorField,
595 std::string (
"f - displacement." + iterationString),
599 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
601 LifeV::ExporterData<mesh_Type> lagrangeReader (LifeV::ExporterData<mesh_Type>::VectorField,
602 std::string (
"f - lagrange." + iterationString),
606 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
608 LifeV::ExporterData<mesh_Type> structureReader(LifeV::ExporterData<mesh_Type>::VectorField,
609 std::string (
"s - displacement." + iterationString),
610 M_displacementFESpace,
613 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
615 M_importerFluid->readVariable (velocityReader);
616 M_importerFluid->readVariable (pressureReader);
617 M_importerFluid->readVariable (aleReader);
618 M_importerFluid->readVariable (lagrangeReader);
619 M_importerStructure->readVariable (structureReader);
621 int iterations = std::atoi (iterationString.c_str() );
625 *M_fluidVelocity = *velocityRestart;
626 *M_fluidPressure = *pressureRestart;
627 *M_fluidDisplacement = *aleRestart;
628 *M_Lagrange = *lagrangeRestart;
629 *M_structureDisplacement = *structureRestart;
632 if ( M_datafile (
"importer/change_dt",
false ) )
634 Real previousDt = M_datafile (
"importer/previous_dt", 0.0001 );
635 iterations = iterations - M_dt/previousDt;
642 std::ostringstream iter;
644 iter << std::setw (5) << ( iterations );
645 iterationString = iter.str();
647 if ( iterInit < M_orderBDFSolid )
649 initialStateVelocity.push_back(*velocityRestart);
650 initialStateALE.push_back(*aleRestart);
652 initialStateSolid.push_back(*structureRestart);
655 std::reverse(initialStateVelocity.begin(),initialStateVelocity.end());
656 std::reverse(initialStateALE.begin(),initialStateALE.end());
657 std::reverse(initialStateSolid.begin(),initialStateSolid.end());
661 for (UInt iterInit = 0; iterInit < M_orderBDF; iterInit++ )
663 vectorPtr_Type velocityRestart;
664 velocityRestart.reset (
new vector_Type (M_fluid->uFESpace()->map(), Unique ) );
665 velocityRestart->zero();
667 vectorPtr_Type pressureRestart;
668 pressureRestart.reset (
new vector_Type (M_fluid->pFESpace()->map(), Unique ) );
669 pressureRestart->zero();
671 vectorPtr_Type aleRestart;
672 aleRestart.reset (
new vector_Type (M_aleFESpace->map(), Unique ) );
675 vectorPtr_Type lagrangeRestart;
676 lagrangeRestart.reset (
new vector_Type (M_fluid->uFESpace()->map(), Unique ) );
677 lagrangeRestart->zero();
679 vectorPtr_Type structureRestart;
680 structureRestart.reset (
new vector_Type (M_displacementFESpace->map(), Unique ) );
681 structureRestart->zero();
683 vectorPtr_Type structureVelocityRestart;
684 structureVelocityRestart.reset (
new vector_Type (M_displacementFESpace->map(), Unique ) );
685 structureVelocityRestart->zero();
687 vectorPtr_Type structureAccelerationRestart;
688 structureAccelerationRestart.reset (
new vector_Type (M_displacementFESpace->map(), Unique ) );
689 structureAccelerationRestart->zero();
691 LifeV::ExporterData<mesh_Type> velocityReader (LifeV::ExporterData<mesh_Type>::VectorField,
692 std::string (
"f - velocity." + iterationString),
696 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
698 LifeV::ExporterData<mesh_Type> pressureReader (LifeV::ExporterData<mesh_Type>::ScalarField,
699 std::string (
"f - pressure." + iterationString),
703 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
705 LifeV::ExporterData<mesh_Type> aleReader (LifeV::ExporterData<mesh_Type>::VectorField,
706 std::string (
"f - displacement." + iterationString),
710 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
712 LifeV::ExporterData<mesh_Type> lagrangeReader (LifeV::ExporterData<mesh_Type>::VectorField,
713 std::string (
"f - lagrange." + iterationString),
717 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
719 LifeV::ExporterData<mesh_Type> structureReader(LifeV::ExporterData<mesh_Type>::VectorField,
720 std::string (
"s - displacement." + iterationString),
721 M_displacementFESpace,
724 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
726 LifeV::ExporterData<mesh_Type> structureVelocityReader(LifeV::ExporterData<mesh_Type>::VectorField,
727 std::string (
"s - velocity." + iterationString),
728 M_displacementFESpace,
729 structureVelocityRestart,
731 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
733 LifeV::ExporterData<mesh_Type> structureAccelerationReader(LifeV::ExporterData<mesh_Type>::VectorField,
734 std::string (
"s - acceleration." + iterationString),
735 M_displacementFESpace,
736 structureAccelerationRestart,
738 LifeV::ExporterData<mesh_Type>::UnsteadyRegime );
741 M_importerFluid->readVariable (velocityReader);
742 M_importerFluid->readVariable (pressureReader);
743 M_importerFluid->readVariable (aleReader);
744 M_importerFluid->readVariable (lagrangeReader);
745 M_importerStructure->readVariable (structureReader);
746 M_importerStructure->readVariable (structureVelocityReader);
747 M_importerStructure->readVariable (structureAccelerationReader);
749 int iterations = std::atoi (iterationString.c_str() );
753 *M_fluidVelocity = *velocityRestart;
754 *M_fluidPressure = *pressureRestart;
755 *M_fluidDisplacement = *aleRestart;
756 *M_Lagrange = *lagrangeRestart;
757 *M_structureDisplacement = *structureRestart;
758 *M_structureVelocity = *structureVelocityRestart;
759 *M_structureAcceleration = *structureAccelerationRestart;
764 std::ostringstream iter;
766 iter << std::setw (5) << ( iterations );
767 iterationString = iter.str();
769 initialStateVelocity.push_back(*velocityRestart);
770 initialStateALE.push_back(*aleRestart);
774 M_structureTimeAdvance->restart(M_structureDisplacement, M_structureVelocity, M_structureAcceleration);
781 std::reverse(initialStateVelocity.begin(),initialStateVelocity.end());
782 std::reverse(initialStateALE.begin(),initialStateALE.end());
787 M_fluidTimeAdvance->initialize(initialStateVelocity);
790 M_aleTimeAdvance->initialize(initialStateALE);
795 M_structureTimeAdvanceBDF->initialize(initialStateSolid);
799 M_exporterFluid->postProcess(M_t_zero);
800 M_exporterStructure->postProcess(M_t_zero);
803 void FSIHandler::buildInterfaceMaps ()
805 M_nonconforming = M_datafile(
"interface/nonconforming",
false);
806 M_lambda_num_structure = M_datafile(
"interface/lambda_num_structure",
false);
807 markerID_Type interface = M_datafile(
"interface/flag", 1);
808 Real tolerance = M_datafile(
"interface/tolerance", 1.0);
809 Int flag = M_datafile(
"interface/fluid_vertex_flag", 123);
810 M_useMasses = M_datafile(
"interface/useMasses",
true);
812 M_displayer.leaderPrintMax (
" Flag of the interface = ", interface ) ;
813 M_displayer.leaderPrintMax (
" Tolerance for dofs on the interface = ", tolerance ) ;
815 if ( !M_nonconforming )
817 if ( !M_usePartitionedMeshes )
819 M_dofStructureToFluid.reset (
new DOFInterface3Dto3D );
820 M_dofStructureToFluid->setup ( M_fluid->uFESpace()->refFE(), M_fluid->uFESpace()->dof(), M_displacementFESpaceSerial->refFE(), M_displacementFESpaceSerial->dof() );
821 M_dofStructureToFluid->update ( *M_fluid->uFESpace()->mesh(), interface, *M_displacementFESpaceSerial->mesh(), interface, tolerance, &flag);
822 M_localDofMap.reset(
new std::map<UInt, UInt> ( M_dofStructureToFluid->localDofMap ( ) ) );
823 M_displacementFESpaceSerial.reset();
827 const std::string interfaceHdf5File (M_datafile (
"offlinePartioner/interfacePartitioned",
"interface.h5") );
828 std::shared_ptr<Epetra_MpiComm> comm = std::dynamic_pointer_cast<Epetra_MpiComm>(M_comm);
829 DOFInterfaceIO interfaceIO (interfaceHdf5File, comm);
830 interfaceIO.read (M_localDofMap);
833 createInterfaceMaps ( *M_localDofMap );
835 if ( M_lambda_num_structure )
836 constructInterfaceMap ( *M_localDofMap, M_displacementFESpace->map().map(Unique)->NumGlobalElements()/nDimensions );
838 constructInterfaceMap ( *M_localDofMap, M_fluid->uFESpace()->map().map(Unique)->NumGlobalElements()/nDimensions );
840 M_displayer.leaderPrintMax (
" Number of DOFs on the interface = ", M_lagrangeMap->mapSize() ) ;
844 M_displayer.leaderPrint (
" Using nonconforming meshes " ) ;
847 Teuchos::RCP< Teuchos::ParameterList > belosList = Teuchos::rcp (
new Teuchos::ParameterList );
848 belosList = Teuchos::getParametersFromXmlFile (
"SolverParamList_rbf3d.xml" );
850 const std::string uOrder = M_datafile (
"fluid/space_discretization/vel_order",
"P1");
851 FESpacePtr_Type fluid_FESpace_whole (
new FESpace_Type ( M_fluidMesh, uOrder, 3, M_comm) );
853 const std::string dOrder = M_datafile (
"solid/space_discretization/order",
"P1");
854 FESpacePtr_Type solid_FESpace_whole (
new FESpace_Type ( M_structureMesh, dOrder, 3, M_comm) );
856 vectorPtr_Type fluid_known (
new vector_Type ( M_fluidVelocity->map() ) );
857 vectorPtr_Type structure_known (
new vector_Type ( M_structureDisplacement->map() ) );
859 structure_known->zero();
861 M_FluidToStructureInterpolant.reset(
new interpolation_Type);
862 M_FluidToStructureInterpolant->setup(M_datafile, belosList);
863 M_FluidToStructureInterpolant->setMeshSize(MeshUtility::MeshStatistics::computeSize(*M_fluidMesh).maxH);
864 M_FluidToStructureInterpolant->setFlag( M_datafile(
"interface/flag", 1) );
865 M_FluidToStructureInterpolant->setVectors(fluid_known, structure_known);
866 M_FluidToStructureInterpolant->buildTableDofs_known ( fluid_FESpace_whole );
867 M_FluidToStructureInterpolant->buildTableDofs_unknown ( solid_FESpace_whole );
868 M_FluidToStructureInterpolant->identifyNodes_known ( );
869 M_FluidToStructureInterpolant->identifyNodes_unknown ( );
870 M_FluidToStructureInterpolant->buildKnownInterfaceMap();
871 M_FluidToStructureInterpolant->buildUnknownInterfaceMap();
872 M_FluidToStructureInterpolant->buildOperators();
873 M_FluidToStructureInterpolant->getKnownInterfaceMap(M_fluidInterfaceMap);
875 M_StructureToFluidInterpolant.reset(
new interpolation_Type);
876 M_StructureToFluidInterpolant->setup(M_datafile, belosList);
877 M_StructureToFluidInterpolant->setMeshSize(MeshUtility::MeshStatistics::computeSize(*M_structureMesh).maxH);
878 M_StructureToFluidInterpolant->setFlag( M_datafile(
"interface/flag", 1) );
879 M_StructureToFluidInterpolant->setVectors(structure_known, fluid_known);
880 M_StructureToFluidInterpolant->buildTableDofs_known ( solid_FESpace_whole );
881 M_StructureToFluidInterpolant->buildTableDofs_unknown ( fluid_FESpace_whole );
882 M_StructureToFluidInterpolant->identifyNodes_known ( );
883 M_StructureToFluidInterpolant->identifyNodes_unknown ( );
884 M_StructureToFluidInterpolant->buildKnownInterfaceMap();
885 M_StructureToFluidInterpolant->buildUnknownInterfaceMap();
886 M_StructureToFluidInterpolant->buildOperators();
887 M_StructureToFluidInterpolant->getKnownInterfaceMap(M_structureInterfaceMap);
890 M_FluidToStructureInterpolant->getInterpolationOperatorMap( M_lagrangeMapScalar );
893 M_lagrangeMap.reset (
new MapEpetra ( *M_lagrangeMapScalar ) );
894 *M_lagrangeMap += *M_lagrangeMapScalar;
895 *M_lagrangeMap += *M_lagrangeMapScalar;
898 M_FluidToStructureInterpolant->getNumerationInterfaceKnown(M_numerationInterfaceFluid);
899 M_StructureToFluidInterpolant->getNumerationInterfaceKnown(M_numerationInterfaceStructure);
903 void FSIHandler::createInterfaceMaps(std::map<ID, ID>
const& locDofMap)
905 std::vector<
int> dofInterfaceFluid;
906 dofInterfaceFluid.reserve ( locDofMap.size() );
908 std::map<ID, ID>::const_iterator i;
910 for (UInt dim = 0; dim < nDimensions; ++dim)
911 for ( i = locDofMap.begin(); i != locDofMap.end(); ++i )
913 dofInterfaceFluid.push_back (i->first + dim * M_fluid->uFESpace()->dof().numTotalDof() );
916 int* pointerToDofs (0);
917 if (dofInterfaceFluid.size() > 0)
919 pointerToDofs = &dofInterfaceFluid[0];
922 M_fluidInterfaceMap.reset (
new MapEpetra ( -1,
static_cast<
int> (dofInterfaceFluid.size() ), pointerToDofs, M_fluid->uFESpace()->map().commPtr() ) );
924 M_fluid->uFESpace()->map().commPtr()->Barrier();
926 std::vector<
int> dofInterfaceSolid;
927 dofInterfaceSolid.reserve ( locDofMap.size() );
929 for (UInt dim = 0; dim < nDimensions; ++dim)
930 for ( i = locDofMap.begin(); i != locDofMap.end(); ++i )
932 dofInterfaceSolid.push_back (i->second + dim * M_displacementFESpace->dof().numTotalDof() );
936 if (dofInterfaceSolid.size() > 0)
938 pointerToDofs = &dofInterfaceSolid[0];
941 M_structureInterfaceMap.reset (
new MapEpetra ( -1,
static_cast<
int> (dofInterfaceSolid.size() ), pointerToDofs, M_displacementFESpace->map().commPtr() ) );
944 void FSIHandler::constructInterfaceMap (
const std::map<ID, ID>& locDofMap,
945 const UInt subdomainMaxId )
947 std::map<ID, ID>::const_iterator ITrow;
949 Int numtasks = M_comm->NumProc();
950 int* numInterfaceDof (
new int[numtasks]);
951 int pid = M_comm->MyPID();
954 if ( M_lambda_num_structure )
956 numMyElements = M_structureInterfaceMap->map (Unique)->NumMyElements();
960 numMyElements = M_fluidInterfaceMap->map (Unique)->NumMyElements();
963 numInterfaceDof[pid] = numMyElements;
967 if ( M_lambda_num_structure )
969 subMap.reset (
new map_Type ( *M_structureInterfaceMap->map (Unique), (UInt) 0, subdomainMaxId) );
973 subMap.reset (
new map_Type (*M_fluidInterfaceMap->map (Unique), (UInt) 0, subdomainMaxId) );
976 M_numerationInterface.reset (
new VectorEpetra (*subMap, Unique) );
978 for (
int j = 0; j < numtasks; ++j)
980 M_comm->Broadcast ( &numInterfaceDof[j], 1, j);
983 for (
int j = numtasks - 1; j > 0 ; --j)
985 numInterfaceDof[j] = numInterfaceDof[j - 1];
987 numInterfaceDof[0] = 0;
988 for (
int j = 1; j < numtasks ; ++j)
990 numInterfaceDof[j] += numInterfaceDof[j - 1];
995 if ( M_lambda_num_structure )
997 Real M_interface = (UInt) M_structureInterfaceMap->map (Unique)->NumGlobalElements() / nDimensions;
998 for (l = 0, ITrow = locDofMap.begin(); ITrow != locDofMap.end() ; ++ITrow)
1000 if (M_structureInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->second) ) >= 0)
1002 (*M_numerationInterface) [ITrow->second ] = l + (
int) (numInterfaceDof[pid] / nDimensions);
1003 if ( (
int) (*M_numerationInterface) (ITrow->second ) != floor (l + numInterfaceDof[pid] / nDimensions + 0.2) )
1005 std::cout <<
"ERROR! the numeration of the coupling map is not correct" << std::endl;
1011 std::vector<
int> couplingVector;
1012 couplingVector.reserve ( (
int) (M_structureInterfaceMap->map (Unique)->NumMyElements() ) );
1014 for (UInt dim = 0; dim < nDimensions; ++dim)
1016 for ( ITrow = locDofMap.begin(); ITrow != locDofMap.end() ; ++ITrow)
1018 if (M_structureInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->second) ) >= 0)
1020 couplingVector.push_back ( (*M_numerationInterface) (ITrow->second ) + dim * M_interface );
1025 M_lagrangeMap.reset (
new MapEpetra (-1,
static_cast< Int> ( couplingVector.size() ), &couplingVector[0], M_comm) );
1029 Real M_interface = (UInt) M_fluidInterfaceMap->map (Unique)->NumGlobalElements() / nDimensions;
1030 for (l = 0, ITrow = locDofMap.begin(); ITrow != locDofMap.end() ; ++ITrow)
1032 if (M_fluidInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->first) ) >= 0)
1034 (*M_numerationInterface) [ITrow->first ] = l + (
int) (numInterfaceDof[pid] / nDimensions);
1035 if ( (
int) (*M_numerationInterface) (ITrow->first ) != floor (l + numInterfaceDof[pid] / nDimensions + 0.2) )
1037 std::cout <<
"ERROR! the numeration of the coupling map is not correct" << std::endl;
1043 std::vector<
int> couplingVector;
1044 couplingVector.reserve ( (
int) (M_fluidInterfaceMap->map (Unique)->NumMyElements() ) );
1046 for (UInt dim = 0; dim < nDimensions; ++dim)
1048 for ( ITrow = locDofMap.begin(); ITrow != locDofMap.end() ; ++ITrow)
1050 if (M_fluidInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->first) ) >= 0)
1052 couplingVector.push_back ( (*M_numerationInterface) (ITrow->first ) + dim * M_interface );
1057 M_lagrangeMap.reset (
new MapEpetra (-1,
static_cast< Int> ( couplingVector.size() ), &couplingVector[0], M_comm) );
1060 delete [] numInterfaceDof;
1064 FSIHandler::assembleCoupling ( )
1066 M_coupling.reset (
new FSIcouplingCE ( M_comm ) );
1068 if ( M_lambda_num_structure )
1072 M_coupling->setUp ( M_dt, M_structureInterfaceMap->mapSize()/3.0 , M_structureTimeAdvanceBDF->coefficientFirstDerivative(),
1073 M_lagrangeMap, M_fluid->uFESpace(), M_displacementFESpace, M_numerationInterface );
1077 M_coupling->setUp ( M_dt, M_structureInterfaceMap->mapSize()/3.0 , M_structureTimeAdvance->get_beta(), M_structureTimeAdvance->get_gamma(),
1078 M_lagrangeMap, M_fluid->uFESpace(), M_displacementFESpace, M_numerationInterface );
1085 M_coupling->setUp ( M_dt, M_fluidInterfaceMap->mapSize()/3.0 , M_structureTimeAdvanceBDF->coefficientFirstDerivative(),
1086 M_lagrangeMap, M_fluid->uFESpace(), M_displacementFESpace, M_numerationInterface );
1090 M_coupling->setUp ( M_dt, M_fluidInterfaceMap->mapSize()/3.0 , M_structureTimeAdvance->get_beta(), M_structureTimeAdvance->get_gamma(),
1091 M_lagrangeMap, M_fluid->uFESpace(), M_displacementFESpace, M_numerationInterface );
1095 M_coupling->buildBlocks ( *M_localDofMap, M_lambda_num_structure, M_useBDF );
1099 FSIHandler::buildMonolithicMap ( )
1102 M_monolithicMap.reset(
new map_Type ( M_fluid->uFESpace()->map() ) );
1105 *M_monolithicMap += M_fluid->pFESpace()->map();
1108 *M_monolithicMap += M_displacementFESpace->map();
1111 M_displayer.leaderPrintMax (
"\nNumber of DOFs of the Lagrange multipliers: ", M_lagrangeMap->map(Unique)->NumGlobalElements());
1112 *M_monolithicMap += *M_lagrangeMap;
1115 *M_monolithicMap += M_aleFESpace->map();
1119 FSIHandler::getMatrixStructure ( )
1121 M_matrixStructure.reset (
new matrix_Type ( M_displacementFESpace->map() ) );
1123 M_matrixStructure->zero();
1125 M_interface_mass_structure_robin.reset (
new matrix_Type ( M_displacementFESpace->map() ) );
1126 M_interface_mass_structure_robin->zero();
1128 if ( M_datafile(
"solid/robin_external_wall",
false ) )
1130 M_displayer.leaderPrint (
"\nUsing Robin BC at the external wall of the structure\n");
1131 Real alpha_robin = M_datafile(
"solid/robin_elastic", 100000.0 );
1134 QuadratureBoundary myBDQR (buildTetraBDQR (quadRuleTria7pt) );
1136 using namespace ExpressionAssembly;
1137 integrate ( boundary (M_displacementETFESpace->mesh(), M_datafile(
"solid/externalWallFlag", 210 ) ),
1139 M_displacementETFESpace,
1140 M_displacementETFESpace,
1141 value ( alpha_robin ) * dot(phi_i, phi_j)
1143 >>M_interface_mass_structure_robin;
1148 M_interface_mass_structure_robin->globalAssemble();
1150 *M_matrixStructure += *M_interface_mass_structure_robin;
1151 *M_matrixStructure += *(M_structure->jacobian());
1153 M_matrixStructure->globalAssemble();
1157 FSIHandler::get_structure_coupling_velocities ( )
1161 M_rhsStructureVelocity.reset (
new vector_Type ( M_displacementFESpace->map(), Unique ) );
1163 M_structureTimeAdvanceBDF->first_der_old_dts( *M_rhsStructureVelocity );
1165 *M_rhsStructureVelocity *= ( -1.0 / M_dt );
1170 M_structureTimeAdvance->compute_csi( );
1172 M_rhsStructureVelocity.reset (
new vector_Type ( M_displacementFESpace->map(), Unique ) );
1174 M_rhsStructureVelocity->zero();
1176 *M_rhsStructureVelocity = ( ( M_dt * M_structureTimeAdvance->get_gamma() ) * (*M_structureTimeAdvance->get_csi() ) -
1177 ( M_dt * ( 1.0 - M_structureTimeAdvance->get_gamma() ) ) * ( *M_structureTimeAdvance->old_second_derivative() ) -
1178 *M_structureTimeAdvance->old_first_derivative() );
1183 FSIHandler::updateRhsCouplingVelocities ( )
1185 if ( M_lambda_num_structure )
1187 vector_Type lambda (*M_structureInterfaceMap, Unique);
1188 structureToInterface ( lambda, *M_rhsStructureVelocity);
1189 M_rhsCouplingVelocities.reset(
new VectorEpetra ( *M_lagrangeMap ) );
1190 M_rhsCouplingVelocities->zero();
1192 std::map<ID, ID>::const_iterator ITrow;
1194 UInt interface (M_structureInterfaceMap->mapSize()/3.0 );
1195 UInt totalDofs (M_displacementFESpace->dof().numTotalDof() );
1197 for (UInt dim = 0; dim < 3; ++dim)
1199 for ( ITrow = M_localDofMap->begin(); ITrow != M_localDofMap->end() ; ++ITrow)
1201 if (M_structureInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->second ) ) >= 0 )
1203 (*M_rhsCouplingVelocities) [ (
int) (*M_numerationInterface) [ITrow->second ] + dim * interface ] = lambda ( ITrow->second + dim * totalDofs );
1210 vector_Type lambda (*M_structureInterfaceMap, Unique);
1211 structureToInterface ( lambda, *M_rhsStructureVelocity);
1212 M_rhsCouplingVelocities.reset(
new VectorEpetra ( *M_lagrangeMap ) );
1213 M_rhsCouplingVelocities->zero();
1215 std::map<ID, ID>::const_iterator ITrow;
1217 UInt interface (M_fluidInterfaceMap->mapSize()/3.0 );
1218 UInt totalDofs (M_displacementFESpace->dof().numTotalDof() );
1220 for (UInt dim = 0; dim < 3; ++dim)
1222 for ( ITrow = M_localDofMap->begin(); ITrow != M_localDofMap->end() ; ++ITrow)
1224 if (M_fluidInterfaceMap->map (Unique)->LID (
static_cast<EpetraInt_Type> (ITrow->first ) ) >= 0 )
1226 (*M_rhsCouplingVelocities) [ (
int) (*M_numerationInterface) [ITrow->first ] + dim * interface ] = lambda ( ITrow->second + dim * totalDofs );
1234 FSIHandler::updateRhsCouplingVelocities_nonconforming ( )
1237 M_StructureToFluidInterpolant->updateRhs ( M_rhsStructureVelocity );
1238 M_StructureToFluidInterpolant->interpolate();
1241 M_StructureToFluidInterpolant->getSolutionOnGamma (M_rhsCouplingVelocities);
1245 FSIHandler::structureToInterface (vector_Type& VectorOnGamma,
const vector_Type& VectorOnStructure)
1247 if (VectorOnStructure.mapType() == Repeated)
1249 vector_Type
const VectorOnStructureUnique (VectorOnStructure, Unique);
1250 structureToInterface (VectorOnGamma, VectorOnStructureUnique);
1253 if (VectorOnGamma.mapType() == Repeated)
1255 vector_Type VectorOnGammaUn (VectorOnGamma.map(), Unique);
1256 structureToInterface ( VectorOnGammaUn, VectorOnStructure);
1257 VectorOnGamma = VectorOnGammaUn;
1261 MapEpetra subMap (*VectorOnStructure.map().map (Unique), 0, VectorOnStructure.map().map (Unique)->NumGlobalElements() );
1262 vector_Type subVectorOnStructure (subMap, Unique);
1263 subVectorOnStructure.subset (VectorOnStructure, 0);
1264 VectorOnGamma = subVectorOnStructure;
1268 FSIHandler::solveFSIproblem ( )
1270 LifeChrono iterChrono;
1271 LifeChrono smallThingsChrono;
1272 M_time = M_t_zero + M_dt;
1275 M_fluidMesh.reset();
1276 M_structureMesh.reset();
1279 buildMonolithicMap ( );
1281 M_solution.reset (
new VectorEpetra ( *M_monolithicMap ) );
1286 M_solution.reset (
new VectorEpetra ( *M_monolithicMap ) );
1289 M_solution->subset(*M_fluidVelocity, M_fluid->uFESpace()->map(), 0, 0);
1290 M_solution->subset(*M_fluidPressure, M_fluid->pFESpace()->map(), 0, M_fluid->uFESpace()->map().mapSize());
1291 M_solution->subset(*M_structureDisplacement, M_displacementFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize());
1292 M_LagrangeRestart.reset(
new vector_Type (*M_lagrangeMap, Unique ) );
1293 if ( !M_nonconforming )
1295 *M_LagrangeRestart = ( *(M_coupling->fluidVelocityToLambda()) * (*M_Lagrange) );
1296 M_solution->subset(*M_LagrangeRestart, *M_lagrangeMap, 0, M_fluid->uFESpace()->map().mapSize() +
1297 M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() );
1301 vectorPtr_Type Lagrange (
new vector_Type (*M_lagrangeMap, Unique ) );
1302 M_FluidToStructureInterpolant->restrictOmegaToGamma_Known( M_Lagrange, Lagrange );
1303 *M_LagrangeRestart = *Lagrange;
1304 M_solution->subset(*M_LagrangeRestart, *M_lagrangeMap, 0, M_fluid->uFESpace()->map().mapSize() +
1305 M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() );
1307 M_solution->subset(*M_fluidDisplacement, M_aleFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize() );
1310 M_ale->applyBoundaryConditions ( *M_aleBC );
1313 if ( M_linearElasticity )
1315 getMatrixStructure ( );
1316 M_displayer.leaderPrint (
"\t Set and approximate structure block in the preconditioner.. " ) ;
1317 smallThingsChrono.start();
1318 M_prec->setStructureBlock ( M_matrixStructure );
1319 M_prec->updateApproximatedStructureMomentumOperator ( );
1320 smallThingsChrono.stop();
1321 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
1325 smallThingsChrono.reset();
1326 M_displayer.leaderPrint (
"\t Set and approximate geometry block in the preconditioner... " ) ;
1327 smallThingsChrono.start();
1328 M_prec->setGeometryBlock ( M_ale->matrix() );
1329 M_prec->updateApproximatedGeometryOperator ( );
1330 smallThingsChrono.stop();
1331 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
1333 if ( M_nonconforming )
1335 M_prec->setCouplingOperators_nonconforming(M_FluidToStructureInterpolant, M_StructureToFluidInterpolant, M_lagrangeMap);
1338 M_displayer.leaderPrint (
"[FSI] - Assemble interface mass of the structure for coupling of stresses\n" ) ;
1339 assembleStructureInterfaceMass ( );
1345 M_prec->setCouplingBlocks ( M_coupling->lambdaToFluidMomentum(),
1346 M_coupling->lambdaToStructureMomentum(),
1347 M_coupling->structureDisplacementToLambda(),
1348 M_coupling->fluidVelocityToLambda(),
1349 M_coupling->structureDisplacementToFluidDisplacement() );
1352 M_prec->setMonolithicMap ( M_monolithicMap );
1354 int time_step_count = 0;
1356 for ( ; M_time <= M_t_end + M_dt / 2.; M_time += M_dt)
1358 if ( M_comm->MyPID()==0 )
1360 M_outputLinearIterations << std::endl;
1361 M_outputPreconditionerComputation << std::endl;
1362 M_outputTimeLinearSolver << std::endl;
1365 time_step_count += 1;
1367 M_displayer.leaderPrint (
"\n-----------------------------------\n" ) ;
1368 M_displayer.leaderPrintMax (
"FSI - solving now for time ", M_time ) ;
1369 M_displayer.leaderPrint (
"\n" ) ;
1374 if ( M_extrapolateInitialGuess && M_time == (M_t_zero + M_dt) )
1376 M_displayer.leaderPrint (
"FSI - initializing extrapolation of initial guess\n" ) ;
1377 initializeExtrapolation ( );
1380 if ( M_extrapolateInitialGuess )
1382 M_displayer.leaderPrint (
"FSI - Extrapolating initial guess for Newton\n" ) ;
1383 M_extrapolationSolution->extrapolate (M_orderExtrapolationInitialGuess, *M_solution);
1387 applyBCsolution ( M_solution );
1389 M_maxiterNonlinear = 10;
1391 NonLinearRichardson ( *M_solution, *
this, M_absoluteTolerance, M_relativeTolerance, M_maxiterNonlinear, M_etaMax, M_nonLinearLineSearch, 0, 2, M_out_res, M_time);
1395 M_displayer.leaderPrint (
"\n" ) ;
1396 M_displayer.leaderPrintMax (
"FSI - timestep solved in ", iterChrono.diff() ) ;
1397 M_displayer.leaderPrint (
"-----------------------------------\n\n" ) ;
1400 if ( M_comm->MyPID()==0 )
1402 M_outputTimeStep << M_time <<
", " << iterChrono.diff() << std::endl;
1407 if ( M_extrapolateInitialGuess )
1408 M_extrapolationSolution->shift(*M_solution);
1411 M_fluidVelocity->subset(*M_solution, M_fluid->uFESpace()->map(), 0, 0);
1412 M_fluidPressure->subset(*M_solution, M_fluid->pFESpace()->map(), M_fluid->uFESpace()->map().mapSize(), 0);
1414 vectorPtr_Type lagrange (
new vector_Type (*M_lagrangeMap, Unique) );
1415 vectorPtr_Type Lagrange;
1417 lagrange->subset(*M_solution, *M_lagrangeMap, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() +
1418 M_displacementFESpace->map().mapSize(), 0);
1420 if ( !M_nonconforming )
1422 *M_Lagrange = ( *(M_coupling->lambdaToFluidMomentum()) * (*lagrange) );
1427 M_FluidToStructureInterpolant->expandGammaToOmega_Known( lagrange, Lagrange );
1428 *M_Lagrange = *Lagrange;
1431 M_fluidDisplacement->subset(*M_solution, M_aleFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize(), 0);
1432 M_structureDisplacement->subset(*M_solution, M_displacementFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize(), 0);
1435 M_fluidTimeAdvance->shift(*M_fluidVelocity);
1439 M_structureTimeAdvanceBDF->shift(*M_structureDisplacement);
1443 M_structureTimeAdvance->shift(M_structureDisplacement);
1446 M_aleTimeAdvance->shift(*M_fluidDisplacement);
1450 *M_structureVelocity = *M_structureTimeAdvance->old_first_derivative();
1452 *M_structureAcceleration = *M_structureTimeAdvance->old_second_derivative();
1462 if ( M_orderBDF == 1 )
1464 if ( time_step_count == M_counterSaveEvery )
1466 M_exporterFluid->postProcess(M_time);
1467 M_exporterStructure->postProcess(M_time);
1468 M_counterSaveEvery += M_saveEvery;
1471 else if ( M_orderBDF == 2 )
1473 if ( time_step_count == (M_counterSaveEvery-1) && !M_disregardRestart )
1475 M_exporterFluid->postProcess(M_time);
1476 M_exporterStructure->postProcess(M_time);
1478 else if ( time_step_count == M_counterSaveEvery )
1480 M_exporterFluid->postProcess(M_time);
1481 M_exporterStructure->postProcess(M_time);
1482 M_counterSaveEvery += M_saveEvery;
1487 M_exporterFluid->closeFile();
1488 M_exporterStructure->closeFile();
1492 FSIHandler::intializeTimeLoop ( )
1494 LifeChrono smallThingsChrono;
1497 M_fluidMesh.reset();
1498 M_structureMesh.reset();
1501 buildMonolithicMap ( );
1503 M_solution.reset (
new VectorEpetra ( *M_monolithicMap ) );
1508 M_solution.reset (
new VectorEpetra ( *M_monolithicMap ) );
1511 M_solution->subset(*M_fluidVelocity, M_fluid->uFESpace()->map(), 0, 0);
1512 M_solution->subset(*M_fluidPressure, M_fluid->pFESpace()->map(), 0, M_fluid->uFESpace()->map().mapSize());
1513 M_solution->subset(*M_structureDisplacement, M_displacementFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize());
1514 *M_Lagrange = ( *(M_coupling->fluidVelocityToLambda()) * (*M_LagrangeRestart) );
1515 M_solution->subset(*M_fluidDisplacement, M_aleFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize()+M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize() );
1519 M_ale->applyBoundaryConditions ( *M_aleBC );
1522 if ( M_linearElasticity )
1524 getMatrixStructure ( );
1525 M_displayer.leaderPrint (
"\t Set and approximate structure block in the preconditioner.. " ) ;
1526 smallThingsChrono.start();
1527 M_prec->setStructureBlock ( M_matrixStructure );
1528 M_prec->updateApproximatedStructureMomentumOperator ( );
1529 smallThingsChrono.stop();
1530 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
1534 smallThingsChrono.reset();
1535 M_displayer.leaderPrint (
"\t Set and approximate geometry block in the preconditioner... " ) ;
1536 smallThingsChrono.start();
1537 M_prec->setGeometryBlock ( M_ale->matrix() );
1538 M_prec->updateApproximatedGeometryOperator ( );
1539 smallThingsChrono.stop();
1540 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
1542 if ( M_nonconforming )
1544 M_prec->setCouplingOperators_nonconforming(M_FluidToStructureInterpolant, M_StructureToFluidInterpolant, M_lagrangeMap);
1547 M_displayer.leaderPrint (
"[FSI] - Assemble interface mass of the structure for coupling of stresses\n" ) ;
1548 assembleStructureInterfaceMass ( );
1554 M_prec->setCouplingBlocks ( M_coupling->lambdaToFluidMomentum(),
1555 M_coupling->lambdaToStructureMomentum(),
1556 M_coupling->structureDisplacementToLambda(),
1557 M_coupling->fluidVelocityToLambda(),
1558 M_coupling->structureDisplacementToFluidDisplacement() );
1561 M_prec->setMonolithicMap ( M_monolithicMap );
1565 FSIHandler::solveTimeStep ( )
1567 if ( M_comm->MyPID()==0 )
1569 M_outputLinearIterations << std::endl;
1570 M_outputPreconditionerComputation << std::endl;
1571 M_outputTimeLinearSolver << std::endl;
1574 M_displayer.leaderPrint (
"\n-----------------------------------\n" ) ;
1575 M_displayer.leaderPrintMax (
"FSI - solving now for time ", M_time ) ;
1576 M_displayer.leaderPrint (
"\n" ) ;
1577 LifeChrono iterChrono;
1582 if ( M_extrapolateInitialGuess && M_time == (M_t_zero + M_dt) )
1584 M_displayer.leaderPrint (
"FSI - initializing extrapolation of initial guess\n" ) ;
1585 initializeExtrapolation ( );
1588 if ( M_extrapolateInitialGuess )
1590 M_displayer.leaderPrint (
"FSI - Extrapolating initial guess for Newton\n" ) ;
1591 M_extrapolationSolution->extrapolate (M_orderExtrapolationInitialGuess, *M_solution);
1595 applyBCsolution ( M_solution );
1597 M_maxiterNonlinear = 10;
1600 NonLinearRichardson ( *M_solution, *
this, M_absoluteTolerance, M_relativeTolerance, M_maxiterNonlinear, M_etaMax,
1601 M_nonLinearLineSearch, 0, 2, M_out_res, M_time);
1604 M_displayer.leaderPrint (
"\n" ) ;
1605 M_displayer.leaderPrintMax (
"FSI - timestep solved in ", iterChrono.diff() ) ;
1606 M_displayer.leaderPrint (
"-----------------------------------\n\n" ) ;
1609 if ( M_comm->MyPID()==0 )
1612 M_outputTimeStep << M_time <<
", " << iterChrono.diff() << std::endl;
1617 if ( M_extrapolateInitialGuess )
1618 M_extrapolationSolution->shift(*M_solution);
1621 M_fluidVelocity->subset(*M_solution, M_fluid->uFESpace()->map(), 0, 0);
1622 M_fluidPressure->subset(*M_solution, M_fluid->pFESpace()->map(), M_fluid->uFESpace()->map().mapSize(), 0);
1623 M_Lagrange->subset(*M_solution, *M_lagrangeMap, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() +
1624 M_displacementFESpace->map().mapSize(), 0);
1625 M_fluidDisplacement->subset(*M_solution, M_aleFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize(), 0);
1626 M_structureDisplacement->subset(*M_solution, M_displacementFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize(), 0);
1629 M_fluidTimeAdvance->shift(*M_fluidVelocity);
1633 M_structureTimeAdvanceBDF->shift(*M_structureDisplacement);
1637 M_structureTimeAdvance->shift(M_structureDisplacement);
1640 M_aleTimeAdvance->shift(*M_fluidDisplacement);
1644 *M_structureVelocity = *M_structureTimeAdvance->old_first_derivative();
1646 *M_structureAcceleration = *M_structureTimeAdvance->old_second_derivative();
1651 FSIHandler::postprocessResults(
const int& time_step_count )
1653 if ( M_orderBDF == 1 )
1655 if ( time_step_count == M_counterSaveEvery )
1657 M_exporterFluid->postProcess(M_time);
1658 M_exporterStructure->postProcess(M_time);
1659 M_counterSaveEvery += M_saveEvery;
1662 else if ( M_orderBDF == 2 )
1664 if ( time_step_count == (M_counterSaveEvery-1) && !M_disregardRestart )
1666 M_exporterFluid->postProcess(M_time);
1667 M_exporterStructure->postProcess(M_time);
1669 else if ( time_step_count == M_counterSaveEvery )
1671 M_exporterFluid->postProcess(M_time);
1672 M_exporterStructure->postProcess(M_time);
1673 M_counterSaveEvery += M_saveEvery;
1679 FSIHandler::finalizeExporters ( )
1681 M_exporterFluid->closeFile();
1682 M_exporterStructure->closeFile();
1686 FSIHandler::initializeExtrapolation( )
1689 vector_Type solutionInitial ( *M_monolithicMap );
1690 std::vector<vector_Type> initialStateSolution;
1691 solutionInitial.zero();
1692 for ( UInt i = 0; i < M_orderExtrapolationInitialGuess; ++i )
1693 initialStateSolution.push_back(solutionInitial);
1695 M_extrapolationSolution.reset(
new TimeAndExtrapolationHandler ( ) );
1696 M_extrapolationSolution->setBDForder(M_orderExtrapolationInitialGuess);
1697 M_extrapolationSolution->setMaximumExtrapolationOrder(M_orderExtrapolationInitialGuess);
1698 M_extrapolationSolution->initialize(initialStateSolution);
1702 FSIHandler::applyBCsolution(vectorPtr_Type& M_solution)
1705 VectorEpetra velocity(M_fluid->uFESpace()->map(), Unique);
1706 velocity.subset(*M_solution, M_fluid->uFESpace()->map(), 0, 0);
1708 VectorEpetra displacement(M_displacementFESpace->map(), Unique);
1709 displacement.subset(*M_solution, M_displacementFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize(), 0 );
1711 VectorEpetra geometry(M_aleFESpace->map(), Unique);
1712 geometry.subset(*M_solution, M_aleFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() +
1713 M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize(), 0 );
1716 if ( !M_fluidBC->bcUpdateDone() )
1717 M_fluidBC->bcUpdate ( *M_fluid->uFESpace()->mesh(), M_fluid->uFESpace()->feBd(), M_fluid->uFESpace()->dof() );
1719 bcManageRhs ( velocity, *M_fluid->uFESpace()->mesh(), M_fluid->uFESpace()->dof(), *M_fluidBC, M_fluid->uFESpace()->feBd(), 1.0, M_time );
1721 if ( !M_structureBC->bcUpdateDone() )
1722 M_structureBC->bcUpdate ( *M_displacementFESpace->mesh(), M_displacementFESpace->feBd(), M_displacementFESpace->dof() );
1724 bcManageRhs ( displacement, *M_displacementFESpace->mesh(), M_displacementFESpace->dof(), *M_structureBC, M_displacementFESpace->feBd(), 1.0, M_time );
1726 if ( !M_aleBC_residual_essential->bcUpdateDone() )
1727 M_aleBC_residual_essential->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
1729 bcManageRhs ( geometry, *M_aleFESpace->mesh(), M_aleFESpace->dof(), *M_aleBC_residual_essential, M_aleFESpace->feBd(), 1.0, M_time );
1732 M_solution->subset(velocity, M_fluid->uFESpace()->map(), 0, 0);
1733 M_solution->subset(displacement, M_displacementFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() );
1734 M_solution->subset(geometry, M_aleFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() +
1735 M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize() );
1739 FSIHandler::applyBCresidual(VectorEpetra& r_u, VectorEpetra& r_ds, VectorEpetra& r_df)
1742 VectorEpetra ru_copy(r_u, Unique);
1746 if ( !M_fluidBC_residual_natural->bcUpdateDone() )
1747 M_fluidBC_residual_natural->bcUpdate ( *M_fluid->uFESpace()->mesh(), M_fluid->uFESpace()->feBd(), M_fluid->uFESpace()->dof() );
1749 bcManageRhs ( ru_copy,
1750 *M_fluid->uFESpace()->mesh(),
1751 M_fluid->uFESpace()->dof(),
1752 *M_fluidBC_residual_natural,
1753 M_fluid->uFESpace()->feBd(),
1759 if ( !M_fluidBC_residual_essential->bcUpdateDone() )
1760 M_fluidBC_residual_essential->bcUpdate ( *M_fluid->uFESpace()->mesh(), M_fluid->uFESpace()->feBd(), M_fluid->uFESpace()->dof() );
1762 bcManageRhs ( ru_copy,
1763 *M_fluid->uFESpace()->mesh(),
1764 M_fluid->uFESpace()->dof(),
1765 *M_fluidBC_residual_essential,
1766 M_fluid->uFESpace()->feBd(),
1773 if ( !M_structureBC_residual_natural->bcUpdateDone() )
1774 M_structureBC_residual_natural->bcUpdate ( *M_displacementFESpace->mesh(), M_displacementFESpace->feBd(), M_displacementFESpace->dof() );
1776 if ( M_datafile(
"solid/robin_external_wall",
false ) )
1778 VectorEpetra rds_robin( M_displacementFESpace->map(), Unique);
1780 rds_robin = *M_interface_mass_structure_robin * (*M_dsk);
1785 *M_displacementFESpace->mesh(),
1786 M_displacementFESpace->dof(),
1787 *M_structureBC_residual_natural,
1788 M_displacementFESpace->feBd(),
1792 if ( !M_structureBC_residual_essential->bcUpdateDone() )
1793 M_structureBC_residual_essential->bcUpdate ( *M_displacementFESpace->mesh(), M_displacementFESpace->feBd(), M_displacementFESpace->dof() );
1796 *M_displacementFESpace->mesh(),
1797 M_displacementFESpace->dof(),
1798 *M_structureBC_residual_essential,
1799 M_displacementFESpace->feBd(),
1803 if ( !M_aleBC_residual_natural->bcUpdateDone() )
1804 M_aleBC_residual_natural->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
1806 bcManageRhs ( r_df, *M_aleFESpace->mesh(), M_aleFESpace->dof(), *M_aleBC_residual_natural, M_aleFESpace->feBd(), 1.0, M_time );
1808 if ( !M_aleBC_residual_essential->bcUpdateDone() )
1809 M_aleBC_residual_essential->bcUpdate ( *M_aleFESpace->mesh(), M_aleFESpace->feBd(), M_aleFESpace->dof() );
1811 bcManageRhs ( r_df, *M_aleFESpace->mesh(), M_aleFESpace->dof(), *M_aleBC_residual_essential, M_aleFESpace->feBd(), 0.0, M_time );
1815 FSIHandler::assembleStructureInterfaceMass()
1818 matrixPtr_Type structure_interfaceMass(
new matrix_Type ( M_displacementFESpace->map(), 50 ) );
1819 structure_interfaceMass->zero();
1822 QuadratureBoundary myBDQR (buildTetraBDQR (quadRuleTria7pt) );
1824 using namespace ExpressionAssembly;
1825 integrate ( boundary (M_displacementETFESpace->mesh(), M_datafile(
"interface/flag", 1) ),
1827 M_displacementETFESpace,
1828 M_displacementETFESpace,
1832 >> structure_interfaceMass;
1834 structure_interfaceMass->globalAssemble();
1836 mapPtr_Type M_mapStuctureGammaVectorial;
1837 M_StructureToFluidInterpolant->getVectorialInterpolationMap(M_mapStuctureGammaVectorial);
1840 M_interface_mass_structure.reset(
new matrix_Type ( *M_mapStuctureGammaVectorial, 50 ) );
1841 structure_interfaceMass->restrict ( M_mapStuctureGammaVectorial, M_numerationInterfaceStructure,
1842 M_structureDisplacement->size()/3, M_interface_mass_structure );
1846 FSIHandler::applyInverseFluidMassOnGamma (
const vectorPtr_Type& weakLambda, vectorPtr_Type& strongLambda )
1848 Teuchos::RCP< Teuchos::ParameterList > belosList = Teuchos::rcp (
new Teuchos::ParameterList );
1849 belosList = Teuchos::getParametersFromXmlFile (
"SolverParamList_rbf3d.xml" );
1852 if ( !M_precPtrBuilt )
1854 prec_Type* precRawPtr;
1855 precRawPtr =
new prec_Type;
1856 precRawPtr->setDataFromGetPot ( M_datafile,
"prec" );
1857 M_precPtr.reset ( precRawPtr );
1858 M_precPtrBuilt =
true;
1862 LinearSolver solverOne;
1863 solverOne.setCommunicator ( M_comm );
1864 solverOne.setParameters ( *belosList );
1865 solverOne.setPreconditioner ( M_precPtr );
1868 strongLambda->zero();
1871 solverOne.setOperator ( M_interface_mass_fluid );
1872 solverOne.setRightHandSide ( weakLambda );
1873 solverOne.solve ( strongLambda );
1877 FSIHandler::evalResidual(vector_Type& residual,
const vector_Type& solution,
const UInt iter_newton)
1880 M_NewtonIter = iter_newton;
1884 vectorPtr_Type res_u (
new vector_Type ( M_fluid->uFESpace()->map(), Unique ) );
1885 vectorPtr_Type res_p (
new vector_Type ( M_fluid->pFESpace()->map(), Unique ) );
1886 vectorPtr_Type res_ds (
new vector_Type ( M_displacementFESpace->map(), Unique ) );
1887 vectorPtr_Type res_lambda (
new vector_Type ( *M_lagrangeMap, Unique ) );
1888 vectorPtr_Type res_df (
new vector_Type (M_aleFESpace->map(), Unique ) );
1898 vectorPtr_Type u_k (
new vector_Type ( M_fluid->uFESpace()->map() ) );
1899 vectorPtr_Type p_k (
new vector_Type ( M_fluid->pFESpace()->map() ) );
1900 vectorPtr_Type ds_k (
new vector_Type ( M_displacementFESpace->map() ) );
1901 vectorPtr_Type lambda_k (
new vector_Type ( *M_lagrangeMap ) );
1902 vectorPtr_Type df_k (
new vector_Type ( M_aleFESpace->map() ) );
1912 u_k->subset (solution, M_fluid->uFESpace()->map(), 0, 0);
1913 p_k->subset (solution, M_fluid->pFESpace()->map(), M_fluid->uFESpace()->map().mapSize(), 0);
1914 ds_k->subset (solution, M_displacementFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize(), 0);
1915 lambda_k->subset(solution, *M_lagrangeMap, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize(), 0);
1916 df_k->subset(solution, M_aleFESpace->map(), M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize(), 0);
1918 M_dsk.reset(
new vector_Type ( *ds_k ) );
1924 vectorPtr_Type mmRep (
new vector_Type (*df_k, Repeated ) );
1925 moveMesh ( *mmRep );
1931 vectorPtr_Type meshVelocity (
new vector_Type (M_aleFESpace->map() ) );
1932 meshVelocity->zero();
1933 vector_Type meshVelocity_bdf ( M_aleFESpace->map() );
1934 meshVelocity_bdf.zero();
1935 M_aleTimeAdvance->rhsContribution( meshVelocity_bdf );
1936 *meshVelocity = ( M_aleTimeAdvance->alpha()*(*df_k)/(M_dt) - meshVelocity_bdf );
1942 M_beta.reset (
new VectorEpetra ( M_fluid->uFESpace()->map ( ) ) );
1944 *M_beta = ( *u_k - *meshVelocity );
1950 M_fluid->buildSystem();
1951 M_fluid->setupPostProc();
1953 if ( M_nonconforming )
1959 M_displayer.leaderPrint (
"[FSI] - Computing residual of the fluid \n" ) ;
1962 M_fluid->evaluateResidual( M_beta, u_k, p_k, M_rhs_velocity, res_u, res_p);
1964 vectorPtr_Type lambda_km1_omegaF (
new vector_Type ( M_fluid->uFESpace()->map() ) );
1965 M_FluidToStructureInterpolant->expandGammaToOmega_Known(lambda_k, lambda_km1_omegaF);
1967 *res_u += *lambda_km1_omegaF;
1973 M_displayer.leaderPrint (
"[FSI] - Computing residual structure \n" ) ;
1978 if ( M_linearElasticity )
1982 vectorPtr_Type old_second_der_terms (
new vector_Type ( M_displacementFESpace->map() ) );
1983 old_second_der_terms->zero();
1984 M_structureTimeAdvanceBDF->second_der_old_dts(*old_second_der_terms);
1986 *res_ds = ( ( ( 1.0 / ( M_dt * M_dt ) * M_structureTimeAdvanceBDF->massCoefficient() ) * ( (*M_structure->mass_matrix_no_bc() ) * (*ds_k) ) ) +
1987 ( (*M_structure->stiffness_matrix_no_bc() ) * (*ds_k) ) +
1988 ( ( 1.0 / ( M_dt * M_dt ) ) * ( ( *M_structure->mass_matrix_no_bc() ) * ( *old_second_der_terms ) ) ) );
1992 *res_ds = ( ( ( 1.0/ ( M_dt * M_dt * M_structureTimeAdvance->get_beta() ) ) * ( (*M_structure->mass_matrix_no_bc() ) * (*ds_k) ) ) +
1993 ( (*M_structure->stiffness_matrix_no_bc() ) * (*ds_k) ) -
1994 ( (*M_structure->mass_matrix_no_bc() ) * (*M_structureTimeAdvance->get_csi()) ) );
2001 Real coefficient = 1.0/ ( M_dt * M_dt ) * M_structureTimeAdvanceBDF->massCoefficient();
2002 vectorPtr_Type old_second_der_terms (
new vector_Type ( M_displacementFESpace->map() ) );
2003 old_second_der_terms->zero();
2004 M_structureTimeAdvanceBDF->second_der_old_dts(*old_second_der_terms);
2005 *old_second_der_terms *= ( 1.0 / ( M_dt * M_dt ) );
2006 M_structureNeoHookean->evaluate_residual(ds_k, coefficient, old_second_der_terms, res_ds );
2010 Real coefficient = 1.0/ ( M_dt * M_dt * M_structureTimeAdvance->get_beta() );
2011 M_structureNeoHookean->evaluate_residual(ds_k, coefficient, M_structureTimeAdvance->get_csi(), res_ds );
2018 M_displayer.leaderPrint (
"[FSI] - Assemble interface mass of the fluid \n" ) ;
2019 M_fluid->assembleInterfaceMass ( M_interface_mass_fluid, M_lagrangeMap, M_datafile(
"interface/flag", 1),
2020 M_numerationInterfaceFluid, M_fluid->uFESpace()->map().mapSize()/3 );
2022 M_displayer.leaderPrint (
"[FSI] - From weak to strong residual - fluid \n" ) ;
2023 vectorPtr_Type tmp_gamma_f (
new vector_Type ( M_lagrangeMap ) );
2024 tmp_gamma_f->zero();
2025 applyInverseFluidMassOnGamma( lambda_k, tmp_gamma_f );
2027 M_displayer.leaderPrint (
"[FSI] - Interpolating strong residual \n" ) ;
2028 vectorPtr_Type tmp_omega_f (
new vector_Type ( M_fluid->uFESpace()->map() ) );
2029 tmp_omega_f->zero ( );
2031 M_FluidToStructureInterpolant->expandGammaToOmega_Known( tmp_gamma_f, tmp_omega_f );
2033 M_FluidToStructureInterpolant->updateRhs(tmp_omega_f);
2035 M_FluidToStructureInterpolant->interpolate();
2037 vectorPtr_Type tmp_omega_s (
new vector_Type ( M_displacementFESpace->map() ) );
2039 tmp_omega_s->zero();
2041 M_FluidToStructureInterpolant->solution(tmp_omega_s);
2043 vectorPtr_Type tmp_gamma_s;
2045 M_StructureToFluidInterpolant->restrictOmegaToGamma_Known(tmp_omega_s, tmp_gamma_s);
2047 vectorPtr_Type out_gamma_s (
new vector_Type ( tmp_gamma_s->map( ) ) );
2048 out_gamma_s->zero();
2050 M_displayer.leaderPrint (
"[FSI] - From strong to weak residual - structure \n" ) ;
2051 *out_gamma_s = (*M_interface_mass_structure) * ( *tmp_gamma_s );
2053 vectorPtr_Type structure_weak_residual (
new vector_Type ( M_displacementFESpace->map() ) );
2054 structure_weak_residual->zero();
2056 M_StructureToFluidInterpolant->expandGammaToOmega_Known( out_gamma_s, structure_weak_residual );
2058 *res_ds -= *structure_weak_residual;
2062 M_FluidToStructureInterpolant->updateRhs(lambda_km1_omegaF);
2064 M_FluidToStructureInterpolant->interpolate();
2066 vectorPtr_Type structure_weak_residual (
new vector_Type ( M_displacementFESpace->map() ) );
2067 structure_weak_residual->zero();
2069 M_FluidToStructureInterpolant->solution(structure_weak_residual);
2071 *res_ds -= *structure_weak_residual;
2078 M_displayer.leaderPrint (
"[FSI] - Computing residual coupling velocities \n" ) ;
2082 vectorPtr_Type velocity_km1_gamma(
new vector_Type ( *M_lagrangeMap ) );
2083 velocity_km1_gamma->zero();
2084 M_FluidToStructureInterpolant->restrictOmegaToGamma_Known(u_k, velocity_km1_gamma);
2086 vectorPtr_Type structure_vel(
new vector_Type ( M_displacementFESpace->map() ) );
2087 structure_vel->zero();
2091 *structure_vel = ( ( M_structureTimeAdvanceBDF->coefficientFirstDerivative()/ M_dt ) * (*ds_k) );
2095 *structure_vel = ( ( M_structureTimeAdvance->get_gamma()/(M_dt * M_structureTimeAdvance->get_beta() ) ) * (*ds_k) );
2098 vectorPtr_Type res_couplingVel_omega_f (
new vector_Type ( M_fluid->uFESpace()->map() ) );
2099 res_couplingVel_omega_f->zero();
2101 M_StructureToFluidInterpolant->updateRhs ( structure_vel );
2102 M_StructureToFluidInterpolant->interpolate();
2103 M_StructureToFluidInterpolant->solution(res_couplingVel_omega_f);
2105 vectorPtr_Type res_couplingVel_gamma_f (
new vector_Type ( *M_lagrangeMap ) );
2106 res_couplingVel_gamma_f->zero();
2108 M_FluidToStructureInterpolant->restrictOmegaToGamma_Known(res_couplingVel_omega_f, res_couplingVel_gamma_f);
2110 *res_lambda = (*velocity_km1_gamma - *res_couplingVel_gamma_f + *M_rhsCouplingVelocities );
2116 M_displayer.leaderPrint (
"[FSI] - Computing residual ALE \n" ) ;
2118 M_StructureToFluidInterpolant->updateRhs ( ds_k );
2120 M_StructureToFluidInterpolant->interpolate();
2122 vectorPtr_Type res_ds_ale (
new vector_Type ( M_fluid->uFESpace()->map() ) );
2126 M_StructureToFluidInterpolant->solution(res_ds_ale);
2128 vectorPtr_Type res_ale_ale (
new vector_Type ( M_aleFESpace->map() ) );
2130 res_ale_ale->zero();
2132 *res_ale_ale = ( *M_ale->matrix ( ) ) * ( *df_k );
2136 *res_df -= *res_ds_ale;
2138 *res_df += *res_ale_ale;
2144 M_displayer.leaderPrint (
"[FSI] - Gathering all components of the residual \n" ) ;
2154 M_fluid->evaluateResidual( M_beta, u_k, p_k, M_rhs_velocity, res_u, res_p);
2157 *res_u += ( *(M_coupling->lambdaToFluidMomentum()) * (*lambda_k) );
2163 if ( M_linearElasticity )
2167 vectorPtr_Type old_second_der_terms (
new vector_Type ( M_displacementFESpace->map() ) );
2168 old_second_der_terms->zero();
2169 M_structureTimeAdvanceBDF->second_der_old_dts(*old_second_der_terms);
2171 *res_ds = ( ( ( 1.0 / ( M_dt * M_dt ) * M_structureTimeAdvanceBDF->massCoefficient() ) * ( (*M_structure->mass_matrix_no_bc() ) * (*ds_k) ) ) +
2172 ( (*M_structure->stiffness_matrix_no_bc() ) * (*ds_k) ) +
2173 ( (*M_coupling->lambdaToStructureMomentum() ) * (*lambda_k) ) +
2174 ( ( 1.0 / ( M_dt * M_dt ) ) * ( ( *M_structure->mass_matrix_no_bc() ) * ( *old_second_der_terms ) ) ) );
2178 *res_ds = ( ( ( 1.0/ ( M_dt * M_dt * M_structureTimeAdvance->get_beta() ) ) * ( (*M_structure->mass_matrix_no_bc() ) * (*ds_k) ) ) +
2179 ( (*M_structure->stiffness_matrix_no_bc() ) * (*ds_k) ) +
2180 ( (*M_coupling->lambdaToStructureMomentum() ) * (*lambda_k) ) -
2181 ( (*M_structure->mass_matrix_no_bc() ) * (*M_structureTimeAdvance->get_csi()) ) );
2188 Real coefficient = 1.0/ ( M_dt * M_dt ) * M_structureTimeAdvanceBDF->massCoefficient();
2189 vectorPtr_Type old_second_der_terms (
new vector_Type ( M_displacementFESpace->map() ) );
2190 old_second_der_terms->zero();
2191 M_structureTimeAdvanceBDF->second_der_old_dts(*old_second_der_terms);
2192 *old_second_der_terms *= ( 1.0 / ( M_dt * M_dt ) );
2193 M_structureNeoHookean->evaluate_residual(ds_k, coefficient, old_second_der_terms, res_ds );
2197 Real coefficient = 1.0/ ( M_dt * M_dt * M_structureTimeAdvance->get_beta() );
2198 M_structureNeoHookean->evaluate_residual(ds_k, coefficient, M_structureTimeAdvance->get_csi(), res_ds );
2200 *res_ds += ( (*M_coupling->lambdaToStructureMomentum() ) * (*lambda_k) );
2206 *res_lambda = ( ( (*M_coupling->fluidVelocityToLambda()) * (*u_k) ) +
2207 ( (*M_coupling->structureDisplacementToLambda()) * (*ds_k) ) +
2208 ( *M_rhsCouplingVelocities ) );
2214 *res_df = ( ( (*M_coupling->structureDisplacementToFluidDisplacement()) * (*ds_k) ) +
2215 ( (*M_ale->matrix()) * (*df_k) ) );
2219 applyBCresidual ( *res_u, *res_ds, *res_df );
2221 residual.subset(*res_u, M_fluid->uFESpace()->map(), 0, 0 );
2222 residual.subset(*res_p, M_fluid->pFESpace()->map(), 0, M_fluid->uFESpace()->map().mapSize() );
2223 residual.subset(*res_ds, M_displacementFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() );
2224 residual.subset(*res_lambda, *M_lagrangeMap, 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() );
2225 residual.subset(*res_df, M_aleFESpace->map(), 0, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize() );
2227 if (M_printResiduals)
2230 Real norm_full_residual = residual.normInf();
2231 Real norm_u_residual = res_u->normInf();
2232 Real norm_p_residual = res_p->normInf();
2233 Real norm_ds_residual = res_ds->normInf();
2234 Real norm_lambda_residual = res_lambda->normInf();
2235 Real norm_df_residual = res_df->normInf();
2238 if ( M_comm->MyPID()==0 && iter_newton == 0)
2240 M_outputResiduals <<
"------------------------------------------------------------------------------------" << std::endl;
2241 M_outputResiduals <<
"# time = " << M_time << std::endl;
2242 M_outputResiduals <<
"Initial norms: " << std::endl;
2243 M_outputResiduals <<
"||r|| =" << norm_full_residual <<
", ||r_u|| =" << norm_u_residual <<
", ||r_p|| =" << norm_p_residual;
2244 M_outputResiduals <<
", ||r_ds|| =" << norm_ds_residual <<
", ||r_lambda|| =" << norm_lambda_residual <<
", ||r_df|| =" << norm_df_residual << std::endl;
2245 M_outputResiduals <<
"iter ||r|| ||r_u|| ||r_p|| ||r_ds|| ||r_lambda|| ||r_df||" << std::endl;
2247 else if ( M_comm->MyPID()==0 && iter_newton > 0 )
2249 M_outputResiduals << iter_newton <<
" " << norm_full_residual <<
" " << norm_u_residual <<
" " << norm_p_residual <<
" " <<
2250 norm_ds_residual <<
" " << norm_lambda_residual <<
" " << norm_df_residual << std::endl;
2258 M_displayer.leaderPrint (
"[FSI] - Update Jacobian terms: \n" ) ;
2259 M_fluid->updateConvectiveTerm(M_beta);
2260 M_fluid->updateJacobian(*u_k);
2261 if ( M_fluid->useStabilization() )
2262 M_fluid->updateStabilization(*M_beta, *u_k, *p_k, *M_rhs_velocity);
2264 M_fluid->applyBoundaryConditionsJacobian ( M_fluidBC );
2266 if ( !M_linearElasticity )
2268 M_displayer.leaderPrint (
"\nAssembly Jacobian structure" ) ;
2269 M_matrixStructure.reset (
new matrix_Type ( M_displacementFESpace->map() ) );
2270 M_matrixStructure->zero();
2275 coefficient = 1.0/ ( M_dt * M_dt ) * M_structureTimeAdvanceBDF->massCoefficient();
2279 coefficient = 1.0/ ( M_dt * M_dt * M_structureTimeAdvance->get_beta() );
2282 M_structureNeoHookean->update_jacobian( ds_k, coefficient, M_matrixStructure);
2283 bcManageMatrix( *M_matrixStructure, *M_displacementFESpace->mesh(), M_displacementFESpace->dof(), *M_structureBC_residual_essential,
2284 M_displacementFESpace->feBd(), 1.0, M_time);
2291 if (M_useShapeDerivatives)
2294 Real alpha = M_fluidTimeAdvance->alpha() / M_dt;
2295 Real density = M_fluid->density();
2296 Real viscosity = M_fluid->viscosity();
2298 vector_Type un (M_fluid->uFESpace()->map() );
2299 vector_Type uk (M_fluid->uFESpace()->map() + M_fluid->pFESpace()->map() );
2302 vector_Type meshVelRep ( *meshVelocity, Repeated ) ;
2305 un.subset ( solution, 0 );
2307 uk.subset ( solution, 0 );
2313 M_ale->updateShapeDerivatives ( alpha,
2320 *M_fluid->uFESpace(),
2321 *M_fluid->pFESpace(),
2331 if ( !M_nonconforming )
2332 initializeApplyOperatorJacobian();
2336 FSIHandler::solveJac( vector_Type& increment,
const vector_Type& residual,
const Real )
2340 if ( M_nonconforming )
2342 M_applyOperatorJacobianNonConforming->setComm ( M_comm );
2343 M_applyOperatorJacobianNonConforming->setTimeStep ( M_dt );
2344 M_applyOperatorJacobianNonConforming->setDatafile ( M_datafile );
2345 M_applyOperatorJacobianNonConforming->setMonolithicMap ( M_monolithicMap );
2346 M_applyOperatorJacobianNonConforming->setMaps ( M_fluid->uFESpace()->mapPtr(),
2347 M_fluid->pFESpace()->mapPtr(),
2348 M_displacementFESpace->mapPtr(),
2350 M_aleFESpace->mapPtr());
2352 M_applyOperatorJacobianNonConforming->setInterfaceMassMatrices ( M_interface_mass_fluid, M_interface_mass_structure );
2354 if ( M_fluid->useStabilization() )
2355 M_applyOperatorJacobianNonConforming->setFluidBlocks ( M_fluid->block00(), M_fluid->block01(), M_fluid->block10(), M_fluid->block11());
2357 M_applyOperatorJacobianNonConforming->setFluidBlocks ( M_fluid->block00(), M_fluid->block01(), M_fluid->block10() );
2359 M_applyOperatorJacobianNonConforming->setStructureBlock ( M_matrixStructure );
2361 M_applyOperatorJacobianNonConforming->setALEBlock ( M_ale->matrix() );
2363 M_applyOperatorJacobianNonConforming->setUseShapeDerivatives ( M_useShapeDerivatives );
2365 M_applyOperatorJacobianNonConforming->setTimeStep(M_dt);
2367 M_applyOperatorJacobianNonConforming->setInterpolants ( M_FluidToStructureInterpolant, M_StructureToFluidInterpolant, M_useMasses );
2371 M_applyOperatorJacobianNonConforming->setBDFcoeff ( M_structureTimeAdvanceBDF->coefficientFirstDerivative() );
2375 M_applyOperatorJacobianNonConforming->setGamma ( M_structureTimeAdvance->get_gamma() );
2377 M_applyOperatorJacobianNonConforming->setBeta ( M_structureTimeAdvance->get_beta() );
2380 if ( M_useShapeDerivatives )
2382 M_applyOperatorJacobianNonConforming->setShapeDerivativesBlocks ( M_ale->shapeDerivativesVelocity(),
2383 M_ale->shapeDerivativesPressure() );
2386 M_invOper->setOperator(M_applyOperatorJacobianNonConforming);
2390 M_invOper->setOperator(M_applyOperatorJacobian);
2397 if ( !M_fluid->useStabilization() )
2398 M_prec->setFluidBlocks( M_fluid->block00(), M_fluid->block01(), M_fluid->block10() );
2400 M_prec->setFluidBlocks( M_fluid->block00(), M_fluid->block01(), M_fluid->block10(), M_fluid->block11() );
2402 if (M_useShapeDerivatives)
2404 M_prec->setShapeDerivativesBlocks(M_ale->shapeDerivativesVelocity(), M_ale->shapeDerivativesPressure());
2407 if ( !M_linearElasticity )
2409 LifeChrono smallThingsChrono;
2410 M_displayer.leaderPrint (
"\t Set and approximate structure block in the preconditioner.. " ) ;
2411 smallThingsChrono.start();
2412 M_prec->setStructureBlock ( M_matrixStructure );
2413 M_prec->updateApproximatedStructureMomentumOperator ( );
2414 smallThingsChrono.stop();
2415 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
2418 if ( M_nonconforming)
2422 M_prec->setBDFcoeff ( M_structureTimeAdvanceBDF->coefficientFirstDerivative() );
2426 M_prec->setGamma ( M_structureTimeAdvance->get_gamma() );
2427 M_prec->setBeta ( M_structureTimeAdvance->get_beta() );
2429 M_prec->setVelocityFESpace ( M_fluid->uFESpace() );
2430 M_prec->setBC ( M_interfaceFluidBC );
2431 M_prec->setTimeStep ( M_dt );
2432 M_prec->setMonolithicMap ( M_monolithicMap );
2436 M_prec->setVelocityFESpace ( M_fluid->uFESpace() );
2437 M_prec->setBC ( M_interfaceFluidBC );
2438 M_prec->setDomainMap(M_applyOperatorJacobian->OperatorDomainBlockMapPtr());
2439 M_prec->setRangeMap(M_applyOperatorJacobian->OperatorRangeBlockMapPtr());
2446 LifeChrono smallThingsChrono;
2447 M_displayer.leaderPrint (
"\n Set preconditioner for the fluid momentum and the shur complements\n" ) ;
2448 M_displayer.leaderPrint (
"\t Set and approximate fluid momentum in the preconditioner.. " ) ;
2449 smallThingsChrono.start();
2452 M_prec->updateApproximatedFluidOperator();
2453 smallThingsChrono.stop();
2454 M_displayer.leaderPrintMax (
"done in ", smallThingsChrono.diff() ) ;
2456 if ( M_comm->MyPID()==0 )
2458 M_outputPreconditionerComputation <<
" " << smallThingsChrono.diff();
2465 M_invOper->setPreconditioner(M_prec);
2471 M_invOper->ApplyInverse(residual.epetraVector() , increment.epetraVector());
2473 if ( M_comm->MyPID()==0 )
2475 M_outputLinearIterations <<
" " << M_invOper->NumIter();
2476 M_outputTimeLinearSolver <<
" " << M_invOper->TimeSolver();
2479 M_displayer.leaderPrint (
" FSI- End of solve Jac ... ");
2484 vectorPtr_Type s_fluid_vel (
new vector_Type (M_fluid->uFESpace()->map() ) );
2485 vectorPtr_Type s_fluid_press (
new vector_Type (M_fluid->pFESpace()->map() ) );
2486 vectorPtr_Type s_structure_displ (
new vector_Type (M_displacementFESpace->map() ) );
2487 vectorPtr_Type s_coupling (
new vector_Type (*M_lagrangeMap ) );
2488 vectorPtr_Type s_fluid_displ (
new vector_Type (M_aleFESpace->map() ) );
2491 s_fluid_vel->subset(increment);
2492 s_fluid_press->subset(increment, M_fluid->uFESpace()->dof().numTotalDof() * 3);
2493 s_structure_displ->subset(increment, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() );
2494 s_coupling->subset(increment, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() );
2495 s_fluid_displ->subset(increment, M_fluid->uFESpace()->map().mapSize() + M_fluid->pFESpace()->map().mapSize() + M_displacementFESpace->map().mapSize() + M_lagrangeMap->mapSize() );
2498 Real norm_full_step = increment.normInf();
2499 Real norm_u_step = s_fluid_vel->normInf();
2500 Real norm_p_step = s_fluid_press->normInf();
2501 Real norm_ds_step = s_structure_displ->normInf();
2502 Real norm_lambda_step = s_coupling->normInf();
2503 Real norm_df_step = s_fluid_displ->normInf();
2506 if ( M_comm->MyPID()==0 && M_NewtonIter == 0)
2508 M_outputSteps <<
"------------------------------------------------------------------------------------" << std::endl;
2509 M_outputSteps <<
"# time = " << M_time << std::endl;
2510 M_outputSteps <<
"iter ||s|| ||s_u|| ||s_p|| ||s_ds|| ||s_lambda|| ||s_df||" << std::endl;
2511 M_outputSteps << M_NewtonIter+1 << std::setw (15) << norm_full_step << std::setw (15) << norm_u_step << std::setw (15) << norm_p_step << std::setw (15) <<
2512 norm_ds_step << std::setw (15) << norm_lambda_step << std::setw (15) << norm_df_step << std::endl;
2514 else if ( M_comm->MyPID()==0 && M_NewtonIter > 0 )
2516 M_outputSteps << M_NewtonIter+1 << std::setw (15) << norm_full_step << std::setw (15) << norm_u_step << std::setw (15) << norm_p_step << std::setw (15) <<
2517 norm_ds_step << std::setw (15) << norm_lambda_step << std::setw (15) << norm_df_step << std::endl;
2524 FSIHandler::moveMesh (
const VectorEpetra& displacement )
2526 M_displayer.leaderPrint (
" FSI- Moving the mesh ... ");
2527 M_fluidLocalMesh->meshTransformer().moveMesh (displacement, M_aleFESpace->dof().numTotalDof() );
2528 M_displayer.leaderPrint (
"done\n" );
2532 FSIHandler::updateSystem ( )
2534 M_rhs_velocity.reset (
new VectorEpetra ( M_fluid->uFESpace()->map ( ) ) );
2535 M_rhs_velocity->zero();
2538 M_fluidTimeAdvance->rhsContribution (*M_rhs_velocity);
2541 get_structure_coupling_velocities ( );
2543 if ( M_nonconforming )
2544 updateRhsCouplingVelocities_nonconforming ( );
2546 updateRhsCouplingVelocities ( );
2550 FSIHandler::initializeApplyOperatorJacobian ( )
2552 Operators::FSIApplyOperator::operatorPtrContainer_Type operDataJacobian(5,5);
2553 operDataJacobian(0,0) = M_fluid->block00()->matrixPtr();
2554 operDataJacobian(0,1) = M_fluid->block01()->matrixPtr();
2555 operDataJacobian(0,3) = M_coupling->lambdaToFluidMomentum()->matrixPtr();
2556 operDataJacobian(1,0) = M_fluid->block10()->matrixPtr();
2557 if ( M_fluid->useStabilization() )
2558 operDataJacobian(1,1) = M_fluid->block11()->matrixPtr();
2559 operDataJacobian(2,2) = M_matrixStructure->matrixPtr();
2560 operDataJacobian(2,3) = M_coupling->lambdaToStructureMomentum()->matrixPtr();
2561 operDataJacobian(3,0) = M_coupling->fluidVelocityToLambda()->matrixPtr();
2562 operDataJacobian(3,2) = M_coupling->structureDisplacementToLambda()->matrixPtr();
2563 operDataJacobian(4,2) = M_coupling->structureDisplacementToFluidDisplacement()->matrixPtr();
2564 operDataJacobian(4,4) = M_ale->matrix()->matrixPtr();
2566 if (M_useShapeDerivatives)
2568 operDataJacobian(0,4) = M_ale->shapeDerivativesVelocity()->matrixPtr();
2569 operDataJacobian(1,4) = M_ale->shapeDerivativesPressure()->matrixPtr();
2571 M_applyOperatorJacobian->setMonolithicMap(M_monolithicMap);
2572 M_applyOperatorJacobian->setUp(operDataJacobian, M_comm);
void setupStructure()
Setup solid sub-problem.
commPtr_Type M_comm
communicator
bool M_prescribeInflowFlowrate
std::shared_ptr< comm_Type > commPtr_Type
bool M_usePartitionedMeshes
bool M_extrapolateInitialGuess
void setup()
Setup the solver.
bool M_lambda_num_structure
void setupExporters()
Setup the exporters of fluid and solid.
void setDatafile(const GetPot &dataFile)
Set the datafile.
void partitionMeshes()
Partitioning the fluid and solid meshes.
void setParameterLists()
Set the parameter list of the problem.
Displayer M_displayer
Displayer to print in parallel (only PID 0 will print)
void readPartitionedMeshes()
Read fluid and solid meshes that have been already partitioned offline.
void updateBoundaryConditions()
Update all the bc handlers.
double Real
Generic real data.
void readMeshes()
Read the fluid and solid meshes.
void setSolversOptions(const Teuchos::ParameterList &solversOptions)
Set options linear solver.
bool M_subiterateFluidDirichlet
UInt M_orderExtrapolationInitialGuess
std::shared_ptr< ExporterHDF5< mesh_Type > > M_importerStructure
FSIHandler(const commPtr_Type &communicator)
Constructor.
void createAleFESpace()
Create ALE FE spaces.
void initializeTimeAdvance()
Update the time advancing schemes.
Real M_dt
Variables for the time advancing.
bool M_useShapeDerivatives
void setGravity(const Real &gravity, const Real &gravity_direction)
Set gravity, if considered.