LCOV - code coverage report
Current view: top level - src/executioners - Transient.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 23 25 92.0 %
Date: 2025-07-17 01:28:37 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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       85434 : Transient::validParams()
      21             : {
      22       85434 :   InputParameters params = TransientBase::validParams();
      23       85434 :   params.addClassDescription("Executioner for time varying simulations.");
      24             : 
      25       85434 :   params += FEProblemSolve::validParams();
      26             : 
      27       85434 :   return params;
      28           0 : }
      29             : 
      30       28403 : Transient::Transient(const InputParameters & parameters)
      31       28403 :   : TransientBase(parameters), _feproblem_solve(*this)
      32             : {
      33       28395 :   _fixed_point_solve->setInnerSolve(_feproblem_solve);
      34       28395 : }
      35             : 
      36             : Real
      37      227564 : Transient::relativeSolutionDifferenceNorm()
      38             : {
      39      227564 :   if (_check_aux)
      40         506 :     return _aux.solution().l2_norm_diff(_aux.solutionOld()) / _aux.solution().l2_norm();
      41             :   else
      42             :   {
      43             :     // Default criterion for now until we add a "steady-state-convergence-object" option
      44      227058 :     Real residual = 0;
      45      457350 :     for (const auto sys : _feproblem_solve.systemsToSolve())
      46      230292 :       residual +=
      47      230292 :           std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2);
      48      227058 :     return std::sqrt(residual);
      49             :   }
      50             : }
      51             : 
      52             : std::set<TimeIntegrator *>
      53      416791 : Transient::getTimeIntegrators() const
      54             : {
      55             :   // We use a set because time integrators were added to every system, and we want a unique
      56      416791 :   std::set<TimeIntegrator *> tis;
      57             :   // Get all time integrators from the systems in the FEProblemSolve
      58      840096 :   for (const auto sys : _feproblem_solve.systemsToSolve())
      59      848151 :     for (const auto & ti : sys->getTimeIntegrators())
      60      424846 :       tis.insert(ti.get());
      61      416791 :   return tis;
      62           0 : }

Generated by: LCOV version 1.14