IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Defines a system of first order ordinary diferential equations with initial conditions for dumped harmonic oscillation of a mass on a spring. More...
Public Member Functions | |
DifferentialHarmonicOscillation () | |
Construct a system of equations for undamped hasmonic oscillation with mass equal to 1 and frequency equal to 1. More... | |
DifferentialHarmonicOscillation (double mass, double frequency, double dampingRatio) | |
Construct a system of equations for damped harmonic oscillation with specified mass, frequency, and damping ratio. More... | |
double | GetAcceleration (double time, double position, double velocity) |
override void | InitializeAndReset () |
Initializes and resets the state of the current problem definition. More... | |
override void | CalculateFunctionDerivatives (double t, double[] y, double[] derivative) |
Calculates derivatives of searched functions from the current time and form current More... | |
override void | GetInitialFunctionValues (double[] initialValues) |
Stores initial values of unknown functions (position and velocity) to the specified array. More... | |
override double | GetInitialParameter () |
Returns the initial value of time (independent variable). More... | |
override double | GetFinalParameter () |
Returns the final value of time (independent variable). More... | |
override void | SetNextStep (double parameter, double[] functionValues) |
Sets parameters and function values for the next step. More... | |
override void | SaveState (double[] state) |
Saves state to the specified array. More... | |
override void | RestoreState (double[] state) |
Restores state from the specified array. More... | |
override string | ToString () |
Returns string representation of the current system. More... | |
![]() | |
DifferentialFirstOrderSystemBase () | |
Construct a system of first order ordinary differential equations, without specifying the number of equations. More... | |
DifferentialFirstOrderSystemBase (int numEquations) | |
Constructs a new definition of a system of numEquations first order ordinary differential equations. More... | |
Protected Member Functions | |
virtual void | UpdateDependencies () |
Updates dependent parameters in in accordance with values of independent parameters. More... | |
Protected Attributes | |
double | _m = 1 |
double | _k = 1 |
double | _kappa = 0 |
double | _kSqr = 0 |
double | _initialPosition = 1 |
double | _initialVelocity = 0 |
double | _initialTime = 0 |
double | _finalTime |
double | _time |
double | _position |
double | _velocity |
double | _T0 |
double | _omega0 |
double | _zeta |
![]() | |
int | _numEquations |
int | _numStateVariables |
bool | _isHistoryDependent = false |
Properties | |
override int | NumEquations [get, protected set] |
Number of differential equations in the system fo equations that govern the system. More... | |
double | Mass [get, set] |
Mass of the weight attached to a spring. More... | |
double | SpringCoefficient [get, set] |
Spring coefficient. More... | |
double | LinearDampingCoefficient [get, set] |
Linear damping coefficient. More... | |
double | QuadraticDampingCoefficient [get, set] |
Quadratic damping coefficient. More... | |
double | InitialPosition [get, set] |
Initial position. More... | |
double | InitialVelocity [get, set] |
Initial velocity. More... | |
double | InitialTime [get, set] |
Initial time. More... | |
double | FinalTime [get, set] |
The final time. More... | |
double | Time [get, set] |
Current time. More... | |
double | Position [get, set] |
Current position. More... | |
double | Velocity [get, set] |
Current velocity. More... | |
virtual double | UndampedFrequency [get, set] |
Undamped frequency of oscillation. More... | |
virtual double | UndampedPeriod [get, set] |
Undamped period of oscillation. More... | |
virtual double | UndampedAngularFrequency [get, set] |
Undamped angular frequency. More... | |
virtual double | DampingRatio [get, set] |
Damping ratio, a normalized linear damping parameter. Value of 1 means critical damping. Above this value the system approaches the equilibrium position without oscillation. More... | |
![]() | |
virtual int | NumEquations [get, protected set] |
Number of equations in the system of first order equations. More... | |
int | NumStateVariables [get, set] |
Number of state variables, including independent variable and function values. More... | |
bool | IsHistoryDependent [get, set] |
Flag indicating whether the problem is history dependent (meaning that it has additional state variables that are not calculated by the solver). More... | |
Private Attributes | |
double | _nu0 |
Defines a system of first order ordinary diferential equations with initial conditions for dumped harmonic oscillation of a mass on a spring.
Dhis system of 2 1st order differential equatiosn describes oscillation of a specified point mass attached to the end of a fixed linear spring with specified spring coefficient, and possible with linear and/or quadratic damping.
Independent parameters are mass, spring coefficients, amplitude, and eventually linear and quadratic damping coefficients. However, dependent parameters (such as undamped frequency) can also be set, in which case independent parameters are adapted appropriately.
See also remarks on saving the state for the DifferentialFirstOrderSolverBase and DifferentialFirstOrderSystemBase classes.
$A Igor Mar2009;
|
inline |
Construct a system of equations for undamped hasmonic oscillation with mass equal to 1 and frequency equal to 1.
|
inline |
Construct a system of equations for damped harmonic oscillation with specified mass, frequency, and damping ratio.
mass | Mass of the oscillator. |
frequency | Oscillator frequency (spring coefficien is adapted to this). |
dampingRatio | Damping ratio (1 - critical damping, beyond this there are no oscillations) - defines linear damping coefficient. |
|
inlineprotectedvirtual |
Updates dependent parameters in in accordance with values of independent parameters.
|
inline |
|
inlinevirtual |
Initializes and resets the state of the current problem definition.
All variables are set to initial values.
Any history dependent state variables are reset to the initial state.
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Calculates derivatives of searched functions from the current time and form current
t | Time (independent variable) ad which derivatives are calculated. |
y | Function values (positio and velocity) at the specified time. |
derivative | Array where calculated derivatives of unknown functions (of position and velocity) are stored. |
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Stores initial values of unknown functions (position and velocity) to the specified array.
initialValues | Array where initial funtion values are stored. |
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Returns the initial value of time (independent variable).
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Returns the final value of time (independent variable).
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Sets parameters and function values for the next step.
Additional state variables (e.g. history variables) are updated if applicable.
parameter | Parameter values in the next step. |
functionValues | Function values in the next step. |
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Saves state to the specified array.
state | Array where state variables are stored. |
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inlinevirtual |
Restores state from the specified array.
state | Array from which state variables are reatored. |
Implements IG.Num.DifferentialFirstOrderSystemBase.
|
inline |
Returns string representation of the current system.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
getprotected set |
Number of differential equations in the system fo equations that govern the system.
|
getset |
Mass of the weight attached to a spring.
|
getset |
Spring coefficient.
|
getset |
Linear damping coefficient.
|
getset |
Quadratic damping coefficient.
|
getset |
Initial position.
|
getset |
Initial velocity.
|
getset |
Initial time.
|
getset |
The final time.
|
getset |
Current time.
|
getset |
Current position.
|
getset |
Current velocity.
|
getset |
Undamped frequency of oscillation.
|
getset |
Undamped period of oscillation.
|
getset |
Undamped angular frequency.
|
getset |
Damping ratio, a normalized linear damping parameter. Value of 1 means critical damping. Above this value the system approaches the equilibrium position without oscillation.