IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
A template ODE solver without an actual implementation of the solving method (e.g. RK4). More...
Public Member Functions | |||
abstract void | SolvingAlgorithm () | ||
The specific ODE solving method, which every child class implements on its own. It is used inside the Solve() method of this class. More... | |||
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.
| |||
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 () | ||
Public Attributes | |
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 | |
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 | |
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... | |
A template ODE solver without an actual implementation of the solving method (e.g. RK4).
|
pure virtual |
The specific ODE solving method, which every child class implements on its own. It is used inside the Solve() method of this class.
Implemented in IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverRK4.
|
inline |
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.
|
inline |
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.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme(), IG.MPetekLib.Application.Scripts.LinearOscillator._01NondrivenPrintSolution.ReturnSolver(), and IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.SolveNumerically().
|
inline |
Estimates the solution errors by comparing a solution at the current step size with a solution at half the step size.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.CalculateErrors().
|
inline |
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.
pointsPerDomain | The number of selected equidistant points, if the curve was monotonic. |
Referenced by IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.PostProcessErrors().
|
inline |
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.
checkNeighborhood | How many times the step size should be reduced. |
Referenced by IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.VerifyErrorsValidity().
|
inline |
Prints the solution to the specified text writer.
writer |
|
inline |
Prints the solution to the specified file.
If the file exists then it is overwritten.
inputFilePath | Path of the file where solution is written. |
|
inline |
Prints solution to the console.
|
inline |
|
protected |
|
protected |
double IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase._stepSize |
int IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase._nSteps |
List<double[]> IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase._solutionODE |
Referenced by IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.CalculateErrors(), IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme(), IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.PostProcessErrors(), IG.MPetekLib.Application.Scripts.LinearOscillator._11MultipleResCurvesPlot3D.ResonanceCurveHarmonicFamily3dWithManualScaling(), IG.MPetekLib.Application.Scripts.LinearOscillator._11MultipleResCurvesPlot3D.Run(), IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.SolveNumerically(), and IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase.VerifyErrorsValidity().
int IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase._solutionSize |
The size of the auxiliary array (the inner array), which contains all the data at a single step:
[x0,f(0),f'(0),f''(0)] —> Its size is equal to: Order(ODE) + 2.
|
protected |
|
protected |
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.
|
protected |
The calculated errors get stored here after the CalculateErrors() method call. Actually only the _solutionODE list is re-referenced to this list's name.
|
protected |
The geometric series coefficient that tells us the divisor between two sequential step sizes.
InitialProblemSolverStates IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase._state |
|
getset |
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.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme(), and IG.MPetekLib.Application.Scripts.LinearOscillator._01NondrivenPrintSolution.ReturnSolver().
|
getset |
The end value of the independent variable at which the ODE solver stops the solving process.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme(), IG.MPetekLib.Application.Scripts.LinearOscillator._01NondrivenPrintSolution.ReturnSolver(), IG.MPetekLib.Application.Scripts.NonlinearOscNondim._17SteadyStateAmplitude.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscNondim._16SolutionPlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscillator._15SolutionPlot.Run(), IG.Script._18ChaoticPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._08SteadyStateAmplitude.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._13SolutionAndDrivingFunctionPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._05AnalytAndNumSolutionPlot.Run(), and IG.MPetekLib.Application.Scripts.LinearOscillator._02DrivenPlotSolution.Run().
|
getset |
The ODE solver's step size.
Referenced by IG.MPetekLib.Application.Scripts.LinearOscillator._11MultipleResCurvesPlot3D.ResonanceCurveHarmonicFamily3dWithManualScaling(), IG.MPetekLib.Application.Scripts.LinearOscillator._01NondrivenPrintSolution.ReturnSolver(), IG.MPetekLib.Application.Scripts.NonlinearOscNondim._17SteadyStateAmplitude.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscNondim._16SolutionPlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscillator._15SolutionPlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscillator._19SingleResonancePlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscillator._22SingleResCurveManyPhases.Run(), IG.MPetekLib.Application.Scripts.MagOscHardSpring._23SingleResCurveManyPhases.Run(), IG.Script._18ChaoticPlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscillator._21MultipleResCurvesPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._08SteadyStateAmplitude.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._12MultipleResCurvesPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._13SolutionAndDrivingFunctionPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._09SingleResonanceCurvePlot.Run(), IG.MPetekLib.Application.Scripts.NonlinearOscNondim._20MultipleResCurvesPlot.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._05AnalytAndNumSolutionPlot.Run(), IG.MPetekLib.Application.Scripts.MagOscHardSpring._24MultiResCurvesPlotPhaseScan.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._02DrivenPlotSolution.Run(), IG.MPetekLib.Application.Scripts.LinearOscillator._10MultipleResCurvesPlotObsolete.Run(), IG.Script.DemoResonanceCurvePlot.Run(), IG.Script.DemoResonanceCurvePlotExt.Run(), and IG.MPetekLib.Application.Scripts.LinearOscillator._11MultipleResCurvesPlot3D.Run().
|
getset |
The number of steps for which the solution is going to be calculated.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme().
|
getprotected 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)], ... ]
After calling the error estimator methods this list can contain the calculated error values.
|
getset |
A delegate instance which binds the ODE solver with the appropriate ODE. Each model defines its own ODE.
Referenced by IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.FindSteadyStateAmplitude(), and IG.MPetekLib.Application.Scripts.LinearOscillator._01NondrivenPrintSolution.ReturnSolver().
|
getset |
The state in which the ODE solver is currently in: which parameters are already specified, which method have been called.