Download presentation
Presentation is loading. Please wait.
Published byRosaline Watts Modified over 9 years ago
1
Developing Simulations and Demonstrations Using Microsoft Visual C++ Mike O’Leary Shiva Azadegan Towson University Supported by the National Science Foundation under grant DUE 9952625
2
Introduction We have developed a course in Scientific Modeling and Simulation We have developed a course in Scientific Modeling and Simulation
3
What is the Course? This is a one-semester interdisciplinary course straddling the boundaries between mathematical modeling, numerical methods, and modern object-oriented computer programming. This is a one-semester interdisciplinary course straddling the boundaries between mathematical modeling, numerical methods, and modern object-oriented computer programming. Our course is project-driven. Our course is project-driven. Given a realistic problem, we Given a realistic problem, we Create a model, Create a model, discuss appropriate numerical methods, and then discuss appropriate numerical methods, and then create a simulation of the problem using Microsoft Visual C++ that takes full advantage of our computer's graphical capabilities. create a simulation of the problem using Microsoft Visual C++ that takes full advantage of our computer's graphical capabilities.
5
Course Objectives The students upon completing these courses will have: The students upon completing these courses will have: the knowledge to choose proper numerical methods to solve a scientific problem; the knowledge to choose proper numerical methods to solve a scientific problem; the knowledge of modeling techniques to develop a model for the problem; the knowledge of modeling techniques to develop a model for the problem; the programming skills to implement the model using an object- oriented programming language; the programming skills to implement the model using an object- oriented programming language; the critical thinking skill to form conclusion based upon the results; the critical thinking skill to form conclusion based upon the results; the communication and writing skills to prepare and present technical reports; the communication and writing skills to prepare and present technical reports; the experience of working in teams with their peers from different disciplines on multidisciplinary problems. the experience of working in teams with their peers from different disciplines on multidisciplinary problems.
6
What are the Prerequisites? Calculus 1, Calculus 2 Calculus 1, Calculus 2 Introduction to Programming 1 Introduction to Programming 1
7
How does the Course Proceed? The course is driven by the projects. The course is driven by the projects. The modeling, numerical methods, and computer programming are introduced as needed for the solution of a particular problem. The modeling, numerical methods, and computer programming are introduced as needed for the solution of a particular problem. Course can be split into four large portions Course can be split into four large portions Introduction Introduction First project First project Second project Second project Third project Third project
8
Introduction Introduction to programming with MFC & dialog based programming. Introduction to programming with MFC & dialog based programming. Review of numerical methods for integration. Review of numerical methods for integration. Write some programs that evaluate integrals. Write some programs that evaluate integrals. Review of classes. Review of classes. Introduction to numerical methods for differential equations. Introduction to numerical methods for differential equations.
11
First Project Involves solving a system of differential equations. Involves solving a system of differential equations. May or may not require the use of graphics. May or may not require the use of graphics. Introduction to graphics. Introduction to graphics. Dynamic memory allocation Dynamic memory allocation Allows more sophisticated graphics- e.g. graphs of functions. Allows more sophisticated graphics- e.g. graphs of functions. This is more sophisticated programming concept. This is more sophisticated programming concept.
12
Second Project Also a system of differential equations. Also a system of differential equations. More sophisticated mathematics More sophisticated mathematics Either a more sophisticated model: e.g. calculus of variations Either a more sophisticated model: e.g. calculus of variations or better numerical methods: e.g. adaptive methods or better numerical methods: e.g. adaptive methods More sophisticated programming More sophisticated programming Function graphs Function graphs Multiple graphs Multiple graphs Scrolling & sliders Scrolling & sliders
13
Third Project Partial differential equations Partial differential equations Modeling Modeling Analysis of numerical methods Analysis of numerical methods More sophisticated programming More sophisticated programming The mouse The mouse Timers Timers
14
What are the Assignments? Each project takes students 2-4 weeks to complete. Each project takes students 2-4 weeks to complete. Students complete a written project report Students complete a written project report 10-30 pages 10-30 pages Describes in detail the model, the numerical methods, and the program used to solve the problem. Describes in detail the model, the numerical methods, and the program used to solve the problem. Gives a complete answer to the assigned project questions. Gives a complete answer to the assigned project questions. Students programs are also graded. Students programs are also graded. It is important that the paper and the program have different due dates! It is important that the paper and the program have different due dates!
15
What have we developed? Lecture notes for the entire courses Lecture notes for the entire courses Not all of the material was used each semester, so there is more than can be covered in one semester. Not all of the material was used each semester, so there is more than can be covered in one semester. Projects that were assigned. Projects that were assigned. 8 Projects are given; we only would use 3 in a single semester. 8 Projects are given; we only would use 3 in a single semester. Sample code Sample code CD contains source code for the examples described in the notes. CD contains source code for the examples described in the notes.
16
Chapter 12: Adaptive Methods for Differential Equations Chapter 1: Dialog Based Programming Chapter 2: Introduction to Numerical Methods Chapter 3: Classes and Software Design Chapter 4: Differential Equations Chapter 5: Project- The Baseball Problem Chapter 6: Graphics Chapter 7: Project- The Three Body Problem Chapter 8: Project- The Double Spring Chapter 9: Sliders & Scrolling Chapter 10: Dynamic Memory Allocation Chapter 13: Project- Dynamics of HIV Chapter 14: Project- The Double Pendulum Chapter 11: Project- The Resonant Filter Chapter 15: The Mouse Chapter 16: Project- Diffusion Chapter 18: Project- Waves Chapter 17: Timers
17
What are the Projects?
18
Motion of a baseball under air resistance. What is the optimal angle to hit a baseball so that it travels the farthest? Does this angle change with the velocity of the ball? What is the optimal angle to hit a baseball so that it travels the farthest? Does this angle change with the velocity of the ball? Students write a program that gives the total distance the ball will travel. Students write a program that gives the total distance the ball will travel. This project does not require a graphical component, but one can be incorporated. This project does not require a graphical component, but one can be incorporated.
20
The three body problem Determine the motion of three (or more) bodies in the plane under the influence of gravity. Determine the motion of three (or more) bodies in the plane under the influence of gravity. Students are asked to find roughly periodic orbits. Students are asked to find roughly periodic orbits.
22
The double spring Describe the motion of a mass attached to two springs in the plane. Describe the motion of a mass attached to two springs in the plane. Project questions include: Project questions include: Given initial conditions, determine the location of the mass after a period of time, and estimate the accuracy of the answer. Given initial conditions, determine the location of the mass after a period of time, and estimate the accuracy of the answer. Are there solutions that remain above the line connecting the two fixed points for all time? Are there solutions that remain above the line connecting the two fixed points for all time? Analyze the stability properties of the system. Does it display sensitive dependence on initial conditions? Analyze the stability properties of the system. Does it display sensitive dependence on initial conditions? Prove that the sum of the kinetic energy and the energy stored in the springs is conserved. Prove that the sum of the kinetic energy and the energy stored in the springs is conserved.
24
The resonant filter Create a model of an LRC resonant filter. Create a model of an LRC resonant filter. Project questions: Project questions: Given a class that contains an unknown input signal known to be the sum of sinusoids, find the frequency of the unknown signal. Given a class that contains an unknown input signal known to be the sum of sinusoids, find the frequency of the unknown signal. This requires an analysis of the preferred frequency of the solutions to a constant coefficient second order differential equation. This requires an analysis of the preferred frequency of the solutions to a constant coefficient second order differential equation. Programming notes Programming notes The interface is best built with slider controls. The interface is best built with slider controls. Because this requires displaying a graph of a function, some more complex graphical programming is needed. Because this requires displaying a graph of a function, some more complex graphical programming is needed. Almost requires the use of dynamically created arrays. Almost requires the use of dynamically created arrays.
25
Dynamics of HIV Create a simple one-compartment model for HIV infection of CD4+ T-cells. Create a simple one-compartment model for HIV infection of CD4+ T-cells. Obtain three equations in three variables. Obtain three equations in three variables. Investigate the effect of an RT-inhibitor. Though they do not kill HIV, they prevent HIV cells from infecting healthy cells. Investigate the effect of an RT-inhibitor. Though they do not kill HIV, they prevent HIV cells from infecting healthy cells. Project questions Project questions Show that that the system tends to a steady state. Show that that the system tends to a steady state. Show that, if the RT inhibitor is sufficiently effective, then HIV will be entirely removed from the body. Show that, if the RT inhibitor is sufficiently effective, then HIV will be entirely removed from the body. Show that, there is a lower threshold for effectiveness of the RT inhibitor which, though it would not eliminate the virus, it would prevent the onset of AIDS. Show that, there is a lower threshold for effectiveness of the RT inhibitor which, though it would not eliminate the virus, it would prevent the onset of AIDS. Compare the numerical results with their analytic counterparts. Compare the numerical results with their analytic counterparts.
27
The double pendulum Create a model for a jointed pendulum. Create a model for a jointed pendulum. Best technique requires variational methods. Best technique requires variational methods. Project questions Project questions Does the double pendulum display sensitive dependence on initial conditions? Does the double pendulum display sensitive dependence on initial conditions?
29
Diffusion Create a model for diffusion processes. Create a model for diffusion processes. Three different methods to create the model- Three different methods to create the model- System of ordinary differential equations System of ordinary differential equations Directly, as a partial differential equation Directly, as a partial differential equation Probabilistic methods. Probabilistic methods. Introduce finite difference methods for solving partial differential equations Introduce finite difference methods for solving partial differential equations Discuss consistency, stability and convergence. Discuss consistency, stability and convergence. Project question to simulate the temperature of a solid bar. Project question to simulate the temperature of a solid bar. Because the exact value can be found using Fourier series techniques, one can compare the students solution to the actual result for grading. Because the exact value can be found using Fourier series techniques, one can compare the students solution to the actual result for grading. Programming note: the best way to enter the initial data is to use the mouse. Programming note: the best way to enter the initial data is to use the mouse.
31
Wave Motion Create a model of wave motion. Create a model of wave motion. Can be done as a system of ordinary differential equations, or directly as a partial differential equation. Can be done as a system of ordinary differential equations, or directly as a partial differential equation. Introduce finite difference methods for the solution. Introduce finite difference methods for the solution. Project question is to simulate the motion of a vibrating string. Project question is to simulate the motion of a vibrating string. Students verify that the wave speed is correctly calculated. Students verify that the wave speed is correctly calculated.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.