This project is an opportunity for me to gain experience of functional programming in Elixir, while at the same time indulging in a bit of nostalgia by revisiting the research I did for my PhD. I have not kept up to date with developments in the field since I left academia and so nothing in this project is likely to contribute to current research. Instead my aim is to reproduce the programming aspects of the work I did then, but with the benefit of 3 decades of software engineering experience and using a language and programming techniques which were not available back then.
The charting functions use Gnuplot Elixir. While this will be installed by mix deps.get
, Gnuplot itself must be installed separately.
The Elixir project is in the subdirectory ./apps/imposc/
. There are four ways of accessing the functionality:
- A very simple Web front-end launched by
mix phx.server
and accessible at http://localhost:4000 - The same Web front end inside a Docker container, which can be built by
make build
and launched bymake run
- A command-line script, which can be built by
cd ./apps/imposc/; mix escript.build
and launched by./apps/imposc/imposc
and which has two modes, a one-shot mode which accepts a JSON string on the standard input and a console mode. - Inside
iex -S mix
:iex> Console.run()
launches the consoleiex> File.read!(file_name) |> CoreWrapper.process_input_string
runs a one-shot mode from the specified file
- A microservice launched by
mix run --no-halt
(see the Architecture section below) and accessible at http://localhost:8080
I completed my PhD in 1992 and have not followed academic developments since that time, so the work described here is probably outdated and makes no reference to more recent research.
Most of my thesis was devoted to a simple mathematical model comprising a forced harmonic oscillator whose motion is constrained by a hard obstacle, from which it rebounds instantaneously:
This can be nondimensionalised as follows:
which gives:
where
Because a coefficient of restitution of less than 1 is sufficient to introduce dissipation into the system, for most of my thesis I simplified further by setting the damping coefficient to zero, so that the problem reduces to:
The impact introduces a discontinuity into the system which makes it strongly nonlinear, so that it exhibits many of the complex behaviours associated with nonlinear dynamical systems.
A Poincaré map is a useful way of reducing a continuous dynamical system to a discrete system with one fewer dimensions. In this case the form of the problem naturally induces a map - which we call the impact map - which takes the phase (time modulo the forcing period) and velocity at one impact to the phase and velocity at the next impact. What makes it interesting is that it does not strictly conform to the textbook definition of a Poincaré map, because when impacts occur with zero velocity the trajectory in phase space is tangential to the surface . At points which map to zero-velocity impacts, the impact map is not only discontinuous but singular. This underlies many of the complex dynamics which are observed for some parameter ranges.
The domain (and range) of the impact map, the impact surface, is geometrically an infinite half-cylinder, since the impact velocities range over , while the phase ranges over .
Periodic motions can be classified by labelling them with two numbers, the number of impacts in a cycle and the number of forcing periods, so that a (m, n) orbit repeats itself after m impacts and n forcing cycles. The simplest of these are (1, n) orbits, which correspond to fixed points of the impact map. These can be extensively studied analytically and formulas can be obtained for the impact velocity Vn as the parameters , and r are varied.
This reveals that, as is varied while and r are held fixed, the Vn-response curve is an ellipse (or rather half an ellipse as negative Vn is of no interest), centred on the origin. As is varied, this ellipse rotates, so that its major axis is vertical for , is tilted into the negative quadrant (for positive Vn) for and into the positive quadrant for . In the tilted cases, the lower branch of the half-ellipse always corresponds to dynamically unstable orbits. The point where the upper and lower branches meet corresponds to a saddle-node or fold bifurcation. As we vary away from this point, the orbit corresponding to the upper branch will remain stable until either (i) it loses stability to a supercritical period-doubling bifurcation and is replaced by a (2, 2n) orbit or (ii) it is destroyed by the occurence of an intervening impact, which makes the analytically-derived (1, n) orbit unphysical. Case (i) is typically the prelude to a period-doubling cascade of a kind familiar to anyone who has studied chaotic dynamical systems.
It turns out that, at least for small values of , forcing frequencies near the 'resonant' values are associated with comparatively simple dynamics dominated by globally attracting (1, n) orbits, while the intervening regions of parameter space are characterised by much more complex behaviour, including chaotic attractors and multiple competing periodic orbits.
My supervisor, Chris Budd, coined the term 'grazing' for a kind of bifurcation in which a periodic orbit is destroyed by the occurence of an intervening impact. At the bifurcation point, this intervening impact has zero velocity, hence the term 'grazing'. This phenomenon can be investigated in terms of the geometry of the impact map by studying the set S of impact points which map to a zero velocity impact. This has the form of a 'branched manifold', i.e. a set of curves of codimension 1 which branch off each other at various points. If one draws a line transverse to this manifold and observes how the image of the impact map varies as one moves along the line, one finds that, as one crosses S from one direction (the 'non-impact side') v1 drops discontinuously to zero, while as one approaches S from the other direction (the 'impact side') it drops continuously to zero but at a rate which as . This results in a strong local distortion of the phase flow. It also means that much of the local dynamics can be understood by reference to a one-dimensional map.
The occurrence of intervening low-velocity impacts combined with the fact that, on the non-impact side, the dynamics continues to behave as if there were no intervening impact, helps to explain why for parameter values in the neighbourhood of a 'grazing' bifurcation of a stable (1, n) orbit, one often observes the appearance of competing (3, 3n) orbits.
A chapter of my thesis was devoted to a particularly striking instance of 'grazing', which occurs in the resonant case , which has certain simplifying features which make it particularly instructive.
'Grazing' occurs when a point on the impact surface corresponds to a local maximum of the motion x(t). In general, there will also be a range of points for which the acceleration is positive and so the mass will be temporarily held motionless against the obstacle. If a low velocity impact occurs near this region, there will be an infinite sequence of low-velocity impacts converging in a finite time on a zero-velocity impact. This corresponds physically to a low-energy juddering of the mass against the obstacle. Our numerical simulation has to detect this behaviour and suitably truncate the infinite sequence. This behaviour can occur as part of a periodic orbit, in which case we label it .
- F Dux “The Dynamics of Impact Oscillators”. PhD Thesis (1992). University of Bristol.
- C Budd and F Dux “Intermittency in Impact Oscillators Close to Resonance”. Nonlinearity 7 (1994) 1191-1224
- C Budd and F Dux “Chattering and Related Behaviour in Impact Oscillators”. Phil, Trans. R. Soc. Lond. A (1994) 347, 365-389
- C Budd, F Dux and A Cliffe “The Effect of Frequency and Clearance Variations on Single-Degree-Of-Freedom Impact Oscillators”. Journal of Sound and Vibration (1995) 184(3), 475-502
The software generates graphical plots of the following:
- Scatter plots of iterated applications of the impact map for a given set of parameter values and initial conditions
- Time series plots of x(t) for a given set of parameter values and initial conditions
- response curves for (1, n) orbits for a given values of and r, showing bifurcation points where orbits become dynamically unstable or unphysical (the latter established numerically)
If you access this functionality via the one-shot CLI (./apps/imposc/imposc -o
) or via the REST API (i.e. by constructing your own JSON inputs), it is possible to have multiple plots on a single chart (e.g. several response curves for for different values of , n and r). It is also possible to group multiple charts of different kinds onto a single image. Neither of these is yet possible via the Web front-end or the console. I hope to introduce this in the future.
Various other interesting plots will come later, time permitting, including:
- The 'stroboscopic' Poincaré map, which samples the displacement and velocity at each forcing cycle
- Plots of the velocity vs. the displacement
- Domain of attraction plots on the impact surface for competing , and chaotic orbits
- Plots of the singularity set and its dual on the impact surface
- response curves for (1, n) orbits for fixed
- Numerically-generated sensitivity/bifurcation plots
The application is implemented in an Elixir umbrella project with three sub-projects:
- Core: this is the bit which does the maths. It comprises functions which return nested collections suitable for JSON-ising.
- Charts: this accepts nested collections as generated by core functions and generates charts, which are either directed to the display or to PNG files.
- Core wrapper: accepts (JSON-compatible) nested collections as input and interprets them into core function calls, directing the output where appropriate to charts calls
- Console interface: runs in a terminal and accepts user commands, which it interprets into core and charts commands via the core wrapper
- Command line interface: CLI which launches the application in one of two modes:
- a one-shot mode which accepts JSON from the standard input, interprets it into core and charts commands via the core wrapper, returns any text output (e.g. JSON) to the standard output and exits.
- a mode which launches the console interface
A simple Phoenix web application which provides forms for generating different kinds charts provided by the main application.
A lightweight Web API which accepts requests, which it interprets into core and charts commands via the core wrapper. This was implemented before the web UI, when I was considering implementing the latter as an entirely separate client application using a different technology.