https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CompositionDT.h
Go to the documentation of this file.
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"
14
28{
29public:
38
40
46 {
47 bool operator()(const std::pair<Real, TimeStepper *> & a,
48 const std::pair<Real, TimeStepper *> & b) const
49 {
50 return a.first < b.first;
51 }
52 };
59 Real produceCompositionDT(std::set<std::pair<Real, TimeStepper *>, CompareFirst> & dts,
60 std::set<std::pair<Real, TimeStepper *>, CompareFirst> & bound_dts);
61
62 // Find the time point to hit at current time step
64
69 virtual void init() override final;
70 virtual void preExecute() override final;
71 virtual void preSolve() override final;
72 virtual void postSolve() override final;
73 virtual void postExecute() override final;
74 virtual void preStep() override final;
75 virtual void postStep() override final;
76 virtual bool constrainStep(Real & dt) override final;
77
85 virtual void step() override final;
86
90 virtual void acceptStep() override final;
91
95 virtual void rejectStep() override final;
96
100 virtual bool converged() const override final;
101
102protected:
103 virtual Real computeDT() override final;
104 virtual Real computeInitialDT() override final;
105
106private:
107 template <typename Lambda>
108 void actOnTimeSteppers(Lambda && act);
109
113 std::vector<TimeStepper *> getTimeSteppers();
114
115 // The time step size computed by the Composition TimeStepper
116 Real _dt;
117
118 // Whether or not has an initial time step size
119 const bool _has_initial_dt;
120
121 // The initial time step size
122 const Real _initial_dt;
123
124 // The time stepper(s) input as lower bound of the time stepper size
125 const std::set<std::string> _lower_bound;
126
127 // The time stepper selected for use every time step, based on minimum time step size
129
130 // The time stepper selected every time step as providing the lower bound
132
133 // The time sequence stepper selected every time step as the one with the closest time to hit
135};
A TimeStepper that takes time steppers as inputs and computes the minimum time step size among all ti...
virtual void preStep() override final
virtual void preExecute() override final
virtual void postSolve() override final
virtual bool constrainStep(Real &dt) override final
Called after computeStep() is called.
virtual void step() override final
Functions called after the current DT is computed.
virtual void preSolve() override final
const bool _has_initial_dt
const std::set< std::string > _lower_bound
virtual void postExecute() override final
Real getSequenceSteppersNextTime()
TimeStepper * _current_time_stepper
Real produceCompositionDT(std::set< std::pair< Real, TimeStepper * >, CompareFirst > &dts, std::set< std::pair< Real, TimeStepper * >, CompareFirst > &bound_dts)
Find the composed time step size by selecting the minimum value and compare it with the lower bound i...
static InputParameters validParams()
virtual void postStep() override final
TimeSequenceStepperBase * _closest_time_sequence_stepper
std::vector< TimeStepper * > getTimeSteppers()
Internal method for querying TheWarehouse for the currently active timesteppers.
const Real _initial_dt
TimeStepper * _largest_bound_time_stepper
virtual bool converged() const override final
The _current_time_stepper is used to check whether convergence was reached on the time step.
virtual void rejectStep() override final
This gets called when time step is rejected for all input time steppers.
virtual void acceptStep() override final
This gets called when time step is accepted for all input time steppers.
virtual void init() override final
Initialize all the input time stepper(s).
virtual Real computeDT() override final
Computes time step size after the initial time step.
virtual Real computeInitialDT() override final
Computes time step size for the initial time step.
void actOnTimeSteppers(Lambda &&act)
static InputParameters compositionDTParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Solves the PDEs at a sequence of given time points.
Base class for time stepping.
Definition TimeStepper.h:23
Comparator for sorting by the value of dt for the TimeStepper sets which stored the pairs of the dt a...
bool operator()(const std::pair< Real, TimeStepper * > &a, const std::pair< Real, TimeStepper * > &b) const