Performing a Computer Simulation using C++

Slides:



Advertisements
Similar presentations
Time averages and ensemble averages
Advertisements

Object Oriented Programming
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Unit 6 Assignment 2 Chris Boardley.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Chapter 29: Integration Jacob Harper. The Integration Approach The order of adding components to a system is crucial Benefits to careful integration –
Quantum One: Lecture 4. Schrödinger's Wave Mechanics for a Free Quantum Particle.
Software Engineering and Design Principles Chapter 1.
Interactive Animation of Structured Deformable Objects Mathieu Desbrun Peter Schroder Alan Barr.
Distribution Statement A: Cleared for Public Release. Distribution is unlimited. 1 Meshless Methods and Nonlinear Optics Naomi S. Brown University of Hawai`i.
OOP Spring 2007 – Recitation 71 Object Oriented Programming Spring 2006 Recitation 8.
Single Point of Contact Manipulation of Unknown Objects Stuart Anderson Advisor: Reid Simmons School of Computer Science Carnegie Mellon University.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
Language Issues Misunderstimated? Sublimable? Hopefuller? "I know how hard it is for you to put food on your family.” "I know the human being and fish.
Accurate Implementation of the Schwarz-Christoffel Tranformation
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
Erin Catto Blizzard Entertainment Numerical Integration.
Introduction to MCMC and BUGS. Computational problems More parameters -> even more parameter combinations Exact computation and grid approximation become.
1 Welcome to CS 362 Applied Software Engineering What happens after (and during) design? Testing, debugging, maintaining programs Lessons for software.
Monte Carlo Simulation of Liquid Water Daniel Shoemaker Reza Toghraee MSE 485/PHYS Spring 2006.
Object-Oriented Modeling and Design
Simulating Electron Dynamics in 1D
C++ Review Classes and Object Oriented Programming Parasol Lab, Texas A&M University.
Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Object Oriented.
ITC Research Computing Support Using Matlab Effectively By: Ed Hall Research Computing Support Center Phone: Φ Fax:
Object Oriented Software Development
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Lesson 6 – Libraries & APIs Libraries & APIs. Objective: We will explore how to take advantage of the huge number of pre-made classes provided with Java.
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
CS 351/ IT 351 Modeling and Simulation Technologies Review ( ) Dr. Jim Holten.
Introduction to OOP CPS235: Introduction.
COP 3275 Chapter 01 course website: Jonathan C.L. Liu, Ph.D. CISE Department University of Florida.
OBJECT ORIENTED PROGRAMMING. Design principles for organizing code into user-defined types Principles include: Encapsulation Inheritance Polymorphism.
Cracking the Code WHAT WORKS WHEN TEACHING STUDENTS TO CODE?
Anders Nielsen Technical University of Denmark, DTU-Aqua Mark Maunder Inter-American Tropical Tuna Commission An Introduction.
CIS 595 MATLAB First Impressions. MATLAB This introduction will give Some basic ideas Main advantages and drawbacks compared to other languages.
CSCE 240 – Intro to Software Engineering Lecture 3.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
An Introduction to AD Model Builder PFRP
DEVRY COMP 220 iLab 7 Polymorphism Lab Report and Source Code Check this A+ tutorial guideline at
SE-1021 Software Engineering II
Visit for more Learning Resources
Software Testing.
Lecture 1 Introduction Richard Gesick.
Testing More In CS430.
LESSON 18.
Advanced Object-Oriented Programming
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
Principles of Programming and Software Engineering
Objects First with Java A Practical Introduction using BlueJ
Object Oriented Practices
Introduction to MATLAB
CSE373: Data Structures & Algorithms Lecture 14: Hash Collisions
Quantum One.
Algorithms and Problem Solving
Presented By: David Miller
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
COP 3330 Object-oriented Programming in C++
Simulation And Modeling
Polymorphism 2019/4/29.
EN Software Carpentry Python – A Crash Course Function, Classes, and Graphing.
Ph.D. Thesis Numerical Solution of PDEs and Their Object-oriented Parallel Implementations Xing Cai October 26, 1998.
Hans Zaunere, Managing Member
1.3.7 High- and low-level languages and their translators
C++ Object Oriented 1.
Programming Techniques
Presentation transcript:

Performing a Computer Simulation using C++

Structure of Presentation Description of Simulation

Structure of Presentation Description of Simulation Results of Simulation

Structure of Presentation Description of Simulation Results of Simulation Overview of C++

Structure of Presentation Description of Simulation What is being simulated Results of Simulation Overview of C++

Structure of Presentation Description of Simulation What is being simulated What is the algorithm Results of Simulation Overview of C++

Description of Simulation

Description of Simulation What is being simulated?

Description of Simulation What is being simulated? One-dimensional Lattice of masses on springs.

Description of Simulation What is being simulated? One-dimensional Lattice of masses on springs.

Description of Simulation What is being simulated? One-dimensional Lattice of masses on springs.

Comparison of Quadratic Potential And Toda Potential

Quadratic Potential We expect the energy to stay in the initial modes.

Quadratic Potential We expect the energy to stay in the initial modes. Toda Potential We expect the energy to migrate into all modes.

Surprising result discovered by FPU: Energy periodically migrates BACK into the initial modes. Toda Potential We expect the energy to migrate into all modes.

Surprising result discovered by FPU: Energy periodically migrates BACK into the initial modes. Surprising result #2: Solitons, particle-like waves that maintain their shape forever without dispersing or breaking up. Toda Potential We expect the energy to migrate into all modes.

Surprising result #2: Solitons, particle-like waves that maintain their shape forever without dispersing or breaking up. Periodic boundary conditions required. I won’t demonstrate these.

Comparison of Quadratic Potential And Toda Potential

Quadratic Potential Good to test that our algorithm works.

Quadratic Potential Good to test that our algorithm works. Toda Potential Try to reproduce the periodic energy migration.

Description of Simulation What is the algorithm?

Description of Simulation What is the algorithm? BAD approach: Euler’s method

BAD approach: Euler’s method

BAD approach: Euler’s method •Energy diverges

BAD approach: Euler’s method •Energy diverges •Takes a long time to run

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method •Energy doesn’t diverge

GOOD approach: Hessian matrix method •Energy doesn’t diverge •Much faster to run

GOOD approach: Hessian matrix method

GOOD approach: Hessian matrix method

Review of Algorithm

Results of Simulation

Results of Simulation Quadratic Potential (Linear Force) Algorithm is fast and stable

Results of Simulation Quadratic Potential (Linear Force) Algorithm is fast and stable Energy remains in initial modes

Results of Simulation Quadratic Potential (Linear Force) Algorithm is fast and stable Energy remains in initial modes Toda Potential (Nonlinear Force) Algorithm is stable if the nonlinear constant is not too large

Results of Simulation Quadratic Potential (Linear Force) Algorithm is fast and stable Energy remains in initial modes Toda Potential (Nonlinear Force) Algorithm is stable if the nonlinear constant is not too large Takes too long to see energy migrate to other modes

Results of Simulation Quadratic Potential (Linear Force) Algorithm is fast and stable Energy remains in initial modes Toda Potential (Nonlinear Force) Algorithm is stable if the nonlinear constant is not too large Takes too long to see energy migrate to other modes For just the right combination, we see the energy migrate back to the first mode (m=k=b=1, dt=.01, 8 particles, 5 second simulation)

Quick overview of C++

Quick overview of C++ Object-oriented: Severe encapsulation

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe Most errors caught by compiler… once it compiles, it will probably run “fairly” well

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe: what does it mean?

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe: what does it mean? •Every token is of a certain “type”

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe: what does it mean? • Easy debugging: debug just the type itself, not the program.

Quick overview of C++ Object-oriented: Severe encapsulation Inheritance: derive new types from old types

Quick overview of C++ Object-oriented: Severe encapsulation Inheritance: derive new types from old types Almost no risk of introducing bugs into old functionality

Quick overview of C++ Object-oriented: Severe encapsulation Inheritance: derive new types from old types Almost no risk of introducing bugs into base type’s functionality Derived type can be very small and easy to understand

Quick overview of C++ Object-oriented: Severe encapsulation Inheritance: derive new types from old types Almost no risk of introducing bugs into base type’s functionality Derived type can be very small and easy to understand Polymorphism: derived type can “override” key behavior of base type

Example: Shape Base type: SHAPE Derived Type: Circle Circle overrides function “draw” Derived Type: Polygon Derived Type: Square Square overrides function “draw” Derived Type: Triangle Triangle overrides function “draw”

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe:

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe: Programmer is careful to use exactly the right types for the job

Quick overview of C++ Object-oriented: Severe encapsulation Heavily type-safe: Programmer is careful to use exactly the right types for the job Programming consists of creating types. Once they are created, they do their job automatically.

Quick overview of C++ Object-oriented: Severe encapsulation Programming consists of creating types. Once they are created, they do their job automatically.

Quick overview of C++ Object-oriented: Severe encapsulation Programming consists of creating types. Once they are created, they do their job automatically. This allows for highly extensible, error-free code.

Quick overview of C++ The “main” loop usually consists of creating one or two objects, that’s all.

Quick overview of C++ The “main” loop usually consists of creating one or two objects, that’s all. It is a completely different way of programming than “structured” programming.

Quick overview of C++ The “main” loop usually consists of creating one or two objects, that’s all. It is a completely different way of programming than “structured” programming. The concept of “flow of control” is strictly avoided except at the lowest levels.

Quick overview of C++ Disadvantages: Takes a long time to program.

Quick overview of C++ Using the MatLab C++ library:

Quick overview of C++ Using the MatLab C++ library: Matlab is a “structured” programming environment.

Quick overview of C++ Using the MatLab C++ library: Matlab is a “structured” programming environment. C++ is an “object-oriented” programming environment.

Quick overview of C++ Using the MatLab C++ library: Matlab is a “structured” programming environment. C++ is an “object-oriented” programming environment. It is hard to make a library that works well for both MatLab and for C++ programmers.

Quick overview of C++ Using the MatLab C++ library: It is hard to make a library that works well for both MatLab and for C++ programmers.

Quick overview of C++ Using the MatLab C++ library: It is hard to make a library that works well for both MatLab and for C++ programmers. MatLab chose to create a simple interface, without any derived objects.

Quick overview of C++ Using the MatLab C++ library: It is hard to make a library that works well for both MatLab and for C++ programmers. MatLab chose to create a simple interface, without any derived objects. This allows MatLab programmers to use “structured” programming in C++, without utilizing object-oriented programming.

Quick overview of C++ Using the MatLab C++ library: It is hard to make a library that works well for both MatLab and for C++ programmers. MatLab chose to create a simple interface, without any derived objects. This allows C++ programmers to create their own object-oriented libraries to fully utilize object-oriented programming.

Quick overview of C++ Using the MatLab C++ library: My code is basically structural. It would take a long time to develop an effective object-oriented library using the simple base classes provided by MatLab.

Further Work to be Done: Add periodic boundary conditions Observe solitons