PH36010: Numerical Methods - Evaluating the Lorenz Attractor using Runge-Kutta methods Mr. Benjamen P. Reed (110108461) IMPACS, Aberystwyth University January 31, 2014 Abstract A set of three coupled ordinary differential equations known as the Lorenz equations were evaluated using the Fourth-Order Runge-Kutta method to produce a solution known as the Lorenz Attractor. The parameters of the Lorenz attractor were systematically altered using a FORTRAN program to ascertain their effect on the behaviour of the chaotic system and the possible physical consequences of these changes was discussed. The functionality of the Runge- Kutta method is also considered.
Table of Contents 1. Introduction 3 2. Background Theory and Procedure 4 2.1 Lorenz Equations 4 2.2 Fourth-Order Runge-Kutta. 4 2.3 Evaluating the Lorenz Equations 5 3. Results 6 3.1 Typical Lorenz Attractor 6 3.2 Dependence on sigma σ. 7 3.3 Dependence on beta β 9 3.4 Dependence on rho ρ. 11 4. Discussion 13 5. Conclusion 14 Acknowledgements 14 References 14 Appendixes 15 A. Runge-Kutta Code to Evaluate Lorenz Equations 15 2
1. Introduction Of all the dynamic systems that physics, and the physical sciences describe and model, none are more subtle yet potent than chaotic systems; these are systems whose behaviour is highly sensitive to the initial conditions of that system. One example of a chaotic system is the double rod pendulum, which has a full rotation hinge in the middle of the system, allowing the bottom half of the pendulum to swing quasi-independently of the main pendulum. The high initial condition dependence in these systems has been poetically named the Butterfly effect, after Edward Norton Lorenz s (an American mathematician and meteorologist) work on the Lorenz attractor and his 1972 talk, Predictability: Does the Flap of a Butterfly's Wings in Brazil set off a Tornado in Texas? As a meteorologist, Lorenz investigated the functionality and possibility of performing accurate long-term weather forecasts, and his research demonstrated that even the smallest change in a weather system could have significant effects on the system as it evolved in time. He concluded that any model of any weather system would have to take into account the smallest variations in the weather conditions in order to have a high accuracy; today s weather modelling computers are designed to compute thousands of variables in order to predict the short-term forecast. However, despite all the known variables, there are still just as many unknown variables that have non-periodic or chaotic behaviour, and as such they are intrinsically unpredictable in the long-term. Even smaller systems with considerably less variables, still exhibit this long-term unpredictability (Palmer, 1993). One simple system to exhibit chaotic behaviour is the Lorentz equations, a system of three coupled ordinary differential equations that are a simple and idealistic set of twelve hydrodynamical equations that describe turbulent flow in the atmosphere. When the 3- dimensional coordinates of this system are plotted with time as the independent variable, an interesting graph is observed. For a single point moving around in phase space (i.e. x(t), y(t) and z(t) where t is time), it traces out a curve, or an orbit which always converges and then remains on a surface comprised of two wings. For any initial conditions, the point always and eventually links up with this two-winged surface, and hence it is known generally as an attractor. The attractor created with the Lorenz equations, shown in figure 1, is appropriately named the Butterfly attractor for its appearance and also because it visualises solutions that exhibit the butterfly effect (Taylor, 2011). Figure 1 - A visualisation of the Lorenz attractor in phase space; solution to the Lorenz equations as an orbit in phase space. (Source: http://www.mizuno.org/c/la/img/lorenz_web.jpg) As previously mentioned, the Lorenz attractor can be constructed using three coupled ordinary differential equations, and as such can be modelled with a relatively simple program and a robust graphing client. In this report, the Lorenz attractor for an arbitrary chaotic system is evaluated using a program written in the script-based programming language FORTRAN. The program employs the use of the Fourth-Order Runge-Kutta method in order to solve the Lorenz equation and thus produce useable data. The parameters and variables of the system were changed systematically in order to ascertain their effect on the shape and profile of the butterfly attractor in phase space. This report will also discuss the effectiveness of using the Fourth-Order Runge- Kutta method with coupled ordinary differential equations. 3
2. Background Theory and Procedure 2.1 The Lorenz Equations The Lorenz equations, as written by Edward Lorenz himself are dx dt = σ (y x) (1) dy dt = x(ρ z) y (2) dz dt = xy βz (3) where x, y, and z are variables in phase space and σ, ρ. And β are the constant parameters of the system. It is easy to see in this system, that as one variable of phase space changes, the other two variables in phase space change in response. The parameters in these equations each have physical meanings are not just some mathematical quirk. Sigma σ is called the Prandtl number and is a description of the systems physical characteristics such as viscosity and thermal conductivity in the case of convection flow. Rho ρ represents a control parameter, which is the difference between the extrema driving forces in the system. For the example where the Lorenz attractor is characterising convection in a fluid filled tank, ρ would represent the temperature difference between the top and bottom of the tank. Finally beta β is a value that describes the shape of the box that the Lorenz attractor is contained within. For the convection example, β would be the width-to-height ratio of the convection layer (Stockie & Wong, 2009). 2.2 The Fourth Order Runge-Kutta The Runge-Kutta method is an iterative numerical method for solving systems of coupled ordinary differential equations (CODEs), and is highly considered to be the most accurate numerical method for this purpose for the amount of effort required to code it. It is similar to Euler s method of solving ODEs however whereas Euler s method only evaluates each iterative step at one point, Runge-Kutta evaluates each step at four separate locations as shown by equations 4 to 7. Two evaluations are made at the end points of each interval, and two are made in the middle. F 1 = δtf (y i,t i ) (4)! F 2 = δtf # y i + 1 2 F 1,t i + 1 " 2 δt $ %! F 3 = δtf # y i + 1 2 F,t + 1 2 i " 2 δt $ % & (5) & (6) F 4 = dtf ( y i + F 3,t i +δt) (7) It then combines these solutions into one highly accurate approximation of the function at that point. In essence, this means that any number of time-dependant CODEs can be evaluated by one 4
program and hence data can be formulated for data analysis. The final recombination step is characterised by equation 8, which gives the phase space coordinate at that time step (Süli, 2013). y i+1 = y i + 1 ( 6 F + 2F + 2F + F 1 2 3 4) (8) (N.B. y in equations 4 8 can represent any value in any axis, i.e. y can be x or z. Cartesian coordinates are evaluated separately for each axis, so Runge-Kutta is executed three times for each point in phase space). 2.3 Evaluating the Lorenz Equations To solve the Lorenz equations and thus produce the Lorenz attractor plot, a program was written in FORTRAN, which used the aforementioned Fourth-Order Runge-Kutta method to evaluate the CODEs hence produce useable data in the form of a comma separating variable file. This data was then sent to gnuplot to produce 3-dimensional phase space plots and 2-dimension time dependent graphs of the variables (Press et al., 2007). The full FORTRAN can be viewed in the appendix. To ascertain the effect of parameters on the Lorenz attractor, a default attractor was plotted and then each parameter was adjusted systematically. The attractor was then re-plotted and compared with the original to ascertain what had changed. 5
3. Results 3.1 Typical Lorenz Attractor Figure 2 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 10, β = 8/3, ρ = 28. Figure 3 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 10, β = 8/3, ρ = 28. 6
3.2 Dependence on sigma σ Figure 4 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 5, β = 8/3, ρ = 28. Figure 5 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 5, β = 8/3, ρ = 28. 7
Figure 6 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 20, β = 8/3, ρ = 28. Figure 7 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 20, β = 8/3, ρ = 28. 8
3.3 Dependence on beta β Figure 8 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 10, β =4/3, ρ = 28. Figure 9 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 10, β =4/3, ρ = 28. 9
Figure 10 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 10, β =16/3, ρ = 28. Figure 11 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 10, β =16/3, ρ = 28. 10
3.4 Dependence on rho ρ Figure 12 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 10, β =8/3, ρ = 14. Figure 13 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 10, β =8/3, ρ = 14. 11
Figure 14 - A 3D plot of a typical Lorenz attractor in phase space, where σ = 10, β =8/3, ρ = 56. Figure 15 - A 2D plot of Lorenz attractor phase space coordinates against time, where σ = 10, β =8/3, ρ = 56. 12
4. Discussion Figure 2 shows a typical Lorenz attractor with the parameters σ = 10, β = 8/3, ρ = 28. This 3- dimensional plot, along with its 2-dimensional temporal dependence graph in figure 3 was treated as the control, a reference that could be used to determine the changes in the Lorenz attractor shape as the parameters were altered. The 3d representation in figure 2 was typical of the butterfly wings found in the literature and resource material. Hence, it was assumed that these figures were correct and an accurate demonstration of chaotic flow in atmospheric systems. To infer some physical meaning to the results detailed in section 3, it has been assumed that the Lorenz equations in this situation are characterising the convectional flow of a viscous fluid in a heated tank. The first parameter that was altered was sigma σ, which as mentioned in section 2.1, is the Prandtl number and is a description of the systems physical characteristics of flow. It tells information about the fluid s viscosity and thermal conductivity. Figures 4 and 5 show the situation where the parameter sigma has been halved from it original value. Physically, this means that the viscosity of the fluid is higher, so the fluid takes longer to converge on the attractor surface. Furthermore, once on the surface the flow begins to spiral inwards on only one wing. Figure 5 shows that the movement of one unit of fluid decreases over time, which implies that the flow is so viscous that it actually dampens any movement within it. Conversely, in figures 6 and 7 the viscosity is lower and hence the flow quickly converges on the attractor surface, and onto two wings. Once there, it is able to sweep out large arcs of movement in the decreased viscosity hence why there appears to be no inner orbits within the wings. The second parameter to be altered was beta β, which characterises the width-to-height ratio of the convection layer. Intuition infers that a smaller width in the convection zone means that flow will frequently switch between one wing of the attractor surface and the other. Whereas a larger width in the convection zone will mean that flow will switch attractor wings frequently, if at all. The figures in section 3.3 seem to agree with this intuition, with the 2D temporal dependence graphs demonstrating this much more clearly. Figure 9 shows the temporal dependence of the flow when the width-to-height ratio is low; the x(t) and y(t) frequently change phase which implies that the flow is moving through the convection zone frequently and changing which wing it orbits. On the other hand, figure 10 where β is double the control parameter, shows that once the flow is orbiting one wing, it never switches over to other wing, implying that the width of the convection zone is so large, that flow cannot or rarely passes into it. Finally, the last parameter rho ρ details the temperature difference between the top and the bottom of the tank. It is expected that a large difference in temperature between the top and the bottom of the tank will give rise to a large flow rate with frequent changes in attractor orbit. The system would also take an extended period of time to reach equilibrium and so the flow rate would continue to be rapid for a long time. With a small temperature difference, the thermal driving forces would be reduced and the system would reach equilibrium relatively faster. This is certainly what seems to be happening in figures 12 and 13. The low thermodynamic driving force means that the flow hardly changes orbit, or in this case, doesn t at all. Furthermore, once equilibrium is reached, all macroscopic movement stops as shown by figure 13 and the system tends toward equilibrium, a dampening effect is observed much like in figure 5. From this discussion, it is apparent that small changes in the Lorentz attractor system give rise to large macroscopic effects. The Runge-Kutta method has illustrated these changes well and is a very suitable method to use in the modelling of chaotic systems. It does not appear to show signs of divergence, a common issue in the simpler Euler s method, and so confidence is high that there is minimal error in the Lorentz modelling. 13
5. Conclusion A model of the Lorenz attractor has been constructed using the Runge-Kutta method to solve the Lorenz equations, a set of three coupled ordinary differential equations that describe chaotic flow in atmospheric or hydrodynamic systems. The modelling proved to be successful and the Lorenz equation parameters were varied to ascertain their effect on the behaviour of the system. It was found that small changes to these parameters could have huge effects on the dynamics of the system, either making it more chaotic, or taming it such that the flow rate of the system tends to zero. In the cases where the flow rate tended to zero, the parameters gave rise to an unstable system where the dynamics could not be maintain for an extended period of time. Conversely, in the situations where the flow became more chaotic, the system remained stable and the orbits of the attractor surface were more pronounced. In respect to the numerical method employed, the Runge-Kutta method performed well and produced an accurate, stable model in which to observe the Lorenz attractor. Acknowledgements The author would like to extend their gratitude to Dr. Martin Wilding for the tuition he provided during the course, and for taking time out of his own schedule to give students on the course the time necessary to provide work of their best effort. The author would also like to thank Mr. Patrick Dixon, Mr. Andrew Leonard and Mr. Tom Knight for helping to run the module and provide lessons in effective coding. Finally, the author would like to thank Miss. Carley Martin, Miss. Fffion Whitehouse and Miss. Rose Cooper for providing much needed discussion and support during the module. References Palmer, T., 1993. Exploring Chaos: A Guide to the New Science of Disorder. London: W. W. Norton & Co. Press, W.H., Teukolsky, S.A., Vetterling, W.T. & Flannery, B.P. 2007. Numerical Recipes: The Art of Scientific Computing. 3rd ed. Cambridge: Cambridge Press. Stockie, J. & Wong, K., 2009. A Simple Model of the Unpredictability of Weather: The Lorenz Equations. Clouds, Aerosols and Climate Feedback Publications. Available at: <http://clouds.eos.ubc.ca/~phil/numeric/labs/lab6/lab6.pdf> [Accessed 30 January 2014] Süli, E. 2013. Numerical Solution of Ordinary Differential Equations. [pdf] Mathematical Institute, University of Oxford. Available at: <http://people.maths.ox.ac.uk/suli/nsodes.pdf> [Accessed 30 January 2014] Taylor, R.L.V., 2011. Attractors: Nonstrange to Chaotic. SIAM Undergraduate Research Online, 4. 14