Download presentation

Presentation is loading. Please wait.

Published byRichard Roach Modified over 3 years ago

1
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 2 Previous Work Assume understood and completed 281 –Need to be able create classes –Graphics –Mathematical Calculations…

3
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 6 Gravitation Force on a massive object depends on all the massive objects in the system. What properties does a Gravitational Object have?

7
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 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
PHY283 Scientific Modelling Week 1Slide 10 Example of Documented Code /** * An example of documented code * @author Iain Bertram * @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
PHY283 Scientific Modelling Week 1Slide 11 Continued /* * * Method to obtain the value stored in the class */ public double getVariable(){double arg=this.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"); }

Similar presentations

OK

Review. By the end of today you should be able to- Know how to use args Know how to use the JOptionPane Know how to convert a String to a number.

Review. By the end of today you should be able to- Know how to use args Know how to use the JOptionPane Know how to convert a String to a number.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on covalent and ionic bonds Balance sheet reading ppt on ipad Ppt on dual power supply Ppt on history of human evolution Ppt on information technology act Ppt on plasma arc cutting Ppt on central limit theorem Ppt on facebook graph search Ppt on refraction and reflection of light Sources of water for kids ppt on batteries