MACS 375 - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

MACS 375

Description:

Start the comet out near Jupiter with an initial velocity heading in system. ... credit if you can make the comet loop the sun and hit a planet. MA/CS 375 Fall ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 41
Provided by: caam1
Category:
Tags: macs | by | comet | hit | jupiter

less

Transcript and Presenter's Notes

Title: MACS 375


1
MA/CS 375
  • Fall 2002
  • Lecture 12

2
Office Hours
  • My office hours
  • Rm 435, Humanities, Tuesdays from 130pm to
    300pm
  • Rm 435, Humanities, Thursdays from 130pm to
    300pm
  • Tom Hunt is the TA for this class. His lab hours
    are now as follow
  • SCSI 1004, Tuesdays from 330 until 445
  • SCSI 1004, Wednesdays from 1200 until 1250
  • Hum 346 on Wednesdays from 230-330

3
This Lecture
  • Solving Ordinary Differential Equations (ODEs)
  • Accuracy
  • Stability
  • Forward Euler time integrator
  • Runge Kutta time integrators
  • Newtons Equations

4
Ordinary Differential Equation
  • Example
  • t is a variable for time
  • u is a function dependent on t
  • given u at t 0
  • given that for all t the slope of us is u
  • what is the value of u at tT

5
Ordinary Differential Equation
  • Example
  • we should know from intro calculus that
  • then obviously

6
Just in Case You Forgot How
ok if u!0
ok if ugt0
integrate in time
Fundamental theorem of calculus
7
Family of Solutions
u(0)4 curve
u(t)
u(0)-4 curve
t
8
Forward Euler Numerical Scheme
  • There are many ways to figure this out on the
    computer.
  • Simplest first.
  • We discretize the derivative by

9
Forward Euler Numerical Scheme
  • Numerical scheme
  • Discrete scheme

where
10
Stability of Forward Euler Numerical Scheme
  • Discrete scheme
  • The solution at the nth time step is then

11
Stability of Forward Euler Numerical Scheme
  • The solution at the nth time step is then
  • Notice that if then un is going
    to get very large very quickly !!. This is
    clearly not what we want for an approximate
    solution to an exponentially decaying exact
    solution.

12
Stable Approximations
  • 0ltdtlt1

dt
dt0.125
dt0.5
dt0.25
13
Stable But Oscillatory Approximations
  • 1ltdtlt2

dt1.25
dt1.5
dt1.5
14
Unstable (i.e. Bad) Approximations
  • 2ltdt

dt4.5
dt3
dt2.5
15
Summary of dt Stability
  • 0 lt dt lt1 stable and convergent since as
    dt ? 0 the solution approached
    the actual solution.
  • 1 lt dt lt 2 bounded but not cool.
  • 2 lt dt exponentially growing,
    unstable and definitely not cool.

16
Accuracy of the Forward Euler Scheme
  • Next lecture

17
Application Newtonian Motion
18
Two of Newtons Law of Motions
  • 1) In the absence of forces, an object ("body")
    at rest will stay at rest, and a body moving at a
    constant velocity in straight line continues
    doing so indefinitely.
  • 2) When a force is applied to an object, it
    accelerates. The acceleration a is in the
    direction of the force and proportional to its
    strength, and is also inversely proportional to
    the mass (m) being moved. In suitable units
  • F ma
  • with both F and a vectors in the same
    direction (denoted here in bold face).

19
Newtons Law of Gravitation
  • Gravitational force an attractive force
    that exists between all objects with mass an
    object with mass attracts another object with
    mass the magnitude of the force is directly
    proportional to the masses of the two objects and
    inversely proportional to the square of the
    distance between the two objects.

20
Real Application
  • You can blame Newton for this

Consider an object with mass m t time m
mass of object F force on object a
acceleration object x location of object v
velocity of object
21
Two Gravitating Particle Masses
m2
m1
Each particle has a scalar mass quantitiy
22
Particle Positions
Each particle has a vector position
x2
x1
(0,0)
23
Particle Velocities
Each particle has a vector velocity
v1
v2
24
Particle Accelerations
Each particle has a vector acceleration
a1
a2
25
Definition of .2
  • In the following we will use the following
    notation
  • Formally the function x2 known as the
    Euclidean norm of x. It returns the length of the
    vector x

26
Two-body Newtonian Gravitation
  • Two objects of mass M1 and M2 exert a
    gravitational force on each otherwhere G
    is the gravitational constant.

Force exerted by mass 2 on 1Force exerted by
mass 1 on 2
27
Newtonian Gravitation
  • Newtons second law (rate of change of momentum
    force on body)

28
Newtonian Gravitation
  • Acceleration

29
Newtonian Gravitation
  • Using velocity

30
N-Body Newtonian Gravitation
  • For particle n out of N

The force on each particle is a sum of the
gravitational force between each other particle
31
N-Body Newtonian Gravitation Simulation
  • Goal to find out where all the objects are after
    a time T
  • We need to specify the initial velocity and
    positions of the objects.
  • Next we need a numerical scheme to advance the
    equations in time.
  • Can use forward Euler. as a first approach.

32
Numerical Scheme
For m1 to FinalTime/dt For n1 to number of
objects End For n1 to number of
objects End End
33
planets1.m Matlab script
  • I have written a planets1.m script.
  • The quantities in the file are in units of
  • kg (kilograms -- mass)
  • m (meters length)
  • s (seconds time)
  • It evolves the planet positions in time according
    to Newtons law of gravitation.
  • It uses Euler-Forward to discretize the motion.
  • All planets are lined up at y0 at t0
  • All planets are set to travel in the y-direction
    at t0

34
Parameters Object massesMean
distancesfrom sun
35
Initial velocities of objects
36
Set dt Time loop Calculate acceleration Adva
nce X,Y,VX,VY Plot the firstfour planets and
the sun end Time loop
37
Earth
Venus
Mercury
38
Mercury has nearly completed its orbit. Data
shows 88 days. Run for 3 more days and the
simulation agrees!!!.
Earth
Venus
Sun
Mercury
39
Team Exercise
  • Get the planets1.m file from the web site
  • This scripts includes
  • the mass of all planets and the sun
  • their mean distance from the sun
  • the mean velocity of the planets.
  • Run the script, see how the planets run!
  • Add a comet to the system (increase Nsphere etc.)
  • Start the comet out near Jupiter with an initial
    velocity heading in system.
  • Add a moon near the earth.
  • Extra credit if you can make the comet loop the
    sun and hit a planet ?

40
Next Lecture
  • More accurate schemes
  • More complicated ODEs
  • Variable time step and embedded methods used to
    make sure errors are within a tolerance.
Write a Comment
User Comments (0)
About PowerShow.com