Esempio n. 1
0
void
NonlinearEigen::takeStep()
{
  _console << " Nonlinear iteration starts"  << std::endl;

  // nonlinear solve
  preSolve();
  _problem.timestepSetup();
  _problem.advanceState();
  _problem.execute(EXEC_TIMESTEP_BEGIN);

  nonlinearSolve(_rel_tol, _abs_tol, _pfactor, _eigenvalue);

  postSolve();
  printEigenvalue();

  _problem.onTimestepEnd();
  _problem.execute(EXEC_TIMESTEP_END);
}
Esempio n. 2
0
void
NonlinearEigen::takeStep()
{
  _console << " Nonlinear iteration starts"  << std::endl;

  // nonlinear solve
  _problem.computeUserObjects(EXEC_TIMESTEP_BEGIN, UserObjectWarehouse::PRE_AUX);
  preSolve();
  _problem.timestepSetup();
  _problem.advanceState();
  _problem.computeUserObjects(EXEC_TIMESTEP_BEGIN, UserObjectWarehouse::POST_AUX);

  nonlinearSolve(_rel_tol, _abs_tol, _pfactor, _eigenvalue);

  postSolve();
  printEigenvalue();

  _problem.computeUserObjects(EXEC_TIMESTEP_END, UserObjectWarehouse::PRE_AUX);
  _problem.onTimestepEnd();
  _problem.computeAuxiliaryKernels(EXEC_TIMESTEP_END);
  _problem.computeUserObjects(EXEC_TIMESTEP_END, UserObjectWarehouse::POST_AUX);
}
Esempio n. 3
0
void
NonlinearEigen::execute()
{
  preExecute();

  // save the initial guess
  _problem.copyOldSolutions();

  Real initial_res = 0.0;
  if (_free_iter>0)
  {
    // free power iterations
    Moose::out << std::endl << " Free power iteration starts"  << std::endl;

    inversePowerIteration(_free_iter, _free_iter, _pfactor, false,
                          std::numeric_limits<Real>::min(), std::numeric_limits<Real>::max(),
                          true, _output_pi, 0.0,
                          _eigenvalue, initial_res);
  }

  if (!getParam<bool>("output_on_final"))
  {
    _problem.timeStep() = POWERITERATION_END;
    Real t = _problem.time();
    _problem.time() = _problem.timeStep();
    _output_warehouse.outputStep();
    _problem.time() = t;
  }

  Moose::out << " Nonlinear iteration starts"  << std::endl;

  _problem.timestepSetup();
  _problem.copyOldSolutions();

  Real rel_tol = _rel_tol;
  Real abs_tol = _abs_tol;
  if (_free_iter>0)
  {
    Moose::out << " Initial |R| = " << initial_res << std::endl;
    abs_tol = _rel_tol*initial_res;
    if (abs_tol<_abs_tol) abs_tol = _abs_tol;
    rel_tol = 1e-50;
  }

  // nonlinear solve
  preSolve();
  nonlinearSolve(rel_tol, abs_tol, _pfactor, _eigenvalue);
  postSolve();

  _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::PRE_AUX);
  _problem.onTimestepEnd();
  _problem.computeAuxiliaryKernels(EXEC_TIMESTEP);
  _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::POST_AUX);
  if (_run_custom_uo) _problem.computeUserObjects(EXEC_CUSTOM);

  if (!getParam<bool>("output_on_final"))
  {
    _problem.timeStep() = NONLINEAR_SOLVE_END;
    Real t = _problem.time();
    _problem.time() = _problem.timeStep();
    _output_warehouse.outputStep();
    _problem.time() = t;
  }

  Real s = normalizeSolution(_norm_execflag!=EXEC_CUSTOM && _norm_execflag!=EXEC_TIMESTEP &&
                             _norm_execflag!=EXEC_RESIDUAL);

  Moose::out << " Solution is rescaled with factor " << s << " for normalization!" << std::endl;

  if (getParam<bool>("output_on_final") || std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon())
  {
    _problem.timeStep() = FINAL;
    Real t = _problem.time();
    _problem.time() = _problem.timeStep();
    _output_warehouse.outputStep();
    _problem.time() = t;
  }

  postExecute();
}