Template Numerical Library version\ main:978fbd2
|
Public Types | |
using | DeviceType = typename Vector::DeviceType |
Device where the solver is supposed to be executed. | |
using | DofVectorType = TNL::Containers::Vector< RealType, DeviceType, IndexType > |
Alias for type of unknown variable \( \vec x \). | |
using | IndexType = typename Vector::IndexType |
Type for indexing. | |
using | RealType = GetValueType_t< Vector > |
Type of floating-point arithemtics. | |
using | SolverMonitorType = SolverMonitor |
Type of object used for monitoring the convergence. | |
using | ValueType = typename Vector::ValueType |
using | VectorType = Vector |
Type of unknown variable \( \vec x \). | |
Public Types inherited from TNL::Solvers::ODE::ExplicitSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
using | IndexType |
Indexing type. | |
using | RealType |
Type of the floating-point arithmetics. | |
using | SolverMonitorType |
Type of the monitor of the convergence of the solver. | |
Public Types inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
using | SolverMonitorType |
Type of an object used for monitoring of the convergence. | |
Public Member Functions | |
ODESolver () | |
Default constructor. | |
__cuda_callable__ RealType | getAdaptivity () const |
Getter of the parameter controlling the adaptive choice of the integration time step. | |
Method & | getMethod () |
Gives reference to the underlying method. | |
const Method & | getMethod () const |
Gives constant reference to the underlying method. | |
void | init (const VectorType &u) |
Setup auxiliary vectors of the solver. | |
template<typename RHSFunction , typename... Params> | |
void | iterate (VectorType &u, RealType &time, RealType &tau, RHSFunction &&f, Params &&... params) |
Performs one iteration of the solver. | |
void | reset () |
Resets the solver. | |
__cuda_callable__ void | setAdaptivity (const RealType &adaptivity) |
Setter of the parameter controlling the adaptive choice of the integration time step. | |
bool | setup (const Config::ParameterContainer ¶meters, const String &prefix="") |
Method for setup of the explicit solver based on configuration parameters. | |
template<typename RHSFunction , typename... Params> | |
bool | solve (VectorType &u, RHSFunction &&f, Params &&... params) |
Solve ODE given by a lambda function. | |
Public Member Functions inherited from TNL::Solvers::ODE::ExplicitSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
ExplicitSolver ()=default | |
Default constructor. | |
bool | checkNextIteration () |
Checks if the solver is allowed to do the next iteration. | |
const RealType & | getMaxTau () const |
Getter of maximal value of the time step. | |
const RealType & | getStopTime () const |
Getter of the time where the evolution computation shall by stopped. | |
const RealType & | getTau () const |
Getter of the time step used for the computation. | |
const RealType & | getTime () const |
Getter of the current time of the evolution computed by the solver. | |
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 | 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) |
Settter of the current time of the evolution computed by the solver. | |
bool | setup (const Config::ParameterContainer ¶meters, const std::string &prefix="") |
Method for setup of the iterative solver based on configuration parameters. | |
Public Member Functions inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
IterativeSolver ()=default | |
Default constructor. | |
bool | checkConvergence () |
Checks whether the convergence occurred already. | |
bool | checkNextIteration () |
Checks if the solver is allowed to do the next iteration. | |
const Vector::RealType & | getConvergenceResidue () const |
Gets the the convergence threshold. | |
const Vector::RealType & | getDivergenceResidue () const |
Gets the limit for the divergence criterion. | |
const Vector::IndexType & | getIterations () const |
Gets the number of iterations performed by the solver so far. | |
const Vector::IndexType & | getMaxIterations () const |
Gets the maximal number of iterations the solver is allowed to perform. | |
const Vector::IndexType & | getMinIterations () const |
Gets the minimal number of iterations the solver is supposed to do. | |
const Vector::RealType & | getResidue () const |
Gets the residue reached at the current iteration. | |
bool | nextIteration () |
Proceeds to the next iteration. | |
void | resetIterations () |
Sets the the number of the current iterations to zero. | |
void | setConvergenceResidue (const Vector::RealType &convergenceResidue) |
Sets the threshold for the convergence. | |
void | setDivergenceResidue (const Vector::RealType &divergenceResidue) |
Sets the residue limit for the divergence criterion. | |
void | setMaxIterations (const Vector::IndexType &maxIterations) |
Sets the maximal number of iterations the solver is allowed to perform. | |
void | setMinIterations (const Vector::IndexType &minIterations) |
Sets the minimal number of iterations the solver is supposed to do. | |
void | setRefreshRate (const Vector::IndexType &refreshRate) |
Sets the refresh rate (in milliseconds) for the solver monitor. | |
void | setResidue (const Vector::RealType &residue) |
Sets the residue reached at the current iteration. | |
void | setSolverMonitor (SolverMonitorType &solverMonitor) |
Sets the solver monitor object. | |
bool | setup (const Config::ParameterContainer ¶meters, 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 String &prefix="") |
Static method for setup of configuration parameters. | |
static constexpr bool | isStatic () |
Static Public Member Functions inherited from TNL::Solvers::ODE::ExplicitSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
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< Vector::RealType, Vector::IndexType, SolverMonitor > | |
static void | configSetup (Config::ConfigDescription &config, const std::string &prefix="") |
This method defines configuration entries for setup of the iterative solver. | |
Static Public Attributes | |
static constexpr int | Stages = Method::getStages() |
Protected Attributes | |
RealType | adaptivity = 0.00001 |
std::array< VectorType, Stages > | k_vectors |
VectorType | kAux |
Method | method |
Protected Attributes inherited from TNL::Solvers::ODE::ExplicitSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
RealType | maxTau |
bool | stopOnSteadyState |
RealType | stopTime |
RealType | tau |
bool | testingMode |
RealType | time |
Protected Attributes inherited from TNL::Solvers::IterativeSolver< Vector::RealType, Vector::IndexType, SolverMonitor > | |
Vector::RealType | convergenceResidue |
Vector::IndexType | currentIteration |
Vector::RealType | currentResidue |
Vector::RealType | divergenceResidue |
Vector::IndexType | maxIterations |
Vector::IndexType | minIterations |
Vector::IndexType | refreshRate |
std::ofstream | residualHistoryFile |
std::string | residualHistoryFileName |
SolverMonitor * | solverMonitor |
using TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::DofVectorType = TNL::Containers::Vector< RealType, DeviceType, IndexType > |
Alias for type of unknown variable \( \vec x \).
Note, VectorType can be TNL::Containers::VectorView but DofVectorType is always TNL::Containers::Vector.
using TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::SolverMonitorType = SolverMonitor |
Type of object used for monitoring the convergence.
|
static |
Static method for setup of configuration parameters.
config | is the config description. |
prefix | is the prefix of the configuration parameters for this solver. |
|
inline |
Getter of the parameter controlling the adaptive choice of the integration time step.
Method & TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::getMethod | ( | ) |
Gives reference to the underlying method.
const Method & TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::getMethod | ( | ) | const |
Gives constant reference to the underlying method.
void TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::init | ( | const VectorType & | u | ) |
Setup auxiliary vectors of the solver.
This method is supposed to be called before the first call of the method iterate. It is not necessary to call this method before the method solve is used. Also this methods neeeds to be called everytime the size of u changes.
u | is a variable/dynamic vector representing the solution of the ODE system at current time. |
void TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::iterate | ( | VectorType & | u, |
RealType & | time, | ||
RealType & | tau, | ||
RHSFunction && | f, | ||
Params &&... | params ) |
Performs one iteration of the solver.
This method can be used for hybrid solvers which combine various ODE solvers. Otherwise, use of solve is recommended. Before the first call of this method, the method init has to be called.
RHSFunction | is type of a lambda function representing the right-hand side of the ODE system. |
Params | are the parameters which are supposed to be passed to the lambda function f. |
u | is a variable/static vector representing the solution of the ODE system at current time. |
time | is the current time of the evolution. The variable is increased by tau. |
tau | is the current time step. It can be changed by the solver if the adaptive time step control is used. |
f | is the lambda function representing the right-hand side of the ODE system. The definition of the lambda function is the same as in the method solve. |
params | are the parameters which are supposed to be passed to the lambda function f. |
void TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::reset | ( | ) |
|
inline |
Setter of the parameter controlling the adaptive choice of the integration time step.
The smaller the parameter is the smaller the integration time step tends to be. Reasonable values for this parameters are approximately from interval \( [10^{-12},10^{-2}] \).
adaptivity | new value of the parameter controlling the adaptive choice of integration time step. |
bool TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::setup | ( | const Config::ParameterContainer & | parameters, |
const String & | prefix = "" ) |
Method for setup of the explicit solver based on configuration parameters.
parameters | is the container for configuration parameters. |
prefix | is the prefix of the configuration parameters for this solver. |
bool TNL::Solvers::ODE::ODESolver< Method, Vector, SolverMonitor, false >::solve | ( | VectorType & | u, |
RHSFunction && | f, | ||
Params &&... | params ) |
Solve ODE given by a lambda function.
RHSFunction | is type of a lambda function representing the right-hand side of the ODE system. The definition of the lambda function reads as: Vector VectorType Type of unknown variable . Definition ODESolver.h:276 t is the current time of the evolution, tau is the current time step, u is the solution at the current time, fu is variable/static vector into which the lambda function is suppsed to evaluate the function \( f(t, \vec x) \) at the current time \( t \). |
u | is a variable/static vector representing the solution of the ODE system at current time. |
f | is the lambda function representing the right-hand side of the ODE system. |
params | are the parameters which are supposed to be passed to the lambda function f. This is due to the fact that the CUDA compiler does not allow nested lambda functions: "An extended __host__ __device__ lambda cannot be defined inside an extended __host__ __device__ lambda expression". |
true
if steady state solution has been reached, false
otherwise.