Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "Optimize.h" 11 : #include "FEProblemBase.h" 12 : 13 : registerMooseObject("OptimizationApp", Optimize); 14 : 15 : InputParameters 16 998 : Optimize::validParams() 17 : { 18 998 : InputParameters params = Steady::validParams(); 19 998 : params += OptimizeSolve::validParams(); 20 998 : params.addClassDescription("Executioner for optimization problems."); 21 998 : return params; 22 0 : } 23 : 24 499 : Optimize::Optimize(const InputParameters & parameters) : Steady(parameters), _optim_solve(*this) 25 : { 26 499 : _optim_solve.setInnerSolve(fixedPointSolve()); 27 499 : } 28 : 29 : void 30 499 : Optimize::execute() 31 : { 32 499 : _problem.outputStep(EXEC_INITIAL); 33 : 34 499 : preExecute(); 35 : 36 499 : _problem.advanceState(); 37 : 38 : // first step in any steady state solve is always 1 (preserving backwards compatibility) 39 499 : _time_step = 1; 40 : 41 499 : _problem.timestepSetup(); 42 : 43 499 : _last_solve_converged = _optim_solve.solve(); 44 : 45 : // need to keep _time in sync with _time_step to get correct output 46 485 : _time = _time_step; 47 485 : _problem.execute(EXEC_TIMESTEP_END); 48 485 : _problem.outputStep(EXEC_TIMESTEP_END); 49 485 : _time = _system_time; 50 : 51 485 : _problem.execMultiApps(EXEC_FINAL); 52 485 : _problem.finalizeMultiApps(); 53 485 : _problem.execute(EXEC_FINAL); 54 485 : _time = _time_step; 55 485 : _problem.outputStep(EXEC_FINAL); 56 485 : _time = _system_time; 57 : 58 485 : postExecute(); 59 485 : }