Flow123d
jenkins-Flow123d-linux-release-multijob-282
|
This class implements the analytic solution of a system of linear ODEs with constant matrix. More...
#include <linear_ode_analytic.hh>
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... | |
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 Attributes | |
static Input::Type::Record | input_type |
Static Public Attributes inherited from LinearODESolverBase | |
static Input::Type::AbstractRecord | input_type = AbstractRecord("LinearODESolver", "Solver of a linear system of ODEs.") |
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... | |
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 32 of file linear_ode_analytic.hh.
|
inline |
Default constructor is possible because the input record is not needed.
Definition at line 41 of file linear_ode_analytic.hh.
LinearODEAnalytic::LinearODEAnalytic | ( | Input::Record | in_rec | ) |
Constructor from the input data.
Definition at line 12 of file linear_ode_analytic.cc.
LinearODEAnalytic::~LinearODEAnalytic | ( | void | ) |
Destructor.
Definition at line 16 of file linear_ode_analytic.cc.
|
protected |
Computes the standard fundamental matrix.
Definition at line 31 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 20 of file linear_ode_analytic.cc.
|
static |
Input record for class LinearODE_analytic.
Definition at line 38 of file linear_ode_analytic.hh.
|
protected |
The solution is computed only by a matrix multiplication (standard fundamental matrix).
Definition at line 58 of file linear_ode_analytic.hh.