bil102 introduction to scientific & engineering computing

34
BIL102 Introduction to Scientific & Engineering Computing

Upload: jordan-perry

Post on 13-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: BIL102 Introduction to Scientific & Engineering Computing

BIL102

Introduction toScientific & Engineering Computing

Page 2: BIL102 Introduction to Scientific & Engineering Computing

Instructor

Nüzhet DalfesAssociate Professor

at theEurasian Institute of Earth Sciences

Also, Adviser to the Rector for Information Technologies

[email protected] (x145)

Page 3: BIL102 Introduction to Scientific & Engineering Computing

Common informatics curriculum at ITU

Intro. to Computers and Information Systems

Intro. to Scientific and Engineering Computing

Page 4: BIL102 Introduction to Scientific & Engineering Computing

Intro. to Computers and Information Systems

A first introduction to the world of computers

Basic skills in using computers for communication and computing

Basic skills for efficient use of information systems: Internet Library systems

Page 5: BIL102 Introduction to Scientific & Engineering Computing

Intro. to Scientific and Engineering Computing

Basic skills for scientific/engineering problem solving using computers: Data structures and algoritms

Programming skills in a (standard) language

Skills for integrating the ‘computing chain’:Analyze Program Run Visualize

Page 6: BIL102 Introduction to Scientific & Engineering Computing

BIL102

Taught in three versions: Fortran 90 C Combo = Fortran 90 + C + Java +

JavascriptYou are Section I:

Metallurgical Eng’g Food Eng’g

Page 7: BIL102 Introduction to Scientific & Engineering Computing

“Intranet-assisted” course:

Everything (almost) will be available at the Web site

It is imperative that you should have an e-mail address and be comfortable with a browser

(Internet Explorer or Netscape) Register yourself to HIM

(Homework Information System)

Page 8: BIL102 Introduction to Scientific & Engineering Computing

Working environment

Windows NT 4.0 Browser, etc.

F_WorldLinux

Text editor (pico) Compiler (F ) Mail (pine)

Page 9: BIL102 Introduction to Scientific & Engineering Computing

IMPORTANT

What you will be reading on this screen will always be available at the Web site

Taking notes: it’s up to you to decide!

Page 10: BIL102 Introduction to Scientific & Engineering Computing

Schedule

Wednesday 1400 - 170075 min. lecture

+ 15 min. break+ 75 min. lecture/demo…

Out < 1645

Page 11: BIL102 Introduction to Scientific & Engineering Computing

Requirements

Homework assignments [20% = 10 x 2%] Every week (except the first one) Pick it up from to Web site; turn it in by HIS Due the end of week after. Quizes [40% = 4 x 10%] 5 quizes in total [randomly distributed!] On paper (for the moment!)

Final [40%]

Page 12: BIL102 Introduction to Scientific & Engineering Computing

How do we use computers in science and engineering?

To organize and analyze data Excel, Access, ...

To understand the implications of a model of (i.e. to simulate) a natural or human-made system

Page 13: BIL102 Introduction to Scientific & Engineering Computing

Simulation of natural/artificial systems

Build a conceptual quantitative model (most of the time, write down the appropriate equations)

Formulate a solution to these equations using numerical methods Data structures + algorithms

Program these data structures and algorithms in a language

Run the program and analyze its output using visualization techniques

Page 14: BIL102 Introduction to Scientific & Engineering Computing

A brief history of computing machines Early computing devices

1822: Charles Babbage - Difference Engine - Analytical EngineAda Augusta - the first programmer

1944: Mark I, an electromechanical computer Electronic computers First generation - vacuum tubes

1946: ENIAC - Electronic Numerical Integrator and Computer UNIVAC - Universal Automatic Computer

Second generation [1959-1965]: transistors 1958: IBM 7090 1963: PDP-8, the first minicomputer

Third generation [‘60-’70]: integrated circuits 1964: IBM System/360 Fourth generation: VLSI

Page 15: BIL102 Introduction to Scientific & Engineering Computing
Page 16: BIL102 Introduction to Scientific & Engineering Computing
Page 17: BIL102 Introduction to Scientific & Engineering Computing
Page 18: BIL102 Introduction to Scientific & Engineering Computing
Page 19: BIL102 Introduction to Scientific & Engineering Computing

Computing systems

Central processing unit (CPU) [ has registers]

Memory (these days, RAM, Random Access Memory]

Input/Output units: video card+monitor, keyboard, etc.

Storage units [disks]

Page 20: BIL102 Introduction to Scientific & Engineering Computing

Computer memory organization

Units of measure Basic unit: bit 8 bits = 1 byte 1024 bytes = 1 Kbyte or 1 K 1024 K = 1 Megabyte or 1 M

CPU registrers, RAM, ROM [Read-Only Memory]

n bytes = 1 word (n=4, 8, etc.) 1 word = 32 bits, or 64 bits, etc.

Page 21: BIL102 Introduction to Scientific & Engineering Computing

Computer memory organization [cont’d]

Associated with each word or byte is an address

As far as the computer is concerned, instructions are data

Page 22: BIL102 Introduction to Scientific & Engineering Computing

How to tell a computer what to do?

0001101101010110 00011011010101100101101111010110 00011011110101101101101111010110 0111101111010110

MOV A, ACCMUL B, ACCADD C, ACC

