Beispiel #1
0
void
Transient::execute()
{
  preExecute();

  // NOTE: if you remove this line, you will see a subset of tests failing. Those tests might have a wrong answer and might need to be regolded.
  // The reason is that we actually move the solution back in time before we actually start solving (which I think is wrong).  So this call here
  // is to maintain backward compatibility and so that MOOSE is giving the same answer.  However, we might remove this call and regold the test
  // in the future eventually.
  if (!_app.isRecovering())
    _problem.copyOldSolutions();

  // Start time loop...
  while (true)
  {
    if (_first != true)
      incrementStepOrReject();

    _first = false;

    if (!keepGoing())
      break;

    computeDT();
    takeStep();
    endStep();

    _steps_taken++;
  }


  postExecute();
}
Beispiel #2
0
void
Steady::execute()
{
  if (_app.isRecovering())
    return;

  preExecute();

  _problem.advanceState();

  // first step in any steady state solve is always 1 (preserving backwards compatibility)
  _time_step = 1;
  _time = _time_step;                 // need to keep _time in sync with _time_step to get correct output

#ifdef LIBMESH_ENABLE_AMR

  // Define the refinement loop
  unsigned int steps = _problem.adaptivity().getSteps();
  for (unsigned int r_step=0; r_step<=steps; r_step++)
  {
#endif //LIBMESH_ENABLE_AMR
    preSolve();
    _problem.timestepSetup();
    _problem.execute(EXEC_TIMESTEP_BEGIN);
    _problem.outputStep(EXEC_TIMESTEP_BEGIN);

    // Update warehouse active objects
    _problem.updateActiveObjects();

    _problem.solve();
    postSolve();

    if (!lastSolveConverged())
    {
      _console << "Aborting as solve did not converge\n";
      break;
    }

    _problem.onTimestepEnd();
    _problem.execute(EXEC_TIMESTEP_END);

    _problem.computeIndicatorsAndMarkers();

    _problem.outputStep(EXEC_TIMESTEP_END);

#ifdef LIBMESH_ENABLE_AMR
    if (r_step != steps)
    {
      _problem.adaptMesh();
    }

    _time_step++;
    _time = _time_step;                 // need to keep _time in sync with _time_step to get correct output
  }
#endif

  postExecute();
}
Beispiel #3
0
void
NonlinearEigen::execute()
{
  preExecute();

  takeStep();

  postExecute();
}
Beispiel #4
0
void
Steady::execute()
{
  if (_app.isRecovering())
    return;

  if (_app.hasLegacyOutput())
    Moose::out << "Time: " << _time_step << '\n';
  preExecute();

  // first step in any steady state solve is always 1 (preserving backwards compatibility)
  _time_step = 1;
  _time = _time_step;                 // need to keep _time in sync with _time_step to get correct output

#ifdef LIBMESH_ENABLE_AMR

  // Define the refinement loop
  unsigned int steps = _problem.adaptivity().getSteps();
  for(unsigned int r_step=0; r_step<=steps; r_step++)
  {
#endif //LIBMESH_ENABLE_AMR
    _problem.computeUserObjects(EXEC_TIMESTEP_BEGIN, UserObjectWarehouse::PRE_AUX);
    preSolve();
    _problem.updateMaterials();
    _problem.timestepSetup();
    _problem.computeUserObjects(EXEC_TIMESTEP_BEGIN, UserObjectWarehouse::POST_AUX);
    _problem.solve();
    postSolve();

    _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::PRE_AUX);
    _problem.onTimestepEnd();

    _problem.computeAuxiliaryKernels(EXEC_TIMESTEP);
    _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::POST_AUX);
    _problem.computeIndicatorsAndMarkers();

    _output_warehouse.outputStep();

    _problem.output();
    _problem.outputPostprocessors();
    _problem.outputRestart();

#ifdef LIBMESH_ENABLE_AMR
    if (r_step != steps)
    {
      _problem.adaptMesh();
    }

    _time_step++;
    _time = _time_step;                 // need to keep _time in sync with _time_step to get correct output
  }
