std::string outputExecutionInformation(MooseApp & app, FEProblem & problem) { std::stringstream oss; oss << std::left; Executioner * exec = app.getExecutioner(); oss << "Execution Information:\n" << std::setw(console_field_width) << " Executioner: " << demangle(typeid(*exec).name()) << '\n'; std::string time_stepper = exec->getTimeStepperName(); if (time_stepper != "") oss << std::setw(console_field_width) << " TimeStepper: " << time_stepper << '\n'; oss << std::setw(console_field_width) << " Solver Mode: " << Moose::stringify<Moose::SolveType>(problem.solverParams()._type) << '\n'; const std::string & pc_desc = problem.getPetscOptions().pc_description; if (!pc_desc.empty()) oss << std::setw(console_field_width) << " Preconditioner: " << pc_desc << '\n'; oss << '\n'; return oss.str(); }
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; _console << "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->execute(); } // Swap back Moose::swapLibMeshComm(swapped); _solved = true; _console << "Finished Solving MultiApp " << name() << std::endl; }
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); } }
TEST(MinimalApp, create) { const char * argv[1] = {"\0"}; std::shared_ptr<MooseApp> app = AppFactory::createAppShared("MooseUnitApp", 1, (char **)argv); app->parameters().set<bool>("minimal") = true; app->run(); Executioner * exec = app->getExecutioner(); EXPECT_EQ(exec->name(), "Executioner"); FEProblemBase & fe_problem = exec->feProblem(); EXPECT_EQ(fe_problem.name(), "MOOSE Problem"); MooseMesh & mesh = fe_problem.mesh(); EXPECT_EQ(mesh.nElem(), 1); }