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 : #include "TimeStepper.h" 13 : 14 : /** 15 : * Solves the PDEs at a sequence of given time points. 16 : * Adjusts the time sequence vector according to Transient start_time and end_time. 17 : */ 18 : class TimeSequenceStepperBase : public TimeStepper 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : TimeSequenceStepperBase(const InputParameters & parameters); 24 : 25 : void setupSequence(const std::vector<Real> & times); 26 : 27 : // Increase the current step count by one 28 81 : void increaseCurrentStep() { _current_step++; }; 29 : 30 : // Get the time of the current step from input time sequence 31 740 : Real getNextTimeInSequence() { return _time_sequence[_current_step]; }; 32 : 33 34 : virtual void init() override {} 34 : virtual void step() override; 35 : 36 : protected: 37 : virtual Real computeInitialDT() override; 38 : virtual Real computeDT() override; 39 : virtual Real computeFailedDT() override; 40 : 41 : /// Whether to use the final dt past the last t in sequence 42 : const bool _use_last_dt_after_last_t; 43 : 44 : /// the step that the time stepper is currently at 45 : unsigned int & _current_step; 46 : 47 : /// stores the sequence of time points 48 : std::vector<Real> & _time_sequence; 49 : };