DOC PREVIEW
CMU MEG 24311 - Problem

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

24-311 NUMERICAL METHODS Fall03 Carnegie Mellon University PROBLEM SET 12 Issued: 11/14/03 Due: 11/22/03 Sat 4:00pm @ HH B127 Weight: 3 % of total grade Fourth Order Runge-Kutta Methods Consider the simple particle-spring system shown in Figure 1. A particle of weight m is suspended on a weightless spring of spring constant k and neutral length 0l . The only forces acting on the particle are its weight mg and the force due to the extension or compression of the spring. The position of the particle ),,( zyx is a function of time, and the goal of this assignment is to write a computer program that finds the three dimensional trajectory of the particle as a function of time using the fourth order Runge-Kutta method. (1) The trajectory of the particle is governed by the following three equations of motion. Find xf , yf , and zf in the following equations. =′′=′′=′′),,,(),,,(),,,(tzyxfztzyxfytzyxfxzyx (2) The above three equations are second order ODEs. These equations can be reduced to a system of first-order equations by defining three more variables xv , yv , and zv . Find the system of first-order equations of the following form: =′=′=′=′=′=′),,,,,,(),,,,,,(),,,,,,(),,,,,,(),,,,,,(),,,,,,(543210tvvvzyxfvtvvvzyxfvtvvvzyxfvtvvvzyxfztvvvzyxfytvvvzyxfxzyxzzyxyzyxxzyxzyxzyx (3) A sample code “ode.cpp” and "ode.java" to solve the above first-order ODEs is provided under the class AFS directory. Compile the code and study how the program works. The output of the program is a VRML file “output.wrl” that shows an animation of the trajectory. This program takes as input a set of initial values of the six variables x, y , z, xv , yv, and zv , and then integrates the equation of motion using Euler’s method. In the sample codes all the constants are defined as follows: #define N (1000) // Number of iterations (no unit) #define H (0.01) // Integration interval (sec.) #define L0 (2.0) // Neutral spring length (m) #define K (10.0) // Spring constant (N/m)#define G (9.8) // Gravity constant (m/sec^2) #define M (1.0) // Mass (kg) Because the time interval is 0.01 seconds and the number of iterations is 1000 the code generates a trajectory of the particle for the first 10 seconds. For the following combinations of N and H (note that they are all solutions to the first 10 seconds) N=1000 and H=0.01 (original values in the sample code) N=200 and H = 0.05 N=100 and H=0.1 run the program with the following initial conditions. ode 2 –2.5 0 0 0 0 ode 3 –1 0 0 0 1 Hand in all the pictures (6 pictures) and add a comment on each picture whether the solution is convergent or not. When printing an image choose a view angle similar to Figure 2. (4) Replace Euler’s method implemented in the sample code with the fourth-order Runge-Kutta method and run the same 6 cases. Hand in all the pictures (6 pictures) and add a comment on each picture whether the solution is convergent or not. When printing an image choose a view angle similar to Figure 2. To minimize your work to generate the VRML output the vrml_ode subroutine is provided in the sample codes. In your hand-in directory on AFS, make a new directory called ps12 (in lower case) and hand in the following in the directory. Don’t copy object files (*.obj, *.o) or VRML files. • Source code files • Executable file of the fourth-order Runge-Kutta method with N=1000 and H=0.01 Also hand in a printout of the following: • Source code files and header files • 12 images of the VRML files with comments Figure 1. Particle-spring system Figure 2: VRML file showing the particle trajectlyPS12 The first letter of __________________________ ____________________________ your LAST name First Name Last Name PS12-(1) (15 pts) PS12-(2) (15 pts) PS12-(3) (20 pts) PS12-(4) (50 pts) Total (100 pts) 24-311 NUMERICAL METHODS Fall03 Carnegie Mellon University PROBLEM SET 12 Issued: 11/14/03 Due: 11/22/03 Sat 4:00pm @ HH B127 Weight: 3 % of total


View Full Document

CMU MEG 24311 - Problem

Documents in this Course
Load more
Download Problem
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?