Title: Introduction to scientific programming in Earth's Sciences
1Introduction to scientific programming in Earth's
Sciences
J.W. Goethe University. Frankfurt
- Dr Guillaume RICHARD
- Institüt für Geowissenchaften 1.232
- richard_at_geophysik.uni-frankfurt.de
2Overview
- 12 x 45min Lectures / 45min training classes
(praktical) -
- Basics (Hardware, OS, editor, etc.. )
- Basics 2 (Linux commands, Compile,Visualize )
- Languages Fortran (FORmula TRANslation)
- Languages Fortran (2)
- Languages Fortran (3)
- Languages Fortran (4)
- Languages C/C
- Languages Matlab (1)
- Languages Matlab (2)
- Languages Maple
- Introduction to Finite difference / Finite Volume
method - Introduction to Finite difference / Finite Volume
method (2)
3Basics
1. Problem. Clearly and unambiguously identify
the problem to be solved.
2. Model. Use simplification and abstraction to
arrive at a mathematical model for the problem.
3. Method. Identify a computational method for
solving the model.
4Basics
4. Implementation. Implement the method in the
appropriate language.
5. Assessment. Concurrently with the other four
steps, actively assess the problem-solving
process to identify mistakes and unwarranted
assumptions.
5Basics
6. Visualisation.
7. Optimisation. Parallelization. Vectorization.
6Basics
Hardware
CPU - Central Processor Unit RAM - Random Access
Memory VRAM - Video RAM ROM -Read Only Member
IO Input/Output. HD Hard Disk CDROM Compact
Disk Read-only-memory CD-RW DVD Read/Write
7Basics
Jargon and Fundamentals of Computer
- Computers have only 2 fingers. A bit 0 or
1(false/true) - CPU basically only knows how to perform AND,
OR, XOR (exclusive OR) operations - AND returns true if both same
- OR returns true if either true
- XOR returns true if different
- CPU is a massive collection of AND and OR gates
(transistors) - A specific CPU has a set of instructions it can
execute (usually small 50-100) (Machine language)
8Basics
Jargon and Fundamentals of Computer
- theclock speed the number of instructions
per seconds. e.g, 500 MHz - a cycle One clock tick. Modern CPUs can
execute more than one instruction per cycle - All programming ultimately ends up as a set of
instructions to executed by the CPU
(compiling/linking or interpreter do this for
you). - flops unit to mesure Floating point speed
floating point operations per seconds. - byte group of 8 bits
- word group of 2/4/8 bytes (depends on the
CPU). New machines have 64 bits (8bytes)
architecture.
9Basics
Jargon and Fundamentals of Computer
Number of unique values that can be represented
depends on number of bits. ex For n bits,
unique values are 0 to 2n-1 Grouped into larger
units to represent different things ex ASCII
(American Standard Code for Information
Interchange) Basic version is 7 bit (128
characters) A-Z, a-z, 0-9 and special
characters Values lt32 are control characters
10Basics
Jargon and Fundamentals of Computer
- Numbers representation depends on the base system
used - Binary base 2 (0-1), Octal base 8 (0-7)
- Hexadecimal base 16 (0-15, with A-F representing
10-15) - ex 543666110110
- Prefixes kilo 1024 mega1048576giga107377418
24 (approximately 103,106,109) - integer (2/4-bytes)
- Real (floating point) IEEE 4-byte floating
point is 8bit exponent, 24bit mantissa (1 sign
bit for each), 7 significant digits, range 1038
ex 541036166681101102
ex 2-byte unsigned 0-65535, signed 32767
11Basics
Jargon and Fundamentals of Computer
BIOS (Basic Input/Output System) A program
built into every PC for setting up very basic
things (ex how many hard and floppy disks) the
first thing that loads when you start your PC.
12Basics
Operating System (OS)
- Windows (3.0, 3.1, NT, 95, 98, Millenium, 2000,
XP, Vista, etc)
- Macintosh ( System sofware (1-7), Classic Mac
OS 8-9 , Mac OS X)
- UNIX (Bourne shell, the (T)C shell, Kornshell,
Z-shell, etc)
- Linux (bash Debian, RedHat/Fedora, Suze, Ubuntu,
etc)
13Basics
Operating System (OS)
- Controls everything in the way the computer
works. - Not Specific to a CPU type but often some OSs are
associated with specific CPU - OS controls IO and memory management (latter is
important in multi-tasking OS). - Specific program implementations are often
dependent on OS
14Basics
Editors
- Text editor (Notepad) vs word processor (Word,
open office) - UNIX (Vi(m), (X)emacs, E, Nedit, TextEdit, gedit)
- Specific editors
- HyperTextMarkupLanguage (HTML) DreamWeaver,
Frontpage, Seamonkey, Mozzila composer, GoLive - Java Eclispse
- Fortran Xemacs, Kedit, Tidy (Clean up Fortran
77 code), Melite, Magic Editor, Neoxen,
Understand for FORTRAN (Scitools), Visual
Fortran, etc - Integrated Development Environment (IDE), Matlab,
scilab, IDL, etc
15Programming Languages
- Fortran 77/90/95/2003
- C/C
- Pascal, TurboPascal
- Matlab, IDL, Scilab
- Maple, Mathematica
- Perl, Python
- Htlm, Java
- Excel ??