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 14449 : SimplePredictor::validParams() 17 : { 18 14449 : InputParameters params = Predictor::validParams(); 19 14449 : params.addClassDescription( 20 : "Algorithm that will predict the next solution based on previous solutions."); 21 14449 : return params; 22 0 : } 23 : 24 92 : SimplePredictor::SimplePredictor(const InputParameters & parameters) : Predictor(parameters) {} 25 : 26 : bool 27 283 : SimplePredictor::shouldApply() 28 : { 29 283 : bool should_apply = Predictor::shouldApply(); 30 : 31 283 : if (_t_step < 2 || _dt_old <= 0) 32 86 : should_apply = false; 33 : 34 283 : return should_apply; 35 : } 36 : 37 : void 38 153 : SimplePredictor::apply(NumericVector<Number> & sln) 39 : { 40 153 : _console << " Applying predictor with scale factor = " << _scale << std::endl; 41 : 42 153 : Real dt_adjusted_scale_factor = _scale * _dt / _dt_old; 43 153 : if (dt_adjusted_scale_factor != 0.0) 44 : { 45 153 : sln *= (1.0 + dt_adjusted_scale_factor); 46 153 : sln.add(-dt_adjusted_scale_factor, _solution_older); 47 : } 48 153 : }