The included examples are intended to give
you a quick impression of this project. Open the file
"examples.cmd" in notepad (Right click > Edit). To try
different available examples, you will need to uncomment
lines one by one and then comment them back again. You can
explore the examples yourself or follow this guide
(recommended).
Example 1:
Manipulating the graph. Simply remove the capital C
at the start of the line that reads:
C 02DrivenPlotSolution
Save the file (ctrl + s) and run (double-click) the batch
file examples.bat. A linear oscillator solution plot is
shown. You can manipulate the plot in the following ways:
- Pan the curve by holding down the middle mouse
button (MMB),
- Zoom in and out by scrolling the MMB.
- Focus on specific areas by drawing a rectangle
around it. Just hold the LMB and drag. This is useful
for getting the entire curve to fill the graph pane
without any gaps.
- If you're zoomed in too much and don't want to
scroll all the way back, just press RMB for the
context menu to pop up and then choose "Set Scale to
Default".
Make sure to add back the capital C (recomment the
line) after you're done. The interpreter that reads the
file ignores the lines with capital C in the begining.
It also ignores empty lines, but be careful not to have
any blank spaces in the empty line. Such a line will
seem empty to you, but not to the interpreter - it will
cause errors.
Example 2: Showcasing interpreter
arguments. The command that gets passed to
the interpreter is the same as in example 1. This time
you can modify some additional parameters of the linear
oscillator:
- The square of its eigenfrequncy (w0^2),
- the damping coefficient (b),
- starting time (start),
- ending time (end),
- solving method step size (stepSize)
- whether individual calculated points are being
plotted (Pnts) or an interpolated line (Lns),
- point size or, in case of a line, line width (PntSize).
This example shows, that commands can also get passed
to the interpreter with optional arguments (where these
are implemented). As you have seen, the command 02DrivenPlotSolution
has seven optional arguments, when none are
specified the default values are used. The
implementation is usually "all or none": If you decide
to pass optional arguments, you must pass them all.
Example 3: A resonance curve
for the linear oscillator. The curve that gets
plotted is actually an analytical expression - the
resonance curve for the linear oscillator can be written
in a closed form. The blue dots on top are numerically
calculated points. This way the accuracy of the method,
that finds the steady-state amplitude of a single
solution, can be observed. Zoom in to a single suspicious
point and look for deviations (you shouldn't find any
since the accuracy of the numerical method is set to one
millionth of a unit). The optional parameter "samples"
governs the number of numerical points that get
calculated.
Example 4: Plotting multiple
resonance curves on the same graph. This example
does not allow any optional arguments. I haven't bothered
to add them. Those will be available in the later
examples, while plotting multiple curves for the nonlinear
oscillator. All of the curves on the graph are analytical.
Example 5: The nonlinear magnetic oscillator in the
chaotic regime. A solution in the chaotic regime
is plotted. No periodicity is visible. When you close
the graph, a second (phase space) graph is plotted.
Example 6: Nonlinear resonance curve and the
disappearance of steady-state amplitude. At high
driving amplitudes the slopes of the resonance curve of
the magnetic oscillator become almost straight.
Try the following: change the driving amplitude
parameter (M0/J) to 70 and run the app. The console will
report, that the amplitude of the oscillations does not
want to stabilise. If this ever happens to you, just
input any letter in the console and press 'enter'. A
plot of the solution as it appeared in the last
iteration will be presented.
As you can see, the plot looks periodic. Nothing is
wrong with the solution, it's just that the
IterationLimitIncrement was set too low and the
amplitude has not had the chance to stabilise. Simply
close the plot and the calculation will continue for
another 10 periods, however the amplitude will still not
stabilise and the same message will apear. Input the
ineteger '50' and press 'enter' to extend the iteration
limit incrment to 10 + 50 = 60, the calculation will
continue.
After a while the same message will appear again - even
after extending the solution for 60 periods in each
iteration, the solution did not want to stabilise. You
should be suspicious. Instead of extending the
IterationLimitIncrement any further, plot the last
iteration (by entering any letter in the console). You
will see that the solution is starting to wobble. This
means, that the period of the oscillations has become a
multiple of the driving period. You can make sure of
this by measuring the period on the graph (measure the
distance between the highest peaks) and comparing it to
the driving period displayed in the console. In this
case the period has tripled.
While such behaviour is still periodic, it is a sign
that the oscillator will be entering the chaotic regime
soon. And even though the function is periodic, the
steady-state amplitude will not be found even if you
extend the IterationLimitIncrement by a large number,
because of the way the searching method works. Let's try
it: close the plot and enter '1000' in to the console. A
different message will appear, informing you, that an
error has occured (oscillating period does not equal the
driving period) and the last iteration plot will be
shown automatically. The only way to fix this (in this
case), is to close the program altogether (just close
the console window) and enter more modest parameters (a
lower M0/J), so that the steady-state amplitude exists
everywhere.
However, sometimes this same message will be displayed
(without prior requests to extend
IterationLimitIncrement), but the plotted solution will
look completely fine. In this case, only close the plot.
You will be requested to enter a new
InitialSolvingDepth. Enter a larger one and the
calculation should continue without any problems.
Example 7: Phase scanned high driving amplitude
nonlinear resonance. This is similar to the 6th
example, only this time some points are plotted for
different driving phases (at the start). At driving
frequencies where two steady-state amplitudes exist, it
matters how the driving is initiated - in what relation
are the oscillator's motion and the driving force. The
final steady-state amplitude depends on this.
The program plots multiple curves with the same
parameters but different driving phases (gamma). The
points of each curve are sligtly displaced from each
other and colored differently, so that you can
distinguish points with different driving phases. The
relevant parameters for this are:
- Starting gamma (st. gamma), which tells the
gamma of the first curve.
- Ending gamma (end gamma), which tells the
gamma of the last curve.
- The number of curves (gammaCurves) tells how
many curves with different gammas reside on the
interval defined by st. gamma and end
gamma. The minimum is 1, which is just one curve
at gamma = starting gamma.
- The number of sample points in each curve (samples).
Together with the width of the freqency interval and
the number of curves, this determines the density of
the plot.
The calculation time is proportional to the product
of gammaCurves*samples.
Example 8: Magnetic
oscillator with a hard spring. This example plots
multiple phase scanned curves. The color coding now only
represents different curves and not different driving
phases, as in the previous example (even though each curve
is phase scanned). The behaviour of the Duffing oscillator
is more prominent here.
For each curve the parameters:
- st. gamma,
- end gamma,
- gammaCurves and
- samples
have the same meaning as in the previous example and
only effect a single visible (points of the same color)
curve. The three new parameters are:
- start M0/J, which tells the driving amplitude
of the first curve,
- end M0/J, which tells the driving amplitude
of hte last curve,
- NCurves tells how many curves reside on the
interval specified by start M0/J and end
M0/J and thus ultimately, how many curves are
visible on the plot. The minimum is 1, which is just
one curve at M0/J = end M0/J.
There is a reason, that the calculation begins at the
curve with the highest driving amplitude: If on any of
the curves the oscillator will enter the chaotic regime
(where the steady-state amplitude disappears), it is
going to be the highest one first. Therefore the user
gets notified of the bad choice of end M0/J (too
high) as soon as possible (instead of waiting until the
end of the calculation just to learn, that it failed).
The calculation time is proportional to the product
of gammaCurves*samples*NCurves.
This concludes the preset
examples showcase. There are more examples left in the
examples.cmd file, Those were used in the graphs, which
appeared in my thesis.