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 : #pragma once 11 : 12 : // MOOSE includes 13 : #include "MooseObject.h" 14 : #include "Restartable.h" 15 : 16 : class FEProblemBase; 17 : class NonlinearSystemBase; 18 : 19 : namespace libMesh 20 : { 21 : template <typename T> 22 : class NumericVector; 23 : } 24 : 25 : /** 26 : * Base class for predictors. 27 : */ 28 : class Predictor : public MooseObject, public Restartable 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : Predictor(const InputParameters & parameters); 34 : virtual ~Predictor(); 35 : 36 0 : virtual int order() { return 0; } 37 : virtual void timestepSetup(); 38 : virtual bool shouldApply(); 39 : virtual void apply(NumericVector<Number> & sln) = 0; 40 : 41 0 : virtual NumericVector<Number> & solutionPredictor() { return _solution_predictor; } 42 : 43 : protected: 44 : FEProblemBase & _fe_problem; 45 : NonlinearSystemBase & _nl; 46 : 47 : int & _t_step; 48 : Real & _dt; 49 : Real & _dt_old; 50 : const NumericVector<Number> & _solution; 51 : NumericVector<Number> & _solution_old; 52 : NumericVector<Number> & _solution_older; 53 : NumericVector<Number> & _solution_predictor; 54 : int & _t_step_old; 55 : bool & _is_repeated_timestep; 56 : 57 : /// Amount by which to scale the predicted value. Must be in [0,1]. 58 : Real _scale; 59 : 60 : /// Times for which the predictor should not be applied 61 : std::vector<Real> _skip_times; 62 : 63 : /// Old times for which the predictor should not be applied 64 : std::vector<Real> _skip_times_old; 65 : 66 : /// Option to skip prediction after a failed timestep 67 : const bool & _skip_after_failed_timetep; 68 : 69 : /// Timestep tolerance from Transient executioner 70 : const Real & _timestep_tolerance; 71 : 72 : friend class SetupPredictorAction; 73 : };