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.PlottableModels.Oscillators.DrivenOscillatorBase Class Referenceabstract

A template class for the driven oscillators. Holds the values for: angular driving frequency, driving period, steady-state amplitude. Contains the following methods: FindSteadyStateAmplitude(), PlaceOfExtremeInPeriod(), PinpointExtreme(), PlaceOfExtremeInMiniSolver(), CalcSteadyStateAmplitudeVsDrivingFrequency(). More...

+ Inheritance diagram for IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase:
+ Collaboration diagram for IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase:

Public Member Functions

PlotZedgraphCurve X_vs_T (PlotterZedGraph plotter)
 Position vs. time. More...
 
PlotZedgraphCurve V_vs_T (PlotterZedGraph plotter)
 Velocity vs. time. More...
 
PlotZedgraphCurve A_vs_T (PlotterZedGraph plotter)
 Acceleration vs. time. More...
 
PlotZedgraphCurve V_vs_X (PlotterZedGraph plotter)
 Velocity vs. position. More...
 
PlotZedgraphCurve ResonanceCurve (PlotterZedGraph plotter)
 Position vs. time. More...
 
abstract double DrivingFunction (double t)
 The driving function that each oscillator has to specify. More...
 
void FindSteadyStateAmplitude ()
 Finds the steady state amplitude. The step size needs to be specified before the method call. The initial conditions are unimportant when there is damping present, so they are simply taken to be: x(0)=0, v(0)=0. After calling this method the user should respecify the initial conditions for a new Solve() call. More...
 
void CalcSteadyStateAmplitudeVsDrivingFrequency ()
 Calculates the resonance curve. You have to specify the step size for the ODE solver, the starting driving angular frequency, the ending driving angular frequency and the number of sampling points (NSamplesForResonanceCurve). More...
 
- Public Member Functions inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase
abstract double ODE (double[] arg)
 The definition of an ODE, which desribes the physical system. It is effectievely a method, which returns the value of the highest derivative as a function of other variables. More...
 
void SolveNumerically ()
 Solves the ODE by calling Solve() on the ODE solver. More...
 
void CalculateErrors ()
 Estimates errors by comparing the solution at current step size to the solution at half of the current step size. More...
 
void PostProcessErrors (int forceTakeValue)
 Najprej izračuna absolutne vrednosti napak. Potem poskuša zgladiti krivuljo (uporabno če ta oscilira). More...
 
void VerifyErrorsValidity (int nPoints)
 Only exposes the same method on the ODE solver. More...
 
- Public Member Functions inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
PlotZedgraphCurve NewCurveFromPlottableData (PlotterZedGraph plotter, int x, int y)
 Creates a new PlotZedgraphCurve object from the available plottable data. More...
 
void LoadPlottableDataToCurve (PlotZedgraphCurve curve, int x, int y)
 Copies the calculated data to the existing PlotZedgraphCurve object. Enough space must be available on the curve object's list. More...
 

Public Attributes

const double DefaultGamma = 0.0
 

Protected Attributes

double _drivingPeriod
 
double _drivingAngularFrequency
 
double _gamma = DefaultGamma
 
double _steadyStateAmplitude
 
int _stepsInPeriod
 The number of steps in a period. The oscillating period is almost always the same as the driving period. More...
 
InitialProblemSolverRK4 _miniPinpointExtremeSolver
 Mini solver which finds the position of a maximum to a specified tolerance. Its solution list is typically small (length of ~5). It finds the local maximum using a bisection approach. More...
 
double _xExtremeTolerance = 0.000001
 
int _firstPeriodStart
 
int _secondPeriodStart
 This variable tells us the starting position of the first period in which we are searching for the local maximum. We are going to compare the maxima values in both periods. More...
 
double _initialSolvingDepth = 40.0
 
double[] _firstExtreme
 A maximum in the first period. A point in 2D. More...
 
double[] _secondExtreme
 A maximum in the second period. A point in 2D. More...
 
double _consecutivePeaksDifferenceTolerance = 0.000001
 
double _consecutivePeaksPositionTolerance = 0.01
 
int _extendSolutionFactor = 10
 
int _numOfSolutionExtendIterations = 0
 How many times the steady state amplitude searcher has failed to find the amplitude and the solution has been extended. More...
 
