当前位置: 首页>>代码示例>>C++>>正文


C++ Files::PrintRunForRestart方法代码示例

本文整理汇总了C++中Files::PrintRunForRestart方法的典型用法代码示例。如果您正苦于以下问题:C++ Files::PrintRunForRestart方法的具体用法?C++ Files::PrintRunForRestart怎么用?C++ Files::PrintRunForRestart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Files的用法示例。


在下文中一共展示了Files::PrintRunForRestart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
  

  SystemTwo & eqnT = ml_prob.add_system<SystemTwo>("Eqn_T");
  
         eqnT.AddSolutionToSystemPDE("Qty_Temperature");
         eqnT.AddSolutionToSystemPDE("Qty_TempLift");
         eqnT.AddSolutionToSystemPDE("Qty_TempAdj");
	 
         eqnT.AddUnknownToSystemPDE(&temperature);
         eqnT.AddUnknownToSystemPDE(&templift);
         eqnT.AddUnknownToSystemPDE(&tempadj); //the order in which you add defines the order in the matrix as well, so it is in tune with the assemble function
	 
	 eqnT.SetAssembleFunction(GenMatRhsT);
  
//================================ 
//========= End add EQUATIONS  and ========
//========= associate an EQUATION to QUANTITIES ========
//================================

//Ok now that the mesh file is there i want to COMPUTE the MG OPERATORS... but I want to compute them ONCE and FOR ALL,
//not for every equation... but the functions belong to the single equation... I need to make them EXTERNAL
// then I'll have A from the equation, PRL and REST from a MG object.
//So somehow i'll have to put these objects at a higher level... but so far let us see if we can COMPUTE and PRINT from HERE and not from the gencase
	 
 
//once you have the list of the equations, you loop over them to initialize everything

   for (MultiLevelProblem::const_system_iterator eqn = ml_prob.begin(); eqn != ml_prob.end(); eqn++) {
     
   SystemTwo* sys = static_cast<SystemTwo*>(eqn->second);
   
  // ******* set MG-Solver *******
  sys->SetMgType(F_CYCLE);
  sys->SetLinearConvergenceTolerance(1.e-10);
  sys->SetNonLinearConvergenceTolerance(1.e-10);//1.e-5
  sys->SetNumberPreSmoothingStep(1);
  sys->SetNumberPostSmoothingStep(1);
  sys->SetMaxNumberOfLinearIterations(8);     //2
  sys->SetMaxNumberOfNonLinearIterations(15); //10
  
  // ******* Set Preconditioner *******
  sys->SetMgSmoother(GMRES_SMOOTHER);//ASM_SMOOTHER,VANKA_SMOOTHER
   
  // ******* init *******
  sys->init();
  
  // ******* Set Smoother *******
  sys->SetSolverFineGrids(GMRES);
  sys->SetPreconditionerFineGrids(ILU_PRECOND); 
  sys->SetTolerances(1.e-12,1.e-20,1.e+50,20);   /// what the heck do these parameters mean?

    // ******* Add variables to be solved *******  /// do we always need this?
  sys->ClearVariablesToBeSolved();
  sys->AddVariableToBeSolved("All");
  
    
  // ******* For Gmres Preconditioner only *******
  sys->SetDirichletBCsHandling(ELIMINATION);
  
  // ******* For Gmres Preconditioner only *******
//   sys->solve();

//=====================
    sys -> init_two();     //the dof map is built here based on all the solutions associated with that system
    sys -> _LinSolver[0]->set_solver_type(GMRES);  //if I keep PREONLY it doesn't run

//=====================
    sys -> init_unknown_vars();
//=====================
    sys -> _dofmap.ComputeMeshToDof();
//=====================
    sys -> initVectors();
//=====================
    sys -> Initialize();
///=====================
    sys -> _bcond.GenerateBdc();
//=====================
    GenCase::ReadMGOps(files.GetOutputPath(),sys);
    
    } 
	 
  // ======== Loop ===================================
  FemusInputParser<double> loop_map("TimeLoop",files.GetOutputPath());
  OptLoop opt_loop(files, loop_map); 
   
  opt_loop.TransientSetup(ml_prob);  // reset the initial state (if restart) and print the Case

  opt_loop.optimization_loop(ml_prob);

// at this point, the run has been completed 
  files.PrintRunForRestart(DEFAULT_LAST_RUN);
  files.log_petsc();
  
// ============  clean ================================
  ml_prob.clear();
  mesh.clear();
  
  
  return 0;
}
开发者ID:CasaNostra,项目名称:femus,代码行数:101,代码来源:main.cpp


注:本文中的Files::PrintRunForRestart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。