#endif

  postExecute();
}
Beispiel #5
0
void
NonlinearEigen::execute()
{
  if (_app.isRecovering())
    return;

  preExecute();

  takeStep();

  postExecute();
}
Beispiel #6
0
void
InversePowerMethod::execute()
{
  if (_app.isRecovering())
    return;

  preExecute();

  takeStep();

  postExecute();
}
Beispiel #7
0
void
AdaptiveTransient::execute()
{
  preExecute();

  // Start time loop...
  while (keepGoing())
  {
    takeStep();
    if (lastSolveConverged())
      endStep();
  }
  postExecute();
}
Beispiel #8
0
void OsmAnd::Concurrent::Task::run()
{
    // Check if task wants to cancel itself
    if(preExecute && _cancellationRequestedByExternal.loadAcquire() == 0)
    {
        bool cancellationRequestedByTask = false;
        preExecute(this, cancellationRequestedByTask);
        _cancellationRequestedByTask = cancellationRequestedByTask;
    }

    // If cancellation was not requested by task itself nor by
    // external call
    if(!_cancellationRequestedByTask && _cancellationRequestedByExternal.loadAcquire() == 0)
        execute(this);

    // Report that execution had finished
    if(postExecute)
        postExecute(this, isCancellationRequested());
}
Beispiel #9
0
void
PetscTSExecutioner::execute()
{
  TimeStepperStatus status = STATUS_ITERATING;
  Real ftime = -1e100;
  _fe_problem.initialSetup();
  Moose::setup_perf_log.push("Output Initial Condition","Setup");
  if (_output_initial)
  {
    _fe_problem.output();
    _fe_problem.outputPostprocessors();
    _problem.outputRestart();
  }
  Moose::setup_perf_log.pop("Output Initial Condition","Setup");
  _time_stepper->setup(*_fe_problem.getNonlinearSystem().sys().solution);

  preExecute();

  // Start time loop...
  while (keepGoing(status,ftime))
  {
    status = _time_stepper->step(&ftime);
    _fe_problem.getNonlinearSystem().update();
    _fe_problem.getNonlinearSystem().setSolution(*_fe_problem.getNonlinearSystem().sys().current_local_solution);
    postSolve();
    _fe_problem.onTimestepEnd();
    _fe_problem.computeUserObjects();

    bool reset_dt = false;      /* has some meaning in Transient::computeConstrainedDT, but we do not use that logic here */
    _fe_problem.output(reset_dt);
    _fe_problem.outputPostprocessors(reset_dt);
    _problem.outputRestart(reset_dt);

#ifdef LIBMESH_ENABLE_AMR
    if (_fe_problem.adaptivity().isOn())
    {
      _fe_problem.adaptMesh();
    }
#endif
  }
  postExecute();
}
Beispiel #10
0
void OsmAnd::Concurrent::Task::run()
{
    QMutexLocker scopedLocker(&_cancellationMutex);

    // This local event loop
    QEventLoop localLoop;

    // Check if task wants to cancel itself
    if(preExecute && !_cancellationRequestedByExternal)
    {
        bool cancellationRequestedByTask = false;
        preExecute(this, cancellationRequestedByTask);
        _cancellationRequestedByTask = cancellationRequestedByTask;
    }

    // If cancellation was not requested by task itself nor by
    // external call
    if(!_cancellationRequestedByTask && !_cancellationRequestedByExternal)
        execute(this, localLoop);

    // Report that execution had finished
    if(postExecute)
        postExecute(this, _cancellationRequestedByTask || _cancellationRequestedByExternal);
}
Beispiel #11
0
/*********************************************************************
** METHOD  :
** PURPOSE :
** INPUT   :
** OUTPUT  :
** RETURN  :
** REMARKS :
*********************************************************************/
IProperties* Tool::run (IProperties* input)
{
    /** We keep the input parameters. */
    setInput (input);

    if (getInput()->get(STR_VERSION) != 0)
    {
    	displayVersion(cout);
        return _output;
    }

    /** We define one dispatcher. */
    if (_input->getInt(STR_NB_CORES) == 1)
    {
        setDispatcher (new SerialDispatcher ());
    }
    else
    {
        setDispatcher (new Dispatcher (_input->getInt(STR_NB_CORES)) );
    }

    /** We may have some pre processing. */
    preExecute ();

    /** We execute the actual job. */
    {
        //TIME_INFO (_timeInfo, _name);
        execute ();
    }

    /** We may have some post processing. */
    postExecute ();

    /** We return the output properties. */
    return _output;
}
Beispiel #12
0
void
Steady::execute()
{
  if (_app.isRecovering())
    return;

  _time_step = 0;
  _time = _time_step;
  _problem.outputStep(EXEC_INITIAL);
  _time = _system_time;

  preExecute();

  _problem.advanceState();

  // first step in any steady state solve is always 1 (preserving backwards compatibility)
  _time_step = 1;

#ifdef LIBMESH_ENABLE_AMR

  // Define the refinement loop
  unsigned int steps = _problem.adaptivity().getSteps();
  for (unsigned int r_step = 0; r_step <= steps; r_step++)
  {
#endif // LIBMESH_ENABLE_AMR
    _problem.timestepSetup();

    _last_solve_converged = _picard_solve.solve();

    if (!lastSolveConverged())
    {
      _console << "Aborting as solve did not converge\n";
      break;
    }

    _problem.computeIndicators();
    _problem.computeMarkers();

    // need to keep _time in sync with _time_step to get correct output
    _time = _time_step;
    _problem.outputStep(EXEC_TIMESTEP_END);
    _time = _system_time;

#ifdef LIBMESH_ENABLE_AMR
    if (r_step != steps)
    {
      _problem.adaptMesh();
    }

    _time_step++;
  }
#endif

  {
    TIME_SECTION(_final_timer)
    _problem.execute(EXEC_FINAL);
    _time = _time_step;
    _problem.outputStep(EXEC_FINAL);
    _time = _system_time;
  }

  postExecute();
}
Beispiel #13
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();
}