int _startingIterationsLimit = 50
 
int _iterationsLimit
 See: StartingIterationsLimit, which is just the default starting value for this variable. More...
 
int _iterationsLimitIncrement = 10
 
string _usersSolutionExtendDecision
 Used as an input field for the users decision, whether to continue the search or plot the solution. More...
 
double _originalStepSize
 The method FindSteadyStateAmplitude uses this variable. It adjusts the step size for its own purposes and then restores the original value after it is finished. More...
 
int _miniSolverSteps = 7
 
double _startingDrivingAngularFrequency
 
double _endingDrivingAngularFrequency
 
int _nSamplesForResonanceCurve
 
- Protected Attributes inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase
InitialProblemSolverRK4 _solver
 
double[] _initialConditions
 
- Protected Attributes inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
string _title
 

Properties

double DrivingPeriod [get]
 Driving period. It is needed for a simpler calculation of the steady state amplitude. More...
 
double DrivingAngularFrequency [get, set]
 The driving frequency of the harmonic driving force. More...
 
double Gamma [get, set]
 Driving phase. More...
 
double SteadyStateAmplitude [get]
 The steady state amplitude. It exists only when some damping is present in the system to bleed of the transient oscillations. More...
 
double XExtremeTolerance [get, set]
 The tolerance for finding local maxima of the mini solver. More...
 
double InitialSolvingDepth [get, set]
 Tells us for how many periods the ODE solution is calculated, before the mini solver kicks in to compare two neighbouring maxima and thus determine the steady state amplitude. More...
 
double ConsecutivePeaksDifferenceTolerance [get, set]
 The method, which calculates the steady state amplitude and compares the values of two neighbouring maxima, stops when the height difference is under this value and the peaks are one driving period apart. More...
 
double ConsecutivePeaksPositionTolerance [get, set]
 The tolerance for the condition that the peaks are one driving period apart. More...
 
int ExtendSolutionFactor [get, set]
 For how many periods the ODE solution is extended, if the steady state amplitude searcher method has not found one to the specified tolerance. More...
 
int StartingIterationsLimit [get, set]
 Determines after how many failed searches for the steady state amplitude and thus extensions of the ODE solution, the checks for convergence to a steady state will start. The users gets prompted whether to continue the search or plot the ODE solution, so that he can inspect for unusual behaviour. More...
 
int IterationsLimitIncrement [get, set]
 How many more times the ODE solution can get extended after the user has been prompted to check the convergence and he decided to just continue the search. More...
 
int MiniSolverSteps [get, set]
 The number of steps on the mini solver. The greater the number, the greater the accuracy wtih which the mini solver pinpoints the extreme in a single go. More...
 
double StartingDrivingAngularFrequency [get, set]
 The starting point of the resonance curve method. More...
 
double EndingDrivingAngularFrequency [get, set]
 The ending point of the resonance curve method. More...
 
int NSamplesForResonanceCurve [get, set]
 The number of samples for the resonance curve. More...
 
List< double[]> SteadyStateAmplitudeVsDrivingFrequency [get, set]
 This list gets full after the "CalcSteadyStateAmplitudeVsDrivingFrequency()" method call. More...
 
- Properties inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableODEModelBase
InitialProblemSolverRK4 Solver [get, set]
 An ODE solver object. More...
 
