CLASS  5.1
Fuel Cycle Simulator
DynamicalSystem Class Reference

DynamicalSystem class solves system of differential equations. More...

#include <DynamicalSystem.hxx>

Inheritance diagram for DynamicalSystem:
IM_RK4

Public Member Functions

 DynamicalSystem ()
 Normal Constructor. More...
 
 DynamicalSystem (const DynamicalSystem &DS)
 Copy Constructor. More...
 
virtual ~DynamicalSystem ()
 Destructor. More...
 
Mains attributes of the DynamicalSystem
int GetNumberOfEquationSize ()
 return the number of equations. More...
 
void SetNumberOfEquationSize (int n)
 set the number of equations. More...
 
Runge-Kutta related methods

Algorithms are taken from Numerical Receipes.

void SetPrecision (double eps=1e-5)
 set RK precision to change the integration step More...
 
void SetForbidNegativeValue ()
 Forbid negative value during integration. More...
 
void RungeKutta (double *YStart, double t1, double t2, int EquationNumber)
 Runge Kutta calling method. More...
 
virtual void BuildEqns (double t, double *Y, double *dYdt)
 Builds the equations for integration. More...
 

Protected Member Functions

void RK4 (double *y, double *dydx, double x, double h, double *yout)
 Runge Kutta main method. More...
 
void AdaptStepSize (double *y, double *dydx, double *x, double htry, double eps, double *yscal, double *hdid, double *hnext)
 Adaptative Step Size method for RK. More...
 

Protected Attributes

int fNVar
 The size of the composition vector and /or number of ZAIs involved. More...
 
double fPrecision
 Precision of the RungeKutta. More...
 
double fHestimate
 RK Step estimation. More...
 
double fHmin
 RK minimum Step. More...
 
double fMaxHdid
 store the effective RK max step More...
 
double fMinHdid
 store the effective RK min step More...
 
bool fIsNegativeValueAllowed
 whether or not negative value are physical. More...
 

Detailed Description

DynamicalSystem class solves system of differential equations.

A DynamicalSystem is a base class that solves system differential equations of 1st order.

\[ \frac{d\vec{Y}}{dt} = A\vec{Y}\]

The differential equations are built in DynamicalSystem::BuildEqns ; the method MUST be defined in the derived classes. In this first version only Runge-Kutta method is implemented, but the aim of this class is to provide also other methods such as CRAM (Chebyshev rational approximation method).

Author
PTO.
Version
1.0

Constructor & Destructor Documentation

◆ DynamicalSystem() [1/2]

DynamicalSystem::DynamicalSystem ( )

Normal Constructor.

◆ DynamicalSystem() [2/2]

DynamicalSystem::DynamicalSystem ( const DynamicalSystem DS)

Copy Constructor.

◆ ~DynamicalSystem()

DynamicalSystem::~DynamicalSystem ( )
virtual

Destructor.

Member Function Documentation

◆ AdaptStepSize()

void DynamicalSystem::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
yinitial values to integrate
dydxode's equations (variable is x)
xnew value of the variable after the adaptative step
htrytry step size for integration
epsprecision
yscalresult after hdid step integration
hdiddid step size for integration
hnextnext step size for integration

◆ BuildEqns()

virtual void DynamicalSystem::BuildEqns ( double  t,
double *  Y,
double *  dYdt 
)
inlinevirtual

Builds the equations for integration.

This method is an abstract method ; it MUST be overwritten by derived classes.

Parameters
ttime at which the equations are built
Yarray of variable at time t
dYdtode's variable.

Reimplemented in IM_RK4.

◆ GetNumberOfEquationSize()

int DynamicalSystem::GetNumberOfEquationSize ( )
inline

return the number of equations.

◆ RK4()

void DynamicalSystem::RK4 ( double *  y,
double *  dydx,
double  x,
double  h,
double *  yout 
)
protected

Runge Kutta main method.

Call by RungeKutta

Parameters
yinitial values to integrate
dydxode's equations (variable is x)
xvariable of integration
hstep size for integration
youtresult after integration

◆ RungeKutta()

void DynamicalSystem::RungeKutta ( double *  YStart,
double  t1,
double  t2,
int  EquationNumber 
)

Runge Kutta calling method.

Parameters
YStartinput : the initial condition Y(t1) ; output the final value Y(t2)
t1initial time
t2final time

◆ SetForbidNegativeValue()

void DynamicalSystem::SetForbidNegativeValue ( )
inline

Forbid negative value during integration.

For some quantities (such as nuclei composition), negative values are forbidden. But, due to integration step and very fast variation of the integrated variables Runge-Kutta wil produce very small negative value. This method is used to force negative value to be zero.

◆ SetNumberOfEquationSize()

void DynamicalSystem::SetNumberOfEquationSize ( int  n)
inline

set the number of equations.

◆ SetPrecision()

void DynamicalSystem::SetPrecision ( double  eps = 1e-5)
inline

set RK precision to change the integration step

Member Data Documentation

◆ fHestimate

double DynamicalSystem::fHestimate
protected

RK Step estimation.

◆ fHmin

double DynamicalSystem::fHmin
protected

RK minimum Step.

◆ fIsNegativeValueAllowed

bool DynamicalSystem::fIsNegativeValueAllowed
protected

whether or not negative value are physical.

◆ fMaxHdid

double DynamicalSystem::fMaxHdid
protected

store the effective RK max step

◆ fMinHdid

double DynamicalSystem::fMinHdid
protected

store the effective RK min step

◆ fNVar

int DynamicalSystem::fNVar
protected

The size of the composition vector and /or number of ZAIs involved.

◆ fPrecision

double DynamicalSystem::fPrecision
protected

Precision of the RungeKutta.


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