void Problem::readLastVectorALETimeAdvance ( vectorPtr_Type fluidDisp, const std::string loadInitSol) { using namespace LifeV; typedef FSIOperator::mesh_Type mesh_Type; //We still need to load the last vector for ALE std::string iterationString = loadInitSol; fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) ); //Setting the exporterData to read: ALE problem LifeV::ExporterData<mesh_Type> initSolFluidDisp (LifeV::ExporterData<mesh_Type>::VectorField, "f-displacement." + iterationString, M_fsi->FSIOper()->mmFESpacePtr(), fluidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); //Initializing *fluidDisp *= 0.0; //Reading M_importerFluid->readVariable (initSolFluidDisp); //Fluid df //Output std::cout << "Norm of the df " << fluidDisp->norm2() << std::endl; //This is ugly but it's the only way I have figured out at the moment if ( M_data->method().compare ("monolithicGI") == 0 ) { //Don't be scared by the ten. The goal of 10 is just to make the first if fail M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, 10, true ); } //Setting the vector in the stencil M_fsi->FSIOper()->ALETimeAdvance()->shiftRight ( *fluidDisp ); }
void Problem::readLastVectorSolidTimeAdvance ( vectorPtr_Type solidDisp, LifeV::UInt iterInit, std::string iterationString) { using namespace LifeV; typedef FSIOperator::mesh_Type mesh_Type; //Reading another vector for the solidTimeAdvance since its BDF has the same order //as the other ones but since the orderDerivative = 2, the size of the stencil is //orderBDF + 1 solidDisp.reset (new vector_Type (M_fsi->FSIOper()->dFESpace().map(), LifeV::Unique) ); *solidDisp *= 0.0; LifeV::ExporterData<mesh_Type> initSolSolidDisp (LifeV::ExporterData<mesh_Type>::VectorField, "s-displacement." + iterationString, M_fsi->FSIOper()->dFESpacePtr(), solidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); M_importerSolid->readVariable (initSolSolidDisp); //Solid d M_fsi->FSIOper()->setSolidVectorInStencil ( solidDisp, iterInit ); }
void Problem::restartFSI ( GetPot const& data_file) { using namespace LifeV; typedef FSIOperator::mesh_Type mesh_Type; //Creating the pointer to the filter std::string const importerType = data_file ( "importer/type", "ensight"); std::string const fluidName = data_file ( "importer/fluid/filename", "fluid"); std::string const solidName = data_file ( "importer/solid/filename", "solid"); std::string const loadInitSol = data_file ( "importer/initSol", "00000"); std::string const loadInitSolFD = data_file ("importer/initSolFD", "-1"); std::string iterationString; M_Tstart = data_file ( "fluid/time_discretization/initialtime", 0.); std::cout << "The file for fluid is : " << fluidName << std::endl; std::cout << "The file for solid is : " << solidName << std::endl; std::cout << "The importerType is : " << importerType << std::endl; std::cout << "The iteration is : " << loadInitSol << std::endl; std::cout << "For the fluid disp is : " << loadInitSolFD << std::endl; std::cout << "Starting time : " << M_Tstart << std::endl; //At the moment the restart works only if BDF methods are used in time. // For Newmark method a almost new implementation is needed std::string methodFluid = data_file ( "fluid/time_discretization/method", "Newmark"); std::string methodSolid = data_file ( "solid/time_discretization/method", "Newmark"); std::string methodALE = data_file ( "mesh_motion/time_discretization/method", "Newmark"); #ifdef HAVE_HDF5 if (importerType.compare ("hdf5") == 0) { M_importerFluid.reset ( new hdf5Filter_Type ( data_file, fluidName) ); M_importerSolid.reset ( new hdf5Filter_Type ( data_file, solidName) ); } else #endif { if (importerType.compare ("none") == 0) { M_importerFluid.reset ( new ExporterEmpty<mesh_Type > ( data_file, M_fsi->FSIOper()->uFESpace().mesh(), "fluid", M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) ); M_importerSolid.reset ( new ExporterEmpty<mesh_Type > ( data_file, M_fsi->FSIOper()->dFESpace().mesh(), "solid", M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ) ); } else { M_importerFluid.reset ( new ensightFilter_Type ( data_file, fluidName) ); M_importerSolid.reset ( new ensightFilter_Type ( data_file, solidName) ); } } M_importerFluid->setMeshProcId (M_fsi->FSIOper()->uFESpace().mesh(), M_fsi->FSIOper()->uFESpace().map().comm().MyPID() ); M_importerSolid->setMeshProcId (M_fsi->FSIOper()->dFESpace().mesh(), M_fsi->FSIOper()->dFESpace().map().comm().MyPID() ); //Each of the vectors of the stencils has the dimension of the big vector //Performing a cycle of the size of the timeAdvance classes for each problem //The size of TimeAdvanceClass depends on the order of the BDF (data file) //The hypothesis used for this method is that the three TimeAdvance classes have the same size iterationString = loadInitSol; UInt iterInit; vectorPtr_Type vel; vectorPtr_Type pressure; vectorPtr_Type solidDisp; vectorPtr_Type fluidDisp; for (iterInit = 0; iterInit < M_fsi->FSIOper()->fluidTimeAdvance()->size(); iterInit++ ) { //It should work just initializing the timeAdvance classes //Three stencils are needed (Fluid-Structure-Geometric) vel.reset (new vector_Type (M_fsi->FSIOper()->uFESpace().map(), LifeV::Unique) ); pressure.reset (new vector_Type (M_fsi->FSIOper()->pFESpace().map(), LifeV::Unique) ); solidDisp.reset (new vector_Type (M_fsi->FSIOper()->dFESpace().map(), LifeV::Unique) ); //First the three fields are read at the same time //Creating the exporter data for the fields //Fluid LifeV::ExporterData<mesh_Type> initSolFluidVel (LifeV::ExporterData<mesh_Type>::VectorField, std::string ("f-velocity." + iterationString), M_fsi->FSIOper()->uFESpacePtr(), vel, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); LifeV::ExporterData<mesh_Type> initSolFluidPress (LifeV::ExporterData<mesh_Type>::ScalarField, std::string ("f-pressure." + iterationString), M_fsi->FSIOper()->pFESpacePtr(), pressure, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); //Structure LifeV::ExporterData<mesh_Type> initSolSolidDisp (LifeV::ExporterData<mesh_Type>::VectorField, "s-displacement." + iterationString, M_fsi->FSIOper()->dFESpacePtr(), solidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); //Initialization of the vectors used to read *vel *= 0.0; *pressure *= 0.0; *solidDisp *= 0.0; //load of the solutions M_importerFluid->readVariable (initSolFluidVel); //Fluid u M_importerFluid->readVariable (initSolFluidPress); //Fluid p M_importerSolid->readVariable (initSolSolidDisp); //Solid d std::cout << "Norm of the vel " << vel->norm2() << std::endl; std::cout << "Norm of the pressure " << pressure->norm2() << std::endl; std::cout << "Norm of the solid " << solidDisp->norm2() << std::endl; //We send the vectors to the FSIMonolithic class using the interface of FSIOper M_fsi->FSIOper()->setVectorInStencils (vel, pressure, solidDisp, iterInit ) ; //Updating string name int iterations = std::atoi (iterationString.c_str() ); iterations--; std::ostringstream iter; iter.fill ( '0' ); iter << std::setw (5) << ( iterations ); iterationString = iter.str(); } readLastVectorSolidTimeAdvance ( solidDisp, iterInit, iterationString ); //For the ALE timeAdvance, one should be careful on the vectors that are used //to compute the RHSFirstDerivative. That is why we first load the stencil using previous //vectors and then we read the last one iterationString = loadInitSol; int iterationStartALE = std::atoi (iterationString.c_str() ); iterationStartALE--; std::ostringstream iter; iter.fill ( '0' ); iter << std::setw (5) << ( iterationStartALE ); iterationString = iter.str(); std::cout << "The load init sol is: " << loadInitSol << std::endl; std::cout << "The first read sol is: " << iterationString << std::endl; for (iterInit = 0; iterInit < M_fsi->FSIOper()->ALETimeAdvance()->size(); iterInit++ ) { //Reset the pointer fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) ); //Setting the exporterData to read: ALE problem LifeV::ExporterData<mesh_Type> initSolFluidDisp (LifeV::ExporterData<mesh_Type>::VectorField, "f-displacement." + iterationString, M_fsi->FSIOper()->mmFESpacePtr(), fluidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime ); //Initializing *fluidDisp *= 0.0; //Reading M_importerFluid->readVariable (initSolFluidDisp); //Fluid df //Output std::cout << "Norm of the df " << fluidDisp->norm2() << std::endl; //Setting the vector in the stencil M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, iterInit, false ); //Updating string name int iterations = std::atoi (iterationString.c_str() ); iterations--; std::ostringstream iter; iter.fill ( '0' ); iter << std::setw (5) << ( iterations ); iterationString = iter.str(); } //Initializing the vector for the RHS terms of the formulas M_fsi->FSIOper()->finalizeRestart(); //Need to read still one vector and shiftright it. readLastVectorALETimeAdvance ( fluidDisp, loadInitSol ); //This are used to export the loaded solution to check it is correct. vel.reset (new vector_Type (M_fsi->FSIOper()->uFESpace().map(), LifeV::Unique) ); pressure.reset (new vector_Type (M_fsi->FSIOper()->pFESpace().map(), LifeV::Unique) ); fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) ); M_velAndPressure.reset ( new vector_Type ( M_fsi->FSIOper()->fluid().getMap(), M_importerFluid->mapType() ) ); M_velAndPressure->subset (*pressure, pressure->map(), UInt (0), (UInt) 3 * M_fsi->FSIOper()->uFESpace().dof().numTotalDof() ); *M_velAndPressure += *vel; M_fluidDisp.reset ( new vector_Type ( *fluidDisp, M_importerFluid->mapType() ) ); M_solidDisp.reset ( new vector_Type ( *solidDisp, M_importerSolid->mapType() ) ); }
void Problem::initializeWithVectors ( void ) { using namespace LifeV; // vectors to store the solutions we want. vectorPtr_Type vel; vectorPtr_Type pressure; vectorPtr_Type solidDisp; vectorPtr_Type fluidDisp; vel.reset (new vector_Type (M_fsi->FSIOper()->uFESpace().map(), LifeV::Unique) ); pressure.reset (new vector_Type (M_fsi->FSIOper()->pFESpace().map(), LifeV::Unique) ); solidDisp.reset (new vector_Type (M_fsi->FSIOper()->dFESpace().map(), LifeV::Unique) ); fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) ); // In this case we want to initialize only the pressure M_fsi->FSIOper()->pFESpacePtr()->interpolate ( static_cast<FESpace<RegionMesh<LinearTetra>, MapEpetra> ::function_Type> ( pressureInitial ), *pressure, 0.0 ); *vel *= 0.0; *solidDisp *= 0.0; *fluidDisp *= 0.0; UInt iterInit; // Filling the stencils for (iterInit = 0; iterInit < M_fsi->FSIOper()->fluidTimeAdvance()->size(); iterInit++ ) { //We send the vectors to the FSIMonolithic class using the interface of FSIOper M_fsi->FSIOper()->setVectorInStencils (vel, pressure, solidDisp, iterInit ); } // This was in readLastVectorSolidStencil M_fsi->FSIOper()->setSolidVectorInStencil ( solidDisp, iterInit ); // Ale part for (iterInit = 0; iterInit < M_fsi->FSIOper()->ALETimeAdvance()->size(); iterInit++ ) { //Setting the vector in the stencil M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, iterInit, false ); } //Initializing the vector for the RHS terms of the formulas M_fsi->FSIOper()->finalizeRestart(); // This was read the last vector from ALE //This is ugly but it's the only way I have figured out at the moment if ( M_data->method().compare ("monolithicGI") == 0 ) { //Don't be scared by the ten. The goal of 10 is just to make the first if fail M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, 10, true ); } //Setting the vector in the stencil M_fsi->FSIOper()->ALETimeAdvance()->shiftRight ( *fluidDisp ); }