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 "Transient.h" 11 : 12 : // MOOSE includes 13 : #include "FixedPointSolve.h" 14 : #include "AuxiliarySystem.h" 15 : #include "SolverSystem.h" 16 : 17 : registerMooseObject("MooseApp", Transient); 18 : 19 : InputParameters 20 89868 : Transient::validParams() 21 : { 22 89868 : InputParameters params = TransientBase::validParams(); 23 89868 : params.addClassDescription("Executioner for time varying simulations."); 24 : 25 89868 : params += FEProblemSolve::validParams(); 26 : 27 89868 : return params; 28 0 : } 29 : 30 30620 : Transient::Transient(const InputParameters & parameters) 31 30620 : : TransientBase(parameters), _feproblem_solve(*this) 32 : { 33 30612 : _fixed_point_solve->setInnerSolve(_feproblem_solve); 34 30612 : } 35 : 36 : void 37 29845 : Transient::init() 38 : { 39 29845 : TransientBase::init(); 40 : 41 29633 : _feproblem_solve.initialSetup(); 42 29629 : } 43 : 44 : Real 45 19524 : Transient::relativeSolutionDifferenceNorm(bool check_aux) const 46 : { 47 19524 : if (check_aux) 48 0 : return _aux.solution().l2_norm_diff(_aux.solutionOld()) / _aux.solution().l2_norm(); 49 : else 50 : { 51 : // Default criterion for now until we add a "steady-state-convergence-object" option 52 19524 : Real residual = 0; 53 42457 : for (const auto sys : _feproblem_solve.systemsToSolve()) 54 22933 : residual += 55 22933 : std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2); 56 19524 : return std::sqrt(residual); 57 : } 58 : } 59 : 60 : std::set<TimeIntegrator *> 61 453993 : Transient::getTimeIntegrators() const 62 : { 63 : // We use a set because time integrators were added to every system, and we want a unique 64 453993 : std::set<TimeIntegrator *> tis; 65 : // Get all time integrators from the systems in the FEProblemSolve 66 915092 : for (const auto sys : _feproblem_solve.systemsToSolve()) 67 923747 : for (const auto & ti : sys->getTimeIntegrators()) 68 462648 : tis.insert(ti.get()); 69 453993 : return tis; 70 0 : }