LCOV - code coverage report
Current view: top level - src/timesteppers - PostprocessorDT.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 22 23 95.7 %
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 "PostprocessorDT.h"
      11             : 
      12             : registerMooseObject("MooseApp", PostprocessorDT);
      13             : 
      14             : InputParameters
      15       14385 : PostprocessorDT::validParams()
      16             : {
      17       14385 :   InputParameters params = TimeStepper::validParams();
      18       14385 :   params.addClassDescription("Computes timestep based on a Postprocessor value.");
      19       14385 :   params.addRequiredParam<PostprocessorName>("postprocessor",
      20             :                                              "The name of the postprocessor that computes the dt");
      21       14385 :   params.addParam<Real>("dt", "Initial value of dt");
      22       14385 :   params.addParam<Real>("scale", 1, "Multiple scale and supplied postprocessor value.");
      23       14385 :   params.addParam<Real>("offset", 0, "Add an offset to the supplied postprocessor value.");
      24       14385 :   params.addDeprecatedParam<Real>("factor",
      25             :                                   "Add an offset to the supplied postprocessor value",
      26             :                                   "offset has replaced factor for that same purpose");
      27       14385 :   return params;
      28           0 : }
      29             : 
      30          60 : PostprocessorDT::PostprocessorDT(const InputParameters & parameters)
      31             :   : TimeStepper(parameters),
      32             :     PostprocessorInterface(this),
      33          60 :     _pps_value(getPostprocessorValue("postprocessor")),
      34          60 :     _has_initial_dt(isParamValid("dt")),
      35          60 :     _initial_dt(_has_initial_dt ? getParam<Real>("dt") : 0.),
      36          60 :     _scale(getParam<Real>("scale")),
      37         120 :     _offset(isParamValid("offset") ? getParam<Real>("offset") : getParam<Real>("factor"))
      38             : {
      39          60 : }
      40             : 
      41             : Real
      42         110 : PostprocessorDT::computeInitialDT()
      43             : {
      44         110 :   if (_has_initial_dt)
      45          22 :     return _initial_dt;
      46             :   else
      47          88 :     return computeDT();
      48             : }
      49             : 
      50             : Real
      51         330 : PostprocessorDT::computeDT()
      52             : {
      53         330 :   return _scale * _pps_value + _offset;
      54             : }

Generated by: LCOV version 1.14