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)
3L. 2 Basics 2 (Linux commands,
Compile,Visualize )
4Linux Basics
Desktops
- Graphics mode
- GNOME
- KDE
- XPde
- Text mode
- File system
- directory /bin /sbin /usr/bin
5Linux Basics
Internal Command Meaning Alias create an
alias bg jobspec background run for a job cd
directory change directories fg forground
run for a job find or locate help x help on
internal command x pwd display present
working directory set set a variable type
X return X command type Unalias errase an
alias Unset unset a variable
6Linux Basics
Command Meaning chmod change a document
protection cp copy ls Displays a list of
files in the current working directory
(like the dir command in DOS) passwd change the
password for the current user file
filename display file type of file with name
filename cat textfile throws content of
textfile on the screen exit or logout leave this
session man command read man pages on
command info command read Info pages on
command apropos string search the whatis database
for strings
More at http//www.ss64.com/bash/
7Programming Languages
- Fortran 77/90/95/2003
- C/C
- Pascal, TurboPascal
- Matlab, IDL, Scilab
- Maple, Mathematica
- Perl, Python
- Htlm, Java
- Excel ??
8Compiled Languages
- Developing a program in a compiled language
(fortran, C, C) requires at least four steps - editing (or writing) the program
- compiling it
- linking it
- executing it
- Visualize the results
9Compiled Languages
Editing You write a computer program with words
and symbols that are understandable to human
beings. This is the editing part of the
development cycle. You type the program directly
into a window on the screen and save the
resulting text as a separate file. This is often
referred to as the source file.
Compiling You cannot directly execute the source
file. To run on any computer system, the source
file must be translated into binary numbers
understandable to the computer's Central
Processing Unit (CPU). This process produces an
intermediate object file.
10Compiled Languages
- Linking
- Many compiled languages come with library
routines which can be added to your program.
Theses routines are written by the manufacturer
of the compiler to perform a variety of tasks,
from input/output to complicated mathematical
functions. - Linking options. Safest is static linking in
which case systemlibraries are loaded into
program. Dynamic linking expects to find specific
versions of system routines in specific
locations. -
- Executing
- Executable files (.exe) can be run simply by
typing their names ( at the DOS or UNIX prompt or
run using windows menu). - Executable files (.exe) can be run on many
machines that dont need to have Fortran or C
loaded.
11Compiled Languages
- Visualization
- Graphics must be done through external or user
written routines - Dataexplorer (DX)
- GMT (Generic Mapping Tool)
- DXFortran, PiLib
- GNUPlot, Pgplot, tecplot, mPlot
- xmgrace
- Amira
- IDE (Matlab, IDL, Scilab, )
12Interactive languages
- Ex Matlab, Scilab, IDL, FEMLAB
- Automatic compiling (into pseudocode) of user
subroutines. - User programs are developed as scripts
- Speed of modern processors makes this type of
approach reasonable. - Graphics and Graphical user interfaces (GUI) are
built into program - easy to debug
- --- users need to install the same version of
the software - Code can be often converted to C and compiled.
13Interactive symbolic languages
- Ex Maple, Mathematica
- Usually use to derive algorithms
- Can also generate results
- Built-in graphics
- Code and formula can be exported in word
processing languages (latex, word). - easy analysis of the equations. Symbolic
display - --- users need to install the same version of
the software
14Visualization
- Dataexplorer (DX)
- GMT (Generic Mapping Tool)
- Pgplot
- tecplot
- Amira
- IDE (Matlab, IDL, Scilab, Maple, etc..)