Skip to main content
留学咨询

辅导案例-MECH 5315M-Assignment 1

By May 15, 2020No Comments

MECH 5315M { Engineering Computational Methods Assignment 1 Copyright R
2019 University of Leeds UK. All rights reserved. Please submit electronically via Minerva before noon Monday 18 November 2019. Your report should not be longer than 4 pages in total. Please use at least a font size of 11pt and 2cm margins on all sides. All MATLAB code should be attached to the report as an appendix. The appendix does not count towards the 4 page limit. All gures in the report must have captions, properly labelled axes, legends where necessary and must be described and analysed in the text. Problem. An algorithm not yet studied in the lecture to solve the linear mass-spring system _x(t) = v(t) (1) _v(t) = (k=m)x(t) (2) is the so-called symplectic or semi-implicit Euler method v n+1 = v n t(k=m)x n (3a) x n+1 = x n +tv n+1 : (3b) For all simulations in MATLAB for this exercise, please use values of k = 5:0 and m = 0:5 and initial values x 0 = 1:0 and v 0 = 0:1. All simulations should run until a nal time T = 10:0. Task 1. (25 marks) 1. (5 marks) Implement the algorithm given by equation (3) as a function in MATLAB. The function should accept as arguments the parameter k, m, the number of time steps N , the nal time T and initial values x 0 , v 0 . It should return an array that contains all values x n , v n , n = 0; : : : ; N generated by the method. 2. (10 marks) Write down the semi-implicit Euler method in your report and explain what part of it is implicit and what part is explicit. Explain also why the implicit part does not require using fsolve. 3. (10 marks)Write a script in MATLAB that produces a gure for your report that convinc- ingly demonstrates that the semi-implicit Euler method is convergent with order p = 1. Explain what the gure shows and why it demonstrates that the method is rst order convergent. 1 Task 2. (20 marks) 1. (10 marks) Using your function from Task 1, write a script in MATLAB that produces a gure for your report that shows the discrete energy E n := 1 2 m(v n ) 2 + 1 2 k(x n ) 2 (4) of the solution generated by semi-implicit Euler over time for N = 100 and N = 1000 time steps and a second gure that shows the resulting energy error. 2. (10 marks) Describe what you observe and compare your observations to what you know about the performance of explicit and implicit Euler. Task 3. (30 marks) 1. (10 marks) Show mathematically that semi-implicit Euler conserves the modied discrete energy ~ E n = 1 2 m(v n ) 2 + k(x n ) 2 ktx n v n Note: For the sake of simplicity, you can do this calculation for m = k = 1. 2. (5 marks) Write a script in MATLAB that produces a gure for your report that shows both the energy E(t) of the continuous system and the modied discrete energy ~ E n of the approximate solution produced by semi-implicit Euler for N = 100 and N = 1000 time steps. Describe the result. 3. (15 marks) Explain why and how the observations from Task 3.2 are relevant. Contrast the result to what we know from the lecture about explicit Euler. Task 4. (25 marks) 1. (10 marks) Search the relevant literature for a generic formulation of symplectic-Euler that allows it to be applied to the nonlinear spring-mass system _x(t) = v(t) (5a) _v(t) = (k=m) x(t) + x 3 (t) : (5b) Write down the method and cite your source. 2. (5 marks) Write a MATLAB function that implements the symplectic Euler for the nonlinear system. The function should have the same form as the function in Task 1, except for an additional input variable . 3. (10 marks) Write a MATLAB script that plots the approximate solution to system (5) produced by symplectic Euler with N = 100 time steps and MATLAB’s ode45 with absolute and relative tolerance of 10 10 using the same parameters as for the linear case and = 3:0. Describe your result. What happens if you run the same simulation for = 10? 2

admin

Author admin

More posts by admin