bil102 introduction to scientific & engineering computing

Post on 13-Dec-2015

219 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

BIL102

Introduction toScientific & Engineering Computing

Instructor

Nüzhet DalfesAssociate Professor

at theEurasian Institute of Earth Sciences

Also, Adviser to the Rector for Information Technologies

dalfes@itu.edu.tr285-3930 (x145)

Common informatics curriculum at ITU

Intro. to Computers and Information Systems

Intro. to Scientific and 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

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

BIL102

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

JavascriptYou are Section I:

Metallurgical Eng’g Food Eng’g

“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)

Working environment

Windows NT 4.0 Browser, etc.

F_WorldLinux

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

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!

Schedule

Wednesday 1400 - 170075 min. lecture

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

Out < 1645

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%]

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

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

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

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]

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.

Computer memory organization [cont’d]

Associated with each word or byte is an address

As far as the computer is concerned, instructions are data

How to tell a computer what to do?

0001101101010110 00011011010101100101101111010110 00011011110101101101101111010110 0111101111010110

MOV A, ACCMUL B, ACCADD C, ACC

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

Compiler

Source program(high level language)

Object program(machine language)

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

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

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

So, why Fortran?

Concise languageGood compilers producing efficient

machine codeLegacy: high-quality mathematical

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

for parallelization

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)…

Fortran 90:Link to the Past

Fortran 90/95 Fortran 77

All Fortran 77 programs will work with Fortran 90 compilers

The F language

F Fortran 90

F

Fortran 77

Fortran 90

The F language

Easy to learn to implement to understand

Powerful enough for use in large programs

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

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

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

top related