double[] InitialConditions [get, set]
 User definable initial conditions which are passed to the ODE solver object. You must provide the correct number of initial conditions. For a II. order ODE they should be specified as: {x, f(x), f'(x), f''(x)}. The value of the highest derivative is deduced automatically and is only provided by the user as a placeholder. It does not need to be correct (can be any number). More...
 
- Properties inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
string Title [get, set]
 The plottable model's name. Also used as a plot title. More...
 
List< double[]> PlottableData [get, set]
 The main solution array, which is used by the plotter. More...
 

Private Member Functions

int PlaceOfExtremeInPeriod (int periodStart)
 Finds the place of the extreme in the selected period, but returns its absolute position in the solution list. More...
 
double[] PinpointExtreme (int placeOfExtreme)
 Finds the extreme to the specified accuracy _xExtremeTolerance, using bisection. It operates with 5 points for greater reliability. More...
 
int PlaceOfExtremeInMiniSolver (ref InitialProblemSolverRK4 miniSolver)
 

Private Attributes

DrivenOscillatorBaseStates _dpStates
 
bool _placeOfExtremeInPeriodFailed = false
 Tells whether the "PlaceOfExtremeInPeriod" method has finished execution. More...
 
List< double[]> _steadyStateAmplitudeVsDrivingFrequency
 

Detailed Description

A template class for the driven oscillators. Holds the values for: angular driving frequency, driving period, steady-state amplitude. Contains the following methods: FindSteadyStateAmplitude(), PlaceOfExtremeInPeriod(), PinpointExtreme(), PlaceOfExtremeInMiniSolver(), CalcSteadyStateAmplitudeVsDrivingFrequency().

Member Function Documentation

PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.V_vs_T ( PlotterZedGraph  plotter)
inline

Velocity vs. time.

PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.A_vs_T ( PlotterZedGraph  plotter)
inline

Acceleration vs. time.

PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.V_vs_X ( PlotterZedGraph  plotter)
inline

Velocity vs. position.

PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.ResonanceCurve ( PlotterZedGraph  plotter)
inline

Position vs. time.

abstract double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.DrivingFunction ( double  t)
pure virtual
void IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.FindSteadyStateAmplitude ( )
inline

Finds the steady state amplitude. The step size needs to be specified before the method call. The initial conditions are unimportant when there is damping present, so they are simply taken to be: x(0)=0, v(0)=0. After calling this method the user should respecify the initial conditions for a new Solve() call.

References IG.MPetekLib.Algorithms.Solvers.InitialProblemODE_RK4.InitialProblemSolverBase.HighestDerivative, IG.Gr.PlotZedgraphCurve.LinesVisible, IG.MPetekLib.Algorithms.Plotting.PlotHQ.Plotter, IG.Gr.PlotZedgraphCurve.PointsVisible, IG.MPetekLib.Algorithms.Plotting.PlotHQ.ShowPlot(), IG.Gr.PlotterZedGraph.Title, and IG.MPetekLib.Algorithms.Plotting.PlotHQ.Window.

Referenced by IG.MPetekLib.Application.Scripts.NonlinearOscNondim._17SteadyStateAmplitude.Run(), and IG.MPetekLib.Application.Scripts.LinearOscillator._08SteadyStateAmplitude.Run().

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PlaceOfExtremeInPeriod ( int  periodStart)
inlineprivate

Finds the place of the extreme in the selected period, but returns its absolute position in the solution list.

Parameters
periodStartAt which place on the solution list does the selected period start.
Returns
The place of the extreme in the solution list.

References IG.Gr.PlotZedgraphCurve.LinesVisible, IG.MPetekLib.Algorithms.Plotting.PlotHQ.Plotter, IG.Gr.PlotZedgraphCurve.PointsVisible, IG.MPetekLib.Algorithms.Plotting.PlotHQ.ShowPlot(), IG.Gr.PlotterZedGraph.Title, and IG.MPetekLib.Algorithms.Plotting.PlotHQ.Window.

double [] IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PinpointExtreme ( int  placeOfExtreme)
inlineprivate
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.PlaceOfExtremeInMiniSolver ( ref InitialProblemSolverRK4  miniSolver)
inlineprivate

Member Data Documentation

DrivenOscillatorBaseStates IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._dpStates
private
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._drivingPeriod
protected
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._drivingAngularFrequency
protected
const double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.DefaultGamma = 0.0
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._gamma = DefaultGamma
protected
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._steadyStateAmplitude
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._stepsInPeriod
protected

The number of steps in a period. The oscillating period is almost always the same as the driving period.

InitialProblemSolverRK4 IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._miniPinpointExtremeSolver
protected

Mini solver which finds the position of a maximum to a specified tolerance. Its solution list is typically small (length of ~5). It finds the local maximum using a bisection approach.

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._xExtremeTolerance = 0.000001
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._firstPeriodStart
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._secondPeriodStart
protected

This variable tells us the starting position of the first period in which we are searching for the local maximum. We are going to compare the maxima values in both periods.

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._initialSolvingDepth = 40.0
protected
double [] IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._firstExtreme
protected

A maximum in the first period. A point in 2D.

double [] IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._secondExtreme
protected

A maximum in the second period. A point in 2D.

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._consecutivePeaksDifferenceTolerance = 0.000001
protected
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._consecutivePeaksPositionTolerance = 0.01
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._extendSolutionFactor = 10
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._numOfSolutionExtendIterations = 0
protected

How many times the steady state amplitude searcher has failed to find the amplitude and the solution has been extended.

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._startingIterationsLimit = 50
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._iterationsLimit
protected

See: StartingIterationsLimit, which is just the default starting value for this variable.

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._iterationsLimitIncrement = 10
protected
string IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._usersSolutionExtendDecision
protected

Used as an input field for the users decision, whether to continue the search or plot the solution.

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._originalStepSize
protected

The method FindSteadyStateAmplitude uses this variable. It adjusts the step size for its own purposes and then restores the original value after it is finished.

bool IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._placeOfExtremeInPeriodFailed = false
private

Tells whether the "PlaceOfExtremeInPeriod" method has finished execution.

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._miniSolverSteps = 7
protected
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._startingDrivingAngularFrequency
protected
double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._endingDrivingAngularFrequency
protected
int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._nSamplesForResonanceCurve
protected
List<double[]> IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase._steadyStateAmplitudeVsDrivingFrequency
private

Property Documentation

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.DrivingPeriod
get

Driving period. It is needed for a simpler calculation of the steady state amplitude.

Referenced by IG.Script._18ChaoticPlot.Run().

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.SteadyStateAmplitude
get

The steady state amplitude. It exists only when some damping is present in the system to bleed of the transient oscillations.

Referenced by IG.MPetekLib.Application.Scripts.NonlinearOscNondim._17SteadyStateAmplitude.Run(), and IG.MPetekLib.Application.Scripts.LinearOscillator._08SteadyStateAmplitude.Run().

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.XExtremeTolerance
getset

The tolerance for finding local maxima of the mini solver.

Referenced by IG.MPetekLib.Application.Scripts.NonlinearOscillator._19SingleResonancePlot.Run().

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.InitialSolvingDepth
getset

Tells us for how many periods the ODE solution is calculated, before the mini solver kicks in to compare two neighbouring maxima and thus determine the steady state amplitude.

Referenced by IG.MPetekLib.Application.Scripts.MagOscHardSpring._24MultiResCurvesPlotPhaseScan.Run().

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.ConsecutivePeaksDifferenceTolerance
getset

The method, which calculates the steady state amplitude and compares the values of two neighbouring maxima, stops when the height difference is under this value and the peaks are one driving period apart.

Referenced by IG.MPetekLib.Application.Scripts.NonlinearOscillator._19SingleResonancePlot.Run().

double IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.ConsecutivePeaksPositionTolerance
getset

The tolerance for the condition that the peaks are one driving period apart.

Referenced by IG.MPetekLib.Application.Scripts.NonlinearOscillator._19SingleResonancePlot.Run().

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.ExtendSolutionFactor
getset

For how many periods the ODE solution is extended, if the steady state amplitude searcher method has not found one to the specified tolerance.

Referenced by IG.MPetekLib.Application.Scripts.MagOscHardSpring._24MultiResCurvesPlotPhaseScan.Run().

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.StartingIterationsLimit
getset

Determines after how many failed searches for the steady state amplitude and thus extensions of the ODE solution, the checks for convergence to a steady state will start. The users gets prompted whether to continue the search or plot the ODE solution, so that he can inspect for unusual behaviour.

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.IterationsLimitIncrement
getset

How many more times the ODE solution can get extended after the user has been prompted to check the convergence and he decided to just continue the search.

int IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.MiniSolverSteps
getset

The number of steps on the mini solver. The greater the number, the greater the accuracy wtih which the mini solver pinpoints the extreme in a single go.

List<double[]> IG.MPetekLib.Algorithms.PlottableModels.Oscillators.DrivenOscillatorBase.SteadyStateAmplitudeVsDrivingFrequency
getsetprivate

This list gets full after the "CalcSteadyStateAmplitudeVsDrivingFrequency()" method call.


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