LCOV - code coverage report
Current view: top level - src/predictors - SimplePredictor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 17 18 94.4 %
Date: 2026-05-29 20:35:17 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 "SimplePredictor.h"
      11             : #include "NonlinearSystem.h"
      12             : 
      13             : registerMooseObject("MooseApp", SimplePredictor);
      14             : 
      15             : InputParameters
      16        3239 : SimplePredictor::validParams()
      17             : {
      18        3239 :   InputParameters params = Predictor::validParams();
      19        3239 :   params.addClassDescription(
      20             :       "Algorithm that will predict the next solution based on previous solutions.");
      21        3239 :   return params;
      22           0 : }
      23             : 
      24          89 : SimplePredictor::SimplePredictor(const InputParameters & parameters) : Predictor(parameters) {}
      25             : 
      26             : bool
      27         273 : SimplePredictor::shouldApply()
      28             : {
      29         273 :   bool should_apply = Predictor::shouldApply();
      30             : 
      31         273 :   if (_t_step < 2 || _dt_old <= 0)
      32          87 :     should_apply = false;
      33             : 
      34         273 :   return should_apply;
      35             : }
      36             : 
      37             : void
      38         143 : SimplePredictor::apply(NumericVector<Number> & sln)
      39             : {
      40         143 :   _console << "  Applying predictor with scale factor = " << _scale << std::endl;
      41             : 
      42         143 :   Real dt_adjusted_scale_factor = _scale * _dt / _dt_old;
      43         143 :   if (dt_adjusted_scale_factor != 0.0)
      44             :   {
      45         143 :     sln *= (1.0 + dt_adjusted_scale_factor);
      46         143 :     sln.add(-dt_adjusted_scale_factor, _solution_older);
      47             :   }
      48         143 : }

Generated by: LCOV version 1.14