RKSolver class solves system of differential equations by Runge-Kutta method.
More...
#include <RKSolver.hxx >
RKSolver ()
Normal constructor.
RKSolver (const RKSolver &BS)
Copy constructor.
~RKSolver () override
Destructor.
void Solve (double *N0, double **Matrix, int N, double t1, double t2) override
Solve Bateman equation using Runge-Kutta method.
Algorithms are taken from Numerical Receipes.
void RungeKutta (double *YStart, double t1, double t2)
Runge Kutta calling method.
void BuildEqns (double t, double *N, double *dNdt)
Builds the Bateman equations for integration.
void SetTheMatrix (double **f)
BatemanSolver ()
Normal constructor.
BatemanSolver (const BatemanSolver &BS)
Copy constructor.
virtual ~BatemanSolver ()
Destructor.
int GetNumberOfEquationSize ()
void SetNumberOfEquations (int N)
void SetPrecision (double eps=1e-5)
void SetForbidNegativeValue ()
Forbid negative value during integration.
void SetXe135EquilibriumIndex (int Te135, int I135, int Xe135)
Set index (position) in EvolvingSystem::fEvolvingAtoms vector for Te-135, I-135 and Xe-135.
double fHestimate
RK Step estimation.
double fHmin
RK minimum Step.
double fMaxHdid
store the effective RK max step
double fMinHdid
store the effective RK min step
void RK4 (double *y, double *dydx, double x, double h, double *yout)
Runge Kutta main method.
void AdaptStepSize (double *y, double *dydx, double *x, double htry, double eps, double *yscal, double *hdid, double *hnext)
Adaptative Step Size method for RK.
int fNVar
The size of the composition vector and /or number of ZAIs involved.
double fPrecision
Precision of the solution.
double fTmin
The lowest value of the decay constant considered.
bool fIsNegativeValueAllowed
int fIdxTe135
index of Te-135 in the fEvolvingAtoms array
int fIdxI135
index of I-135 in the fEvolvingAtoms array
int fIdxXe135
index of Xe-135 in the fEvolvingAtoms array
RKSolver class solves system of differential equations by Runge-Kutta method.
A RKSolver is a base class thatsolves system of 1st order of differential equations.
The differential equations are built in RKSolver::BuildEqns . The RK method is a 4 order adaptative step Runge-Kutta method. Algorithms are taken from Numerical Receipes.
Author PTO.
MBe.
Version 1.1
◆ RKSolver() [1/2]
◆ RKSolver() [2/2]
RKSolver::RKSolver
(
const RKSolver &
BS )
◆ ~RKSolver()
◆ AdaptStepSize()
void RKSolver::AdaptStepSize
(
double *
y ,
double *
dydx ,
double *
x ,
double
htry ,
double
eps ,
double *
yscal ,
double *
hdid ,
double *
hnext
)
protected
Adaptative Step Size method for RK.
Call by RK4
Parameters
y : initial values to integrate
dydx : ode's equations (variable is x)
x : new value of the variable after the adaptative step
htry : try step size for integration
eps : precision
yscal : result after hdid step integration
hdid : did step size for integration
hnext : next step size for integration
◆ BuildEqns()
void RKSolver::BuildEqns
(
double
t ,
double *
N ,
double *
dNdt
)
Builds the Bateman equations for integration.
\f[ \frac{d\vec{N}}{dt}=A\vec{N}\f]
Parameters
t : time at which the equations are built (needed by RK but useless here)
N : Nucleus Proportions a time t
dNdt : ode's for each element.
◆ RK4()
void RKSolver::RK4
(
double *
y ,
double *
dydx ,
double
x ,
double
h ,
double *
yout
)
protected
Runge Kutta main method.
Call by RungeKutta
Parameters
y : initial values to integrate
dydx : ode's equations (variable is x)
x : variable of integration
h : step size for integration
yout : result after integration
◆ RungeKutta()
void RKSolver::RungeKutta
(
double *
YStart ,
double
t1 ,
double
t2
)
Runge Kutta calling method.
Parameters
YStart : input : the initial condition Y(t1) ; output the final value Y(t2)
t1 : initial time
t2 : final time
◆ SetTheMatrix()
void RKSolver::SetTheMatrix
(
double **
f )
inline
◆ Solve()
void RKSolver::Solve
(
double *
N0 ,
double **
Matrix ,
int
N ,
double
t1 ,
double
t2
)
override virtual
Solve Bateman equation using Runge-Kutta method.
For a given vector
of initial composition and a given matrix NxN, integrate Bateman equation from t1 to t2.
Parameters
N0 : initial composition vector
Matrix : matrix of Bateman eqs
N : initial composition vector
t1 : initial time
t2 : final time
Implements BatemanSolver .
◆ fHestimate
double RKSolver::fHestimate
protected
◆ fHmin
◆ fMaxHdid
double RKSolver::fMaxHdid
protected
store the effective RK max step
◆ fMinHdid
double RKSolver::fMinHdid
protected
store the effective RK min step
◆ fTheMatrix
double** RKSolver::fTheMatrix
private
The documentation for this class was generated from the following files: