Example #1
0
void
FullSolveMultiApp::initialSetup()
{
  MultiApp::initialSetup();

  if (_has_an_app)
  {
    MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

    _executioners.resize(_my_num_apps);

    // Grab Executioner from each app
    for (unsigned int i=0; i<_my_num_apps; i++)
    {
      MooseApp * app = _apps[i];
      Executioner * ex = app->getExecutioner();

      if (!ex)
        mooseError("Executioner does not exist!");

      ex->init();

      _executioners[i] = ex;
    }
    // Swap back
    Moose::swapLibMeshComm(swapped);
  }
}
Example #2
0
void
FullSolveMultiApp::solveStep(Real /*dt*/, Real /*target_time*/, bool auto_advance)
{
  if (!auto_advance)
    mooseError("FullSolveMultiApp is not compatible with auto_advance=false");

  if (!_has_an_app)
    return;

  if (_solved)
    return;

  Moose::out << "Fully Solving MultiApp " << _name << std::endl;

  MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

  int rank;
  int ierr;
  ierr = MPI_Comm_rank(_orig_comm, &rank); mooseCheckMPIErr(ierr);

  for(unsigned int i=0; i<_my_num_apps; i++)
  {
    Executioner * ex = _executioners[i];
    ex->init();
    ex->execute();
  }

  // Swap back
  Moose::swapLibMeshComm(swapped);

  _solved = true;

  Moose::out << "Finished Solving MultiApp " << _name << std::endl;
}