void TransientMultiApp::resetApp(unsigned int global_app, Real /*time*/) // FIXME: Note that we are passing in time but also grabbing it below { if (hasLocalApp(global_app)) { unsigned int local_app = globalAppToLocal(global_app); // Grab the current time the App is at so we can start the new one at the same place Real time = _transient_executioners[local_app]->getTime() + _apps[local_app]->getGlobalTimeOffset(); // Extract the file numbers from the output, so that the numbering is maintained after reset std::map<std::string, unsigned int> m = _apps[local_app]->getOutputWarehouse().getFileNumbers(); // Reset the Multiapp MultiApp::resetApp(global_app, time); // Reset the file numbers of the newly reset apps _apps[local_app]->getOutputWarehouse().setFileNumbers(m); MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm); setupApp(local_app, time, false); // Swap back Moose::swapLibMeshComm(swapped); } }
void TransientMultiApp::resetApp( unsigned int global_app, Real /*time*/) // FIXME: Note that we are passing in time but also grabbing it below { if (hasLocalApp(global_app)) { unsigned int local_app = globalAppToLocal(global_app); // Grab the current time the App is at so we can start the new one at the same place Real time = _transient_executioners[local_app]->getTime() + _apps[local_app]->getGlobalTimeOffset(); // Reset the Multiapp MultiApp::resetApp(global_app, time); Moose::ScopedCommSwapper swapper(_my_comm); // Setup the app, disable the output so that the initial condition does not output // When an app is reset the initial condition was effectively already output before reset FEProblemBase & problem = appProblemBase(local_app); problem.allowOutput(false); setupApp(local_app, time); problem.allowOutput(true); } }
Executioner * MultiApp::getExecutioner(unsigned int app) { if (!_has_an_app) mooseError("No app for " << name() << " on processor " << _orig_rank); return _apps[globalAppToLocal(app)]->getExecutioner(); }
FEProblem & MultiApp::appProblem(unsigned int app) { if (!_has_an_app) mooseError("No app for " << name() << " on processor " << _orig_rank); unsigned int local_app = globalAppToLocal(app); return _apps[local_app]->getExecutioner()->feProblem(); }
FEProblem * MultiApp::appProblem(unsigned int app) { if (!_has_an_app) mooseError("No app for " << name() << " on processor " << _orig_rank); unsigned int local_app = globalAppToLocal(app); FEProblem * problem = dynamic_cast<FEProblem *>(&_apps[local_app]->getExecutioner()->problem()); mooseAssert(problem, "Not an FEProblem!"); return problem; }
void MultiApp::moveApp(unsigned int global_app, Point p) { _positions[global_app] = p; if (hasLocalApp(global_app)) { unsigned int local_app = globalAppToLocal(global_app); if (_output_in_position) _apps[local_app]->setOutputPosition(p); } }
void TransientMultiApp::resetApp(unsigned int global_app, Real /*time*/) // FIXME: Note that we are passing in time but also grabbing it below { if (hasLocalApp(global_app)) { unsigned int local_app = globalAppToLocal(global_app); // Grab the current time the App is at so we can start the new one at the same place Real time = _transient_executioners[local_app]->getTime() + _apps[local_app]->getGlobalTimeOffset(); // Reset the Multiapp MultiApp::resetApp(global_app, time); MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm); setupApp(local_app, time, false); // Swap back Moose::swapLibMeshComm(swapped); } }
void MultiApp::resetApp(unsigned int global_app, Real time) { MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm); if (hasLocalApp(global_app)) { unsigned int local_app = globalAppToLocal(global_app); // Extract the file numbers from the output, so that the numbering is maintained after reset std::map<std::string, unsigned int> m = _apps[local_app]->getOutputWarehouse().getFileNumbers(); // Delete and create a new App delete _apps[local_app]; createApp(local_app, time); // Reset the file numbers of the newly reset apps _apps[local_app]->getOutputWarehouse().setFileNumbers(m); } // Swap back Moose::swapLibMeshComm(swapped); }