23
Projektübung Klimamodellierung André Paul

Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Embed Size (px)

Citation preview

Page 1: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Projektübung Klimamodellierung

André Paul

Page 2: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Vorbesprechung

Projektübung Klimamodellierung (05-3034) – A. Paul

Page 3: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Veranstaltungsdaten

• Veranstaltungskennziffer: 05-3034

• ECTS-Punkte: 2.5

• 2 SWS, Mi von 13:00-15:00, GEO 1480/90

Page 4: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Website

• http://www.palmod.uni-bremen.de/~apau/

projektuebung/Material_zur_LV.html

Page 5: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Inhalt

• Einführung in die wissenschaftliche Programmierung anhand einfacher Beispielprogramme und ihrer schrittweisen Veränderung

• Beschreibung des Klimasystems mit Hilfe von Erhaltungsgleichungen

• Zeitliche und räumliche Diskretisierung von Erhaltungsgleichungen

• Numerische Lösung diskretisierter Erhaltungsgleichungen auf einem Computer

• Numerische Experimente mit physikalischen Ozean- und Atmosphärenmodellen

Page 6: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Ziel

• Einführung in die Methoden der

Klimamodellierung und deren praktische

Anwendung (weg vom Klimamodell als

"black box")

Page 7: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Bewertung

• Anforderungen: selbstständige Lösung

von Übungsaufgaben auf dem Computer

(während der Übung/im Computerraum)

• Referat

Page 8: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Literatur

• Stocker, T (2005) Skript zur Vorlesung

„Einführung in die Klimamodellierung“, 141

Seiten, PDF (16 MB), korrigierte Version

15.2.2005

– http://www.climate.unibe.ch/

~stocker/papers/skript0405.pdf

Page 9: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

• Verwendung von MATLAB o. ä. freigestellt

• Schleifen, Lesen und Schreiben von

Dateien, usw.

Einführung in die wissenschaftliche Programmierung mit Fortran 90

Page 10: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Reading

• The following notes are based on

– Ellis, T.M.R., Phillips, Ivor R., and Lahey,

Thomas M.: Fortran 90 Programming,

Addison-Wesley Publishing Company.

Page 11: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Telling a Computer What To Do

• To get a computer to perform a specific task it must be given a sequence of unambiguous instructions or a program.

• Generating a program:

1. Text file with instructions (Source Code; Fortran 90)

2. Translation into computer-compatible form (Compiler)

3. Executable Program

Page 12: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

The Linux look and feel

• Cygwin is a Linux-like environment for Windows that consists of two parts:

– A DLL (“Dynamic Link Library”, cygwin1.dll)

– A collection of tools, which provide Linux look and feel

• Link: http://www.cygwin.com

Page 13: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

A few useful Linux commands

• pwd – print name of current/working directory

• ls – list directory contents

• cd – change directory

• mkdir – make directories

• rm – remove files or diretories

• man – format and display the on-line manual pages (e.g. man pwd)

Page 14: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

How to start cygwin

• Open cygwin window by double-clicking on the start_cygwin DOS batchfile provided with this exercise

• If this does not work ...

Page 15: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Creating and Running a Program

• Invoke the editor from the Start menu, or type

notepad hello.f90 &

into the cygwin window to create a file called hello.f90.

Page 16: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Creating and Running a Program

•Type the following source code:

•Compile by typing g95 hello.f90 (in the cygwin window)

•Run the program by typing ./a.exe (g95 by default creates an executable called a.exe)

PROGRAM firsttry

PRINT *,“hello“

END PROGRAM firsttry

Page 17: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Basic Fortran 90 concepts

• All words which have a special meaning in

Fortran are known as keywords.

• Every main program unit must start with a

PROGRAM statement which consists of the

word PROGRAM followed by the name of

the program as given by the programmer.

Page 18: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Avoid implicit declaration

• The special IMPLICIT NONE statement

should always be placed immediately after

the PROGRAM statement. It instructs the

compiler that all variables must be

declared before use.

Page 19: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Basic building blocks

• A main program unit:

PROGRAM hydrostatic_balance IMPLICIT NONE

! Parameter declarations

! Variable declarations

! Executable statements

END PROGRAM hydrostatic_balance

Page 20: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

REAL and INTEGER variables

• Use the INTEGER :: name statement to

declare a whole-number variable

• Use the REAL :: name statement to

declare a floating-point variable

! Variable declarations! k = loop variable! p = pressure (Pa)! dp = pressure change (Pa)INTEGER :: kREAL :: p,dp

Page 21: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Repeating parts of your program

! Loop over vertical levelsDO k=1,101 ! Block of statements p = p + dpEND DO

Page 22: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Using files to preserve data

• Connecting external files to your program

– Connect a file to a unit by

OPEN(UNIT=unit_number,FILE=file_na

me), where unit_number is an integer

number, variable or parameter and

file_name is a character expression.

Page 23: Projektübung Klimamodellierung André Paul. Vorbesprechung Projektübung Klimamodellierung (05-3034) – A. Paul

Using files to preserve data

– Write a record to a file by WRITE (UNIT=unit_number,FMT=*)

– Disconnect a file from a unit by means of a

CLOSE (UNIT=unit_number) statement