Template Numerical Library version\ main:eb202b8
Loading...
Searching...
No Matches
TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor > Class Template Reference

Base class for ODE solvers. More...

#include <TNL/Solvers/ODE/ExplicitSolver.h>

Inheritance diagram for TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >:
Collaboration diagram for TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >:

Public Types

using IndexType = Index
 Indexing type.
using RealType = Real
 Type of the floating-point arithmetics.
using SolverMonitorType = SolverMonitor
 Type of the monitor of the convergence of the solver.
Public Types inherited from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >
using SolverMonitorType
 Type of an object used for monitoring of the convergence.

Public Member Functions

 ExplicitSolver ()=default
 Default constructor.
bool checkConvergence () const override
 Checks whether the convergence occurred already.
bool checkNextIteration () const override
 Checks if the solver is allowed to do the next iteration.
const RealTypegetMaxTau () const
 Getter of maximal value of the time step.
bool getStopOnSteadyState () const
 Getter of stopOnSteadyState flag.
const RealTypegetStopTime () const
 Getter of the time where the evolution computation shall by stopped.
const RealTypegetTau () const
 Getter of the time step used for the computation.
const RealTypegetTime () const
 Getter of the current time of the evolution computed by the solver.
bool nextIteration () override
 Proceeds to the next iteration.
void refreshSolverMonitor (bool force=false)
 This method refreshes the solver monitor.
void setMaxTau (const RealType &maxTau)
 Setter of maximal value of the time step.
void setStopOnSteadyState (bool stopOnSteadyState)
 Set stopOnSteadyState flag.
void setStopTime (const RealType &stopTime)
 Setter of the time where the evolution computation shall by stopped.
void setTau (const RealType &tau)
 Setter of the time step used for the computation.
void setTestingMode (bool testingMode)
void setTime (const RealType &t)
 Setter of the current time of the evolution computed by the solver.
bool setup (const Config::ParameterContainer &parameters, const std::string &prefix="")
 Method for setup of the iterative solver based on configuration parameters.
Public Member Functions inherited from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >
 IterativeSolver ()=default
 Default constructor.
const double & getConvergenceResidue () const
 Gets the the convergence threshold.
const double & getDivergenceResidue () const
 Gets the limit for the divergence criterion.
const int & getIterations () const
 Gets the number of iterations performed by the solver so far.
const int & getMaxIterations () const
 Gets the maximal number of iterations the solver is allowed to perform.
const int & getMinIterations () const
 Gets the minimal number of iterations the solver is supposed to do.
const double & getResidue () const
 Gets the residue reached at the current iteration.
void resetIterations ()
 Sets the the number of the current iterations to zero.
void setConvergenceResidue (const double &convergenceResidue)
 Sets the threshold for the convergence.
void setDivergenceResidue (const double &divergenceResidue)
 Sets the residue limit for the divergence criterion.
void setMaxIterations (const int &maxIterations)
 Sets the maximal number of iterations the solver is allowed to perform.
void setMinIterations (const int &minIterations)
 Sets the minimal number of iterations the solver is supposed to do.
void setRefreshRate (const int &refreshRate)
 Sets the refresh rate (in milliseconds) for the solver monitor.
void setResidue (const double &residue)
 Sets the residue reached at the current iteration.
void setSolverMonitor (SolverMonitorType &solverMonitor)
 Sets the solver monitor object.
bool setup (const Config::ParameterContainer &parameters, const std::string &prefix="")
 Method for setup of the iterative solver based on configuration parameters.

Static Public Member Functions

static void configSetup (Config::ConfigDescription &config, const std::string &prefix="")
 This method defines configuration entries for setup of the iterative solver.
Static Public Member Functions inherited from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >
static void configSetup (Config::ConfigDescription &config, const std::string &prefix="")
 This method defines configuration entries for setup of the iterative solver.

Protected Attributes

RealType maxTau = std::numeric_limits< RealType >::max()
bool stopOnSteadyState = false
RealType stopTime = 0.0
RealType tau = 0.0
bool testingMode = false
RealType time = 0.0
Protected Attributes inherited from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >
double convergenceResidue
int currentIteration
double currentResidue
double divergenceResidue
int maxIterations
int minIterations
int refreshRate
std::ofstream residualHistoryFile
std::string residualHistoryFileName
IterativeSolverMonitor< double > * solverMonitor

Detailed Description

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
class TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >

Base class for ODE solvers.

Template Parameters
Realis type of the floating-point arithmetics.
Indexis type for indexing.
IterativeSolverMonitor<Real, Index > is

Member Function Documentation

◆ checkConvergence()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
bool TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::checkConvergence ( ) const
nodiscardoverridevirtual

Checks whether the convergence occurred already.

If the convergence did not occur yet, a message is printed to the stderr output.

Returns
true if the convergence already occurred, and false otherwise.

Reimplemented from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >.

◆ checkNextIteration()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
bool TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::checkNextIteration ( ) const
nodiscardoverridevirtual

Checks if the solver is allowed to do the next iteration.

Returns
true if the solver is allowed to do the next iteration, and false otherwise. This may happen because the divergence occurred.

Reimplemented from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >.

◆ configSetup()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
void TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::configSetup ( Config::ConfigDescription & config,
const std::string & prefix = "" )
static

This method defines configuration entries for setup of the iterative solver.

Parameters
configis the config description.
prefixis the prefix of the configuration parameters for this solver.

◆ nextIteration()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
bool TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::nextIteration ( )
overridevirtual

Proceeds to the next iteration.

Returns
true if the solver is allowed to do the next iteration, and false otherwise. This may happen because the divergence occurred.

Reimplemented from TNL::Solvers::IterativeSolver< double, int, IterativeSolverMonitor< double > >.

◆ refreshSolverMonitor()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
void TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::refreshSolverMonitor ( bool force = false)

This method refreshes the solver monitor.

The method propagates values of time, time step and others to the solver monitor.

◆ setMaxTau()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
void TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::setMaxTau ( const RealType & maxTau)

Setter of maximal value of the time step.

If methods uses adaptive choice of the time step, this sets the upper limit.

◆ setStopOnSteadyState()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
void TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::setStopOnSteadyState ( bool stopOnSteadyState)

Set stopOnSteadyState flag.

If the flag is on, the solver stops when steady-state solution is reached. Otherwise, the solver stops only when the stop time is reached or criteria defined in TNL::Solvers::IterativeSolver::checkConvergence() are met.

Parameters
stopOnSteadyStateis the new value of the flag.

◆ setTau()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
void TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::setTau ( const RealType & tau)

Setter of the time step used for the computation.

The time step can be changed by methods using adaptive choice of the time step.

◆ setup()

template<typename Real = double, typename Index = int, typename SolverMonitor = IterativeSolverMonitor< Real >>
bool TNL::Solvers::ODE::ExplicitSolver< Real, Index, SolverMonitor >::setup ( const Config::ParameterContainer & parameters,
const std::string & prefix = "" )

Method for setup of the iterative solver based on configuration parameters.

Parameters
parametersis the container for configuration parameters.
prefixis the prefix of the configuration parameters for this solver.
Returns
true if the parameters where parsed successfully.
false if the method did not succeed to read the configuration parameters.

The documentation for this class was generated from the following file: