LCOV - code coverage report
Current view: top level - src/executioners - SteadyBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 51 52 98.1 %
Date: 2025-07-17 01:28:37 Functions: 3 3 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             : // MOOSE includes
      11             : #include "SteadyBase.h"
      12             : #include "FEProblem.h"
      13             : #include "Factory.h"
      14             : #include "MooseApp.h"
      15             : #include "NonlinearSystem.h"
      16             : 
      17             : #include "libmesh/equation_systems.h"
      18             : 
      19             : InputParameters
      20      142907 : SteadyBase::validParams()
      21             : {
      22      142907 :   InputParameters params = Executioner::validParams();
      23      142907 :   params.addParam<Real>("time", 0.0, "System time");
      24      142907 :   return params;
      25           0 : }
      26             : 
      27       28310 : SteadyBase::SteadyBase(const InputParameters & parameters)
      28             :   : Executioner(parameters),
      29       28310 :     _problem(_fe_problem),
      30       28310 :     _system_time(getParam<Real>("time")),
      31       28310 :     _time_step(_problem.timeStep()),
      32       28310 :     _time(_problem.time()),
      33       28310 :     _output_iteration_number(0)
      34             : {
      35       28310 :   _time = _system_time;
      36       28310 : }
      37             : 
      38             : void
      39       27088 : SteadyBase::execute()
      40             : {
      41       27088 :   if (_app.isRecovering())
      42             :   {
      43        1529 :     _console << "\nCannot recover steady-state solves of type: " << this->type()
      44        1529 :              << "!\nExiting...\n"
      45        1529 :              << std::endl;
      46        1529 :     _last_solve_converged = true;
      47        1529 :     return;
      48             :   }
      49             : 
      50       25559 :   _time_step = 0;
      51       25559 :   _time = _time_step;
      52       25559 :   _problem.outputStep(EXEC_INITIAL);
      53       25555 :   _time = _system_time;
      54             : 
      55       25555 :   preExecute();
      56             : 
      57       25555 :   _problem.advanceState();
      58             : 
      59             :   // first step in any SteadyBase state solve is always 1 (preserving backwards compatibility)
      60       25555 :   _time_step = 1;
      61             : 
      62             : #ifdef LIBMESH_ENABLE_AMR
      63             : 
      64             :   // Define the refinement loop
      65       25555 :   unsigned int steps = _problem.adaptivity().getSteps();
      66       51500 :   for (unsigned int r_step = 0; r_step <= steps; r_step++)
      67             :   {
      68             : #endif // LIBMESH_ENABLE_AMR
      69       26338 :     _problem.timestepSetup();
      70             : 
      71       26338 :     _last_solve_converged = _fixed_point_solve->solve();
      72             : 
      73       26134 :     if (!lastSolveConverged())
      74             :     {
      75         181 :       _console << "Aborting as solve did not converge" << std::endl;
      76         181 :       break;
      77             :     }
      78             : 
      79       25953 :     _problem.computeIndicators();
      80       25953 :     _problem.computeMarkers();
      81             : 
      82             :     // need to keep _time in sync with _time_step to get correct output
      83       25949 :     _time = _time_step;
      84       25949 :     _problem.outputStep(EXEC_TIMESTEP_END);
      85       25945 :     _time = _system_time;
      86             : 
      87             : #ifdef LIBMESH_ENABLE_AMR
      88       25945 :     if (r_step != steps)
      89             :     {
      90         783 :       _problem.adaptMesh();
      91             :     }
      92             : 
      93       25945 :     _time_step++;
      94             :   }
      95             : #endif
      96             : 
      97             :   {
      98       25343 :     TIME_SECTION("final", 1, "Executing Final Objects")
      99       25343 :     _problem.execMultiApps(EXEC_FINAL);
     100       25343 :     _problem.finalizeMultiApps();
     101       25343 :     _problem.postExecute();
     102       25343 :     _problem.execute(EXEC_FINAL);
     103       25343 :     _time = _time_step;
     104       25343 :     _problem.outputStep(EXEC_FINAL);
     105       25343 :     _time = _system_time;
     106       25343 :   }
     107             : 
     108       25343 :   postExecute();
     109             : }

Generated by: LCOV version 1.14