Flow123d
release_2.2.0-20-gb8056ca
|
This class implements the analytic solution of a system of linear ODEs with constant matrix. More...
#include <linear_ode_analytic.hh>
Public Types | |
typedef LinearODESolverBase | FactoryBaseType |
Public Member Functions | |
LinearODEAnalytic () | |
Default constructor is possible because the input record is not needed. More... | |
LinearODEAnalytic (Input::Record in_rec) | |
Constructor from the input data. More... | |
~LinearODEAnalytic (void) | |
Destructor. More... | |
void | update_solution (arma::vec &init_vector, arma::vec &output_vec) override |
Updates solution of the ODEs system. More... | |
bool | evaluate_time_constraint (double &time_constraint) override |
Estimate upper bound for time step. Return true if constraint was set. More... | |
Public Member Functions inherited from LinearODESolver< LinearODEAnalytic > | |
LinearODESolver () | |
virtual | ~LinearODESolver () |
virtual void | update_solution (arma::mat &init_vecs, arma::mat &output_vecs, const std::vector< unsigned int > &mask=std::vector< unsigned int >(0)) override |
Updates solution of the system with different initial vectors. More... | |
Public Member Functions inherited from LinearODESolverBase | |
LinearODESolverBase () | |
virtual | ~LinearODESolverBase () |
void | set_system_matrix (const arma::mat &matrix) |
Sets the matrix of ODE system. More... | |
void | set_step (double step) |
Sets the step of the numerical method. More... | |
Static Public Member Functions | |
static const Input::Type::Record & | get_input_type () |
Static Public Member Functions inherited from LinearODESolverBase | |
static Input::Type::Abstract & | get_input_type () |
Protected Member Functions | |
void | compute_matrix () |
Protected Attributes | |
arma::mat | solution_matrix_ |
The solution is computed only by a matrix multiplication (standard fundamental matrix). More... | |
Protected Attributes inherited from LinearODESolverBase | |
arma::mat | system_matrix_ |
the square matrix of ODE system More... | |
arma::vec | rhs_ |
the column vector of RHS values (not used currently) More... | |
double | step_ |
the step of the numerical method More... | |
bool | step_changed_ |
flag is true if the step has been changed More... | |
bool | system_matrix_changed_ |
Indicates that the system_matrix_ was recently updated. More... | |
Static Private Attributes | |
static const int | registrar |
Registrar of class to factory. More... | |
This class implements the analytic solution of a system of linear ODEs with constant matrix.
The analytic solution can be obtained in the special case due to a physical nature of the problem. The problem is then solved only by a matrix multiplication.
The assumption is made that the equations are independent. Each quantity is decreased (supposing negative diagonal) to . The decrement is then distributed among other quantities according to the given fraction.
In case of the decays and first order reactions the elements of the solution matrix are:
where is the branching ratio of -th reactant and is the fraction of molar masses.
The fractions are then obtained from the system matrix by dividing .
Drawback: These assumptions (equation independence) are adequate when very small time step is applied. This will lead to huge amount of evaluations of the exponential functions which can be expensive, so other numerical methods might be more appropriate. When the time step is large then the assumption is quite inadequate.
Definition at line 49 of file linear_ode_analytic.hh.
Definition at line 52 of file linear_ode_analytic.hh.
|
inline |
Default constructor is possible because the input record is not needed.
Definition at line 60 of file linear_ode_analytic.hh.
LinearODEAnalytic::LinearODEAnalytic | ( | Input::Record | in_rec | ) |
Constructor from the input data.
Definition at line 38 of file linear_ode_analytic.cc.
LinearODEAnalytic::~LinearODEAnalytic | ( | void | ) |
Destructor.
Definition at line 42 of file linear_ode_analytic.cc.
|
protected |
Computes the standard fundamental matrix.
Definition at line 57 of file linear_ode_analytic.cc.
|
overridevirtual |
Estimate upper bound for time step. Return true if constraint was set.
Implements LinearODESolverBase.
Definition at line 80 of file linear_ode_analytic.cc.
|
static |
Input record for class LinearODE_analytic.
Definition at line 28 of file linear_ode_analytic.cc.
|
overridevirtual |
Updates solution of the ODEs system.
init_vec | is the column initial vector |
output_vec | is the column output vector containing the result |
Implements LinearODESolverBase.
Definition at line 46 of file linear_ode_analytic.cc.
|
staticprivate |
Registrar of class to factory.
Definition at line 83 of file linear_ode_analytic.hh.
|
protected |
The solution is computed only by a matrix multiplication (standard fundamental matrix).
Definition at line 79 of file linear_ode_analytic.hh.