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 649 : Optimize::validParams() 17 : { 18 649 : InputParameters params = Steady::validParams(); 19 649 : params += OptimizeSolve::validParams(); 20 649 : params.addClassDescription("Executioner for optimization problems."); 21 649 : return params; 22 0 : } 23 : 24 324 : Optimize::Optimize(const InputParameters & parameters) : Steady(parameters), _optim_solve(*this) 25 : { 26 324 : _optim_solve.setInnerSolve(fixedPointSolve()); 27 324 : } 28 : 29 : void 30 322 : Optimize::execute() 31 : { 32 322 : _problem.outputStep(EXEC_INITIAL); 33 : 34 322 : preExecute(); 35 : 36 322 : _problem.advanceState(); 37 : 38 : // first step in any steady state solve is always 1 (preserving backwards compatibility) 39 322 : _time_step = 1; 40 : 41 322 : _problem.timestepSetup(); 42 : 43 322 : _last_solve_converged = _optim_solve.solve(); 44 : 45 : // need to keep _time in sync with _time_step to get correct output 46 315 : _time = _time_step; 47 315 : _problem.execute(EXEC_TIMESTEP_END); 48 315 : _problem.outputStep(EXEC_TIMESTEP_END); 49 315 : _time = _system_time; 50 : 51 315 : _problem.execMultiApps(EXEC_FINAL); 52 315 : _problem.finalizeMultiApps(); 53 315 : _problem.execute(EXEC_FINAL); 54 315 : _time = _time_step; 55 315 : _problem.outputStep(EXEC_FINAL); 56 315 : _time = _system_time; 57 : 58 315 : postExecute(); 59 315 : }