Page 23: BIL102 Introduction to Scientific & Engineering Computing

How do we tell these days a computer what to do?

Compiler

Source program(high level language)

Object program(machine language)

Page 24: BIL102 Introduction to Scientific & Engineering Computing

Software in Science & Engineering

[Ready-made] Analysis and simulation environments

Custom-made programs [codes] You (or your team) write (program)

them from scratch Legacy codes: you have to

understand and modify them

Page 25: BIL102 Introduction to Scientific & Engineering Computing

Programming in the ‘90’s:

Structured programming of the ‘70’s Pascal + C + Fortran 77 + Ada + ...

Object-oriented programming of the ‘80’s Smalltalk + C++

‘90’s Java + Fortran 90/95

Page 26: BIL102 Introduction to Scientific & Engineering Computing

A brief history of Fortran

FORTRAN = FORmula TRANlationJohn Backus + 13 programmers at

IBM for IBM 704 [1954-1957]Other manufacturers developped

FORTRAN for their machinesPortability = standards!Fortran 66 Fortran 77 Fortran

90 Fortran 95 Fortran 2000

Page 27: BIL102 Introduction to Scientific & Engineering Computing

So, why Fortran?

Concise languageGood compilers producing efficient

machine codeLegacy: high-quality mathematical

libraries (IMSL, NAG, …) availableNew version have features helpful

for parallelization

Page 28: BIL102 Introduction to Scientific & Engineering Computing

Software

Operating system UNIX Open Systems MS DOS MS Windows 3.1 MS Windows 95 MS

Windows NT

Graphical User Interfaces MS Windows X Windows

Utilities: Editors, etc. Integrated Development Environments (IDE)…

Page 29: BIL102 Introduction to Scientific & Engineering Computing

Fortran 90:Link to the Past

Fortran 90/95 Fortran 77

All Fortran 77 programs will work with Fortran 90 compilers

Page 30: BIL102 Introduction to Scientific & Engineering Computing

The F language

F Fortran 90

F

Fortran 77

Fortran 90

Page 31: BIL102 Introduction to Scientific & Engineering Computing

The F language

Easy to learn to implement to understand

Powerful enough for use in large programs

Page 32: BIL102 Introduction to Scientific & Engineering Computing

program Radioactive_Decay!----------------------------------------------------------------------------! This program calculates the amount of a radioactive substance that ! remains after a specified time, given an initial amount and its ! half-life. Variables used are:! InitalAmount : initial amount of substance (mg)! HalfLife : half-life of substance (days)! Time : time at which the amount remaining is calculated (days)! AmountRemaining : amount of substance remaining (mg)!! Input: InitialAmount, HalfLife, Time! Output: AmountRemaining!-----------------------------------------------------------------------------

implicit none real :: InitialAmount, HalfLife, Time, AmountRemaining

! Get values for InitialAmount, HalfLife, and Time.

print *, "Enter initial amount (mg) of substance, its half-life (days)" print *, "and time (days) at which to find amount remaining:" read *, InitialAmount, HalfLife, Time ! Compute the amount remaining at the specified time. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife)

! Display AmountRemaining. print *, "Amount remaining =", AmountRemaining, "mg"

end program Radioactive_Decay

Page 33: BIL102 Introduction to Scientific & Engineering Computing

program Radioactive_Decay!----------------------------------------------------------------------------! This program calculates the amount of a radioactive substance that ! remains after a specified time, given an initial amount and its ! half-life. Variables used are:! InitalAmount : initial amount of substance (mg)! HalfLife : half-life of substance (days)! Time : time at which the amount remaining is calculated (days)! AmountRemaining : amount of substance remaining (mg)!! Input: InitialAmount, HalfLife, Time! Output: AmountRemaining!-----------------------------------------------------------------------------

implicit none real :: InitialAmount, HalfLife, Time, AmountRemaining

! Get values for InitialAmount, HalfLife, and Time.

print *, "Enter initial amount (mg) of substance, its half-life (days)" print *, "and time (days) at which to find amount remaining:" read *, InitialAmount, HalfLife, Time ! Compute the amount remaining at the specified time. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife)

! Display AmountRemaining. print *, "Amount remaining =", AmountRemaining, "mg"

end program Radioactive_Decay

Page 34: BIL102 Introduction to Scientific & Engineering Computing

program Radioactive_Decay!----------------------------------------------------------------------------! This program calculates the amount of a radioactive substance that ! remains after a specified time, given an initial amount and its ! half-life. Variables used are:! InitalAmount : initial amount of substance (mg)! HalfLife : half-life of substance (days)! Time : time at which the amount remaining is calculated (days)! AmountRemaining : amount of substance remaining (mg)!! Input: InitialAmount, HalfLife, Time! Output: AmountRemaining!-----------------------------------------------------------------------------

implicit none real :: InitialAmount, HalfLife, Time, AmountRemaining

! Get values for InitialAmount, HalfLife, and Time.

print *, "Enter initial amount (mg) of substance, its half-life (days)" print *, "and time (days) at which to find amount remaining:" read *, InitialAmount, HalfLife, Time ! Compute the amount remaining at the specified time. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife)

! Display AmountRemaining. print *, "Amount remaining =", AmountRemaining, "mg"

end program Radioactive_Decay