Physics Simulations - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Physics Simulations

Description:

In this lab class we will be creating Simulations of Gravitational Systems. ... Week 5: Flashy Graphics.. PHY283 Scientific Modelling. Week 1. Slide 6. Gravitation ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 12
Provided by: Llo43
Category:

less

Transcript and Presenter's Notes

Title: Physics Simulations


1
Physics Simulations
  • In this lab class we will be creating Simulations
    of Gravitational Systems. This will involve
    several steps
  • Analysis of Problem
  • Design of Appropriate Classes
  • Member Variables
  • Constructors
  • Methods
  • etc.
  • Code should be reusable
  • Testing Code


2
Previous Work
  • Assume understood and completed 281
  • Need to be able create classes
  • Graphics
  • Mathematical Calculations

3
Grading
  • 100 Course Work
  • divided into 5 weekly projects and final report
    on project.
  • Will need to document all code.
  • Please back up all of your code onto floppy disks

4
Course Outline
  • Week 1
  • Class Design ThreeVector Class
  • Class Design of MassiveObject Class
  • Class Design of GravitationalForceField
  • Create ThreeVector Class with following
    properties
  • dotProduct
  • set
  • add
  • subtract
  • cross product
  • print
  • get
  • magnitude
  • scalar multiplication

5
Course Outline
  • Week 2
  • Physics Simulation issues
  • Simulate Massive Object on Earths Surface in 2d
  • Week 3
  • Simulation of 2D orbiting bodies
  • Simulation of object in tunnel through center of
    earth
  • Week 4
  • Simulate 3 bodies in 3D
  • simulate N bodies in 3D
  • Week 5 Flashy Graphics..

6
Gravitation
  • Force on a massive object depends on all the
    massive objects in the system.
  • What properties does a Gravitational Object have?

7
Potential and Force
  • Given a Potential Field G(x,y,z) the force is
    given by the three dimensional vector derivative
  • Requires mathematical calculation of the
    derivatives of a function
  • We can create a force field class instead.

8
Class Design
  • Class Design ThreeVector Class
  • Class Design of MassiveObject Class
  • Class Design of GravitationalForceField
  • Work together on what are the properties
    required.
  • Will need to write up your design in your log
    book.

9
Implementation of Vector Class
  • Member Variables should be private
  • allows you to change implementation without
    changing user code
  • Access all variables via public methods
  • Document your code.
  • Write a class to test your code
  • What are appropriate tests?

10
Example of Documented Code
/ An example of documented code _at_author
Iain Bertram _at_version 1.0 / public class
Sample private double myVariable /
The Default Constructor, set to zero
/ public Sample() this.myVariable
0.0 / Constructor that sets a
value / public Sample(double
setValue) this.myVariable setValue
11
Continued
/ Method to obtain the value stored in
the class / public double getVariable()double
argthis.myVariable return arg /
Method to set variable / public void
setVariable(double setValue) this.myVariable
setValue / Method to print Variable
/ public void print() System.out.print("The
variable is "this.myVariable"\n")
Write a Comment
User Comments (0)
About PowerShow.com