1#ifndef DUNE_FEM_TIMEPROVIDER_HH
2#define DUNE_FEM_TIMEPROVIDER_HH
41 :
time_( parameter.getValue(
"fem.timeprovider.starttime",
42 static_cast<double>(0.0) ) ),
70 std::tuple<const double&,const int&,const double&,const bool&,const double&>
77 std::tuple<double&,int&,double&,bool&,double&>
94 inline double time ()
const
191 dtEstimate_ = std::numeric_limits< double >::max();
215 template<
class CollectiveCommunication =
typename MPIManager::CollectiveCommunication >
256 :
BaseType( parameter.getValue< double>(
"fem.timeprovider.starttime", 0.0 ), parameter ),
comm_(
MPIManager::comm() )
258 dt_ = parameter.getValidValue<
double >(
"fem.timeprovider.fixedtimestep", [] (
double v ) {
return v > 0.0;} );
264 :
BaseType( parameter.getValue< double>(
"fem.timeprovider.starttime", 0.0 ), parameter ),
comm_( comm )
266 dt_ = parameter.getValidValue<
double >(
"fem.timeprovider.fixedtimestep", [] (
double v ) {
return v > 0.0;} );
280 DUNE_THROW( InvalidStateException,
"Invalid Time Step in FixedStepTimeProvider" );
402 template<
class CollectiveCommunication =
typename MPIManager::CollectiveCommunication >
419 [] (
double val ) {
return val > 0.0; } );
425 [] (
int step ) {
return step > 0; } );
606 template<
class Gr
id >
608 :
public TimeProvider< typename Grid::Traits::CollectiveCommunication >
627 :
BaseType( startTime, grid.comm() ),
635 :
BaseType( startTime, cfl, grid.comm() ),
660 BaseType :: initTimeStep( dtEstimate );
int sequence() const
return number of sequence, if dofmanagers memory was changed by calling some method like resize,...
Definition: dofmanager.hh:978
double min(const Dune::Fem::Double &v, const double p)
Definition: double.hh:953
Definition: bindguard.hh:11
static void backupValue(const std::string &token, const T &value)
Definition: persistencemanager.hh:395
static void restoreValue(const std::string &token, T &value)
Definition: persistencemanager.hh:401
base class for auto persistent objects
Definition: persistencemanager.hh:580
static ParameterContainer & container()
Definition: io/parameter.hh:193
T getValidValue(const std::string &key, const Validator &validator) const
get optional parameter
Definition: reader.hh:197
Definition: mpimanager.hh:337
static const CollectiveCommunication & comm()
Definition: mpimanager.hh:393
general base for time providers
Definition: timeprovider.hh:36
double timeStepEstimate() const
obtain current estimate on time step
Definition: timeprovider.hh:133
TimeProviderBase(const ParameterReader ¶meter=Parameter::container())
Definition: timeprovider.hh:40
TimeProviderBase(const double startTime, const ParameterReader ¶meter=Parameter::container())
Definition: timeprovider.hh:53
bool dtEstimateValid_
Definition: timeprovider.hh:175
bool valid_
Definition: timeprovider.hh:174
void restore()
restore persistent object
Definition: timeprovider.hh:75
virtual ~TimeProviderBase()
Definition: timeprovider.hh:65
TimeProviderBase(const ThisType &)=delete
double invdt_
Definition: timeprovider.hh:173
ThisType & operator=(const ThisType &)=delete
double dtUpperBound_
Definition: timeprovider.hh:177
void advance()
Definition: timeprovider.hh:180
double time() const
obtain the current time
Definition: timeprovider.hh:94
double dtEstimate_
Definition: timeprovider.hh:176
int timeStep() const
obtain number of the current time step
Definition: timeprovider.hh:103
int timeStep_
Definition: timeprovider.hh:171
void provideTimeStepEstimate(const double dtEstimate)
set time step estimate to minimum of given value and internal time step estiamte
Definition: timeprovider.hh:142
void initTimeStepEstimate()
Definition: timeprovider.hh:189
bool timeStepValid() const
return if this time step should be used
Definition: timeprovider.hh:164
double deltaT() const
obtain the size of the current time step
Definition: timeprovider.hh:113
void provideTimeStepUpperBound(const double upperBound)
set upper bound for time step to minimum of given value and internal bound
Definition: timeprovider.hh:151
double inverseDeltaT() const
obtain the size of the inverse of the current time step
Definition: timeprovider.hh:123
void backup() const
backup persistent object
Definition: timeprovider.hh:68
double time_
Definition: timeprovider.hh:170
void invalidateTimeStep()
count current time step a not valid
Definition: timeprovider.hh:158
double dt_
Definition: timeprovider.hh:172
ParameterReader parameter_
Definition: timeprovider.hh:178
Definition: timeprovider.hh:218
FixedStepTimeProvider(const ParameterReader ¶meter=Parameter::container())
constructor
Definition: timeprovider.hh:255
ThisType & operator=(const ThisType &)=delete
CollectiveCommunication CollectiveCommunicationType
Definition: timeprovider.hh:223
FixedStepTimeProvider(ThisType &&)=delete
bool valid_
Definition: timeprovider.hh:174
virtual ~FixedStepTimeProvider()
Definition: timeprovider.hh:269
FixedStepTimeProvider(const ThisType &)=delete
const CollectiveCommunicationType & comm_
Definition: timeprovider.hh:298
void advance()
Definition: timeprovider.hh:180
void next()
goto next time step
Definition: timeprovider.hh:277
void initTimeStep()
Definition: timeprovider.hh:292
FixedStepTimeProvider(const double startTime, const double timeStepSize, const CollectiveCommunicationType &comm, const ParameterReader ¶meter=Parameter::container())
constructor
Definition: timeprovider.hh:231
void initTimeStepEstimate()
Definition: timeprovider.hh:189
FixedStepTimeProvider(const double startTime, const double timeStepSize, const ParameterReader ¶meter=Parameter::container())
Definition: timeprovider.hh:240
FixedStepTimeProvider(const CollectiveCommunicationType &comm, const ParameterReader ¶meter=Parameter::container())
Definition: timeprovider.hh:262
double dt_
Definition: timeprovider.hh:172
manager for global simulation time of time-dependent solutions
Definition: timeprovider.hh:405
TimeProvider(const double startTime, const CollectiveCommunicationType &comm=MPIManager::comm())
constructor taking start time
Definition: timeprovider.hh:454
TimeProvider(const ThisType &)=delete
TimeProvider(const ParameterReader ¶meter=Parameter::container())
default constructor
Definition: timeprovider.hh:433
const int updateStep_
Definition: timeprovider.hh:593
bool valid_
Definition: timeprovider.hh:174
virtual void backup() const
backup persistent object
Definition: timeprovider.hh:572
TimeProvider(const CollectiveCommunicationType &comm, const ParameterReader ¶meter=Parameter::container())
Definition: timeprovider.hh:441
void initTimeStep(const double dtEstimate)
Definition: timeprovider.hh:541
double invdt_
Definition: timeprovider.hh:173
CollectiveCommunication CollectiveCommunicationType
Definition: timeprovider.hh:410
double dtUpperBound_
Definition: timeprovider.hh:177
void advance()
Definition: timeprovider.hh:180
void next(const double timeStep)
goto next time step
Definition: timeprovider.hh:523
void init(const double timeStep)
init dt with provided time step
Definition: timeprovider.hh:498
int getUpdateStep() const
Definition: timeprovider.hh:422
const CollectiveCommunicationType & comm_
Definition: timeprovider.hh:591
double dtEstimate_
Definition: timeprovider.hh:176
TimeProvider(const double startTime, const double cfl, const CollectiveCommunicationType &comm=MPIManager::comm())
constructor taking start time and CFL constant
Definition: timeprovider.hh:469
const double cfl_
Definition: timeprovider.hh:592
int timeStep_
Definition: timeprovider.hh:171
void initTimeStepEstimate()
Definition: timeprovider.hh:189
double factor() const
return the global factor number
Definition: timeprovider.hh:532
int counter_
Definition: timeprovider.hh:594
virtual void restore()
restore persistent object
Definition: timeprovider.hh:577
double getCflFactor() const
Definition: timeprovider.hh:416
void restore(const double time, const int timeStep)
restore time and timestep from outside (i.e. from former calculation)
Definition: timeprovider.hh:566
void next()
goto next time step
Definition: timeprovider.hh:508
ThisType & operator=(const ThisType &)=delete
virtual ~TimeProvider()
Definition: timeprovider.hh:479
void init()
init dt with time step estimate
Definition: timeprovider.hh:488
double dt_
Definition: timeprovider.hh:172
ParameterReader parameter_
Definition: timeprovider.hh:178
the same functionality as the Dune::TimeProvider.
Definition: timeprovider.hh:609
GridTimeProvider(const double startTime, const double cfl, const Grid &grid)
Definition: timeprovider.hh:632
GridTimeProvider(const Grid &grid)
Definition: timeprovider.hh:619
void initTimeStep(const double dtEstimate)
Definition: timeprovider.hh:648
virtual ~GridTimeProvider()
Definition: timeprovider.hh:640
Grid::Traits::CollectiveCommunication CollectiveCommunicationType
Definition: timeprovider.hh:617
int sequence_
Definition: timeprovider.hh:664
const DofManagerType & dm_
Definition: timeprovider.hh:663
GridTimeProvider(const double startTime, const Grid &grid)
Definition: timeprovider.hh:625
Definition: dofmanager.hh:761