IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4 Class Reference

A fourth order Runge-Kutta ODE solver. More...

+ Inheritance diagram for IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4:
+ Collaboration diagram for IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4:

Public Member Functions

override void SolvingAlgorithm ()
 The specific ODE solving algorithm - in this case RK4. More...
 
- Public Member Functions inherited from IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase
void PrepareForSolving ()
 This method prepares the ODE solver for solving. It is called inside the Solve() method of this class. It checks whether the step size has been specified, etc. More...
 
void Solve ()
 The method that solves the ODE. It fills the solution list with values. The expected operations of every type of ODE solver are defined here (the solution list initialization, the calculation of the number of steps, ...) After these operations the specific ODE solver is called (e.g. RK4). Each child has to define its own specific ODE solver. More...
 
void CalculateErrors ()
 Estimates the solution errors by comparing a solution at the current step size with a solution at half the step size. More...
 
void PostProcessErrors (int pointsPerDomain)
 First calculates the absolutes of the errors, then tries to smoothen the errors curve. Useful when the curve is oscillating and you only need the envelope.

Parameters
pointsPerDomainThe number of selected equidistant points, if the curve was monotonic.
More...
 
void VerifyErrorsValidity (int checkNeighborhood)
 See: Richardson extrapolation. Calculates the solution at different step sizes. The step sizes differ one from another for an integer factor (usually 2). The method then calculates the errors for each of these solutions and saves their largest errors. The error differences are then sequentially divided between each other. These terms must converge to a constant related with the order of the solving method. More...
 
void PrintResults (TextWriter writer)
 Prints the solution to the specified text writer. More...
 
void PrintResults (string filePath)
 Prints the solution to the specified file. More...
 
void PrintResults ()
 Prints solution to the console. More...
 
void PrintResultsOld ()
 

Private Member Functions

void NextStep (int prevStep, int nextStep)
 Plug in the current variable values (x, f(x), f'(x), f''(x)), receive the next ones. More...
 

Private Attributes

double[][] _rk4OperatorArray
 The window array (next step values generator). It slides along the empty solution list and calculates new values from the old ones. More...
 
int _heightOperatorArray
 The height (second dimension length) of the window array. It is equal to the number of variables - 1 (minus the independent variable). Example format for a II. order ODE: f(x), f'(x), f''(x). More...
 
double[] _lowerDerivativesArray
 An array of all the variables, except the highest derivative, at the current step. This array is passed by the delegate to the method that calculates the highest derivative - the method that defines the ODE. More...
 

Additional Inherited Members

- Public Attributes inherited from IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase
double _stepSize
 
int _nSteps
 
List< double[]> _solutionODE
 
int _solutionSize
 The size of the auxiliary array (the inner array), which contains all the data at a single step: More...
 
InitialProblemSolverStates _state
 
- Protected Attributes inherited from IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase
double[] _initialConditions
 
double _endPoint
 
HighestDerivativeFunctionDelegate _highestDerivative
 
List< double[]> _originalSolution
 A storage for the solution that has been created at the last call of the Solve() method. This list is used by the CalculateErrors() method, because it overwrites the old _solutionODE list. More...
 
List< double[]> _errors
 The calculated errors get stored here after the CalculateErrors() method call. Actually only the _solutionODE list is re-referenced to this list's name. More...
 
int _errorEstimateCoefficient = 2
 The geometric series coefficient that tells us the divisor between two sequential step sizes. More...
 
- Properties inherited from IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase
double[] InitialConditions [get, set]
 Initial conditions: values of every derivative and the function itself at step zero. Format for a II. order ODE: [x, f, f', f'']. The array length is thus equal to the Order(ODE) + 2. More...
 
double EndPoint [get, set]
 The end value of the independent variable at which the ODE solver stops the solving process. More...
 
double StepSize [get, set]
 The ODE solver's step size. More...
 
int NSteps [get, set]
 The number of steps for which the solution is going to be calculated. More...
 
List< double[]> SolutionODE [get, protected set]
 The solution is a list of points. The list is filled with values after a Solve() method call. Example format for a II. order ODE: [ [x0,f(0),f'(0),f''(0)], [x(1),f(1),f'(1),f''(1)], [x(2),f(2),f'(2),f''(2)], ... ] More...
 
HighestDerivativeFunctionDelegate HighestDerivative [get, set]
 A delegate instance which binds the ODE solver with the appropriate ODE. Each model defines its own ODE. More...
 
InitialProblemSolverStates State [get, set]
 The state in which the ODE solver is currently in: which parameters are already specified, which method have been called. More...
 

Detailed Description

A fourth order Runge-Kutta ODE solver.

Member Function Documentation

override void IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4.SolvingAlgorithm ( )
inlinevirtual

The specific ODE solving algorithm - in this case RK4.

Implements IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase.

void IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4.NextStep ( int  prevStep,
int  nextStep 
)
inlineprivate

Plug in the current variable values (x, f(x), f'(x), f''(x)), receive the next ones.

Parameters
prevStepThe current step number.
nextStepThe next step number.

Member Data Documentation

double [][] IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4._rk4OperatorArray
private

The window array (next step values generator). It slides along the empty solution list and calculates new values from the old ones.

int IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4._heightOperatorArray
private

The height (second dimension length) of the window array. It is equal to the number of variables - 1 (minus the independent variable). Example format for a II. order ODE: f(x), f'(x), f''(x).

double [] IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4._lowerDerivativesArray
private

An array of all the variables, except the highest derivative, at the current step. This array is passed by the delegate to the method that calculates the highest derivative - the method that defines the ODE.


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