second year master programme - science.uu.nl project csgdelde102/soac numerical methods.pdf ·...

49
http://www.staff.science.uu.nl/~delde102/StudyAdvice_MPOC-master.htm Second year master programme Simulation of Ocean, Atmosphere and Climate (7.5 ec) Making, Analysing and Interpreting Observations (7.5 ec) Thesis Research Project (45 ec) (periods 2-4)

Upload: others

Post on 10-Jan-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

http://www.staff.science.uu.nl/~delde102/StudyAdvice_MPOC-master.htm

Second year master programme

Simulation of Ocean, Atmosphere and Climate (7.5 ec)Making, Analysing and Interpreting Observations (7.5 ec)

Thesis Research Project (45 ec) (periods 2-4)

Page 2: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

http://www.staff.science.uu.nl/~delde102/SOAC.htm

Simulation of Ocean, Atmosphere and Climate (SOAC)

week 36: lectures, invited talks & exercises

week: 37, 38, 39: project under supervision of IMAU-staf-member

(in couples)

week 40Thu. 2 Oct.: oral presentation of project

write a report (<3000 words)

Page 3: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Schedule: SOAC 2014 (http://www.staff.science.uu.nl/~delde102/SOAC.htm) Monday 1 September (MIN 025) 09:15-9:30: Aarnout van Delden: Introduction to the “research” year of the master program 09:30-10:15: Aarnout van Delden: Numerical Fluid Dynamics 1 10:30-12:15: Lars Tijssen: Introduction to Python 12:15-13:00: Aarnout van Delden: Introduction to Exercises 1(weather and climate of a simple recursive model) and 2 (Lagrangian model of the vertical motion of a buoyant fluid parcel) Afternoon: Working on exercise 1 and 2 Tuesday 2 September (MIN 205) Hand in answers to exercise 1 (individually) 09:15-09:45: Aarnout van Delden: Discussion of exercise 1 09:45-10:30: Aarnout van Delden: Numerical Fluid Dynamics 2 Rest of the day: Working on exercise 2 Wednesday 3 September (MIN 205) 09:15-10:00: Aarnout van Delden: Numerical Fluid Dynamics 3 10:15-11:00: Michael Kliphuis: Computer hardware and climate models 11:00-12:45 Sander Tijm: Hydrostatic and non-hydrostatic limited area models for weather prediction 13:30-14:15: Aarnout van Delden: Introduction to Exercise 3 (Solving the advection equation with different numerical schemes) Afternoon: Working on exercise 2 and 3 Thursday 4 September (MIN 205) Hand in answers to exercise 2 (individually) 09:15-10:15: Dewi Le Bars, Wim Ridderinkhof/Niels Alebregtse, Carles Penades/ Huib de Swart, Willem-Jan van den Berg, Anna von der Heydt, Rianne Giesen, Claudia Wieners and Aarnout van Delden: Overview of the projects 10:30-10:50: Aarnout van Delden: Discussion of exercise 2 10:50-11:15: Lars Tijssen: presentation (an extension of exercise 2) 11:30-13:15 Jordi Vila: Large Eddy Simulation Afternoon: Working on exercise 3 Friday 5 September (MIN 205) Hand in answers to exercise 3 (individually) 9:15-10:00: Aarnout van Delden: Discussion of exercise 3 10:15-11:15: Rein Haarsma: The atmosphere in EC-Earth 11:30-13:15: Dewi Le Bars: The ocean in CESM-climate model Finally: Who is who with the projects (couples)? Thursday 2 October (HFG 611AB) 9:15-12:00: Presentations of the results from the projects

Page 4: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Programming languages

FortranC/C++Pascal

MATLABPython

Page 5: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Programming languages

Advantages of Python over MATLAB:1) Python code is more compact and readable than Matlab code.

2) The Python world is free and open (in several senses).

3) Like C/C++, Java, Perl, and most other programming languages other than Matlab, Python conforms to certain de facto standards, including zero-based indexing and the use of square brackets rather than parentheses for indexing..

4) Python makes it easy to maintain multiple versions of shared libraries

5) Python offers more choice in graphics packages and toolsets

Page 6: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Pythonhttps://www.python.org/

http://www.numpy.org/

http://matplotlib.org/index.html

http://www.johnny-lin.com/pyintro/

Page 7: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

http://www.staff.science.uu.nl/~delde102/StudyAdvice_MPOC-master.htm

Master thesisFrom November/December you will need to find a

thesis project. Decide what you find interesting. Talk to potential thesis supervisors. It is also possible to do a

thesis project at KNMI, NIOZ or any other (foreign)university. However, next to the daily

supervisor at the other institute, you must always have a staff member of IMAU as second supervisor.

You must make clear arrangements about supervision and about what is expected of you. Independence

and originality are very much appreciated! At the start you have to fill in a “research application form”

Page 8: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Introduction to numerical fluid dynamics for geophysical flows

Anna von der HeydtAarnout van Delden

[email protected] BBL 615

Page 9: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

This visualization shows early test renderings of a global computational model of Earth's atmosphere based on data from NASA's Goddard Earth Observing System Model, Version 5 (GEOS-5). This particular run, called 7km GEOS-5 Nature Run (7km-G5NR), was run on a supercomputer, spanned 2 years of simulation time at 30 minute intervals, and produced Petabytes of output. The model uses a 7.5 km cube-sphere parameterization. Geographic coordinate output volumes from the model are 5760 x 2881 x 72 voxels per time step. For each voxel numerous physical parameters are available such as temperature, wind speed and direction, pressure, humidity, etc. This visualziation uses a combination of the CLOUD and TAUIR parameters.The visualization spans a little more than 7 days of simulation time which is 354 time steps. The time period was chosen because a simulated category-4 typhoon developed off the coast of China. The frames were rendered using Renderman. Brickmap volumes generated for each time step are about 2.6 Gigabytes. This short visualization referenced nearly a terabyte of brickmap files. The 7 day period is repeated several times during the course of the visualization.This animation was presented at SIGGRAPH 2014 during the Dailies session. (http://svs.gsfc.nasa.gov/vis/a000000/a004100/a004180/)

Page 10: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

http://www.gfdl.noaa.gov/visualization

Page 11: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

climate modellinghttps://www.youtube.com/watch?v=ADf8-rmEtNg

High resolution climate model outputhttps://www.youtube.com/watch?v=Cxsg7uvVSBE

Uncertainty in climate modelshttps://www.youtube.com/watch?v=4AjCeXl5tE0

Partial differential equationshttps://www.youtube.com/watch?v=fYVMmEykiMw

Cloud model outputhttps://www.youtube.com/watch?v=mlvLX7YvI88

Ocean modellinghttps://www.youtube.com/watch?v=B-TSwthjPYE

GFDL visualizationhttp://www.gfdl.noaa.gov/visualization

Animations and lectures

Page 12: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Earth system models

NCAR Community Earth System Model (CESM)

Page 13: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Atmosphere grid box: wind vectors, humidity, clouds, temperature, chemical species.

Surface: ground temperature, water, energy, momentum, CO2 fluxes.

Ocean grid box: current vectors, temperature, salinity.

General circulation models (GCMs)

Page 14: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Resolution in IPCC simulations(IPCC 1990)

(IPCC 1996)

(IPCC 2001)

(IPCC 2008)

Page 15: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Spin up•  Spin up time =

integration time, the model needs to reach a (statistical) equilibrium.

• Depends on the slowest component of the modelled climate system:

•  Atmosphere ~ 15 years.•  Ocean ~ 3000 years.•  Ice sheets ~ even longer.

Page 16: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

How to build a numerical model for a fluid system?���

(air or water)Recommended books:

Benoit Cushman-Roisin, Jean-Marie Beckers, Introduction to Geophysical Fluid Dynamics - Physical and Numerical Aspects. 2nd Edition, Academic Press (2011) (chapters 5 & 6)

Dale R. Durran, Numerical Methods for Fluid Dynamics – With applications to geophysics, 2nd Edition, Springer (2010)

Page 17: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

SHALLOW-WATER EQN’S(the “e-coli” of Geophysical Fluid Dynamics)

Page 18: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

characteristics

solution

what about boundary conditions?

ADVECTION EQUATION

Page 19: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

FINITE DIFFERENCE

stencil

forward

backward

central

Page 20: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

ACCURACYTaylor expansion

truncation error

the lowest order of in the truncation error determines the accuracy

finite difference approximation exact

Page 21: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

ACCURACYtruncation error

the lowest order of in the truncation error determines the accuracy

Page 22: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Lecture 2

Page 23: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Grading

Exercises 1-3 + attendance first week: 20% of grade

Oral presentation: 40%Written report: 40%

Page 24: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

ADVECTION EQUATION

truncation errorcomputer sets this to zero

notation:

this scheme is first-order accurate in time and space

Page 25: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

ADVECTION EQUATION

truncation error

numerical diffusion numerical dispersion

∂ 2u∂t2

= −c ∂∂t

∂u∂ x

= −c ∂∂ x

∂u∂t

= −c2 ∂2u

∂ x2

Page 26: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STABILITYVon Neumann’s Method

insert Fourier series to represent the discretized solution

at

at

note that

amplification factor

stable if

(page 96 Durran)

Analysis is restricted to linear equations, implying that amplification does not vary from time step to time step

Page 27: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STABILITYinsert

rewriting

for every

most unstable modealways unstable

euler forward / downwind

Page 28: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STABILITYinsert

rewriting

for every

most unstable mode

euler forward / upwind

stable if Courant Frederich Lewy condition

Page 29: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

CFL CONDITION

euler forward / upwindeuler forward / downwind

always unstable Courant Frederich Lewy condition

unstablestable

Page 30: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

IMPLICIT SCHEMEinsert

euler backward / upwind

unconditionally stable!

advantage: we can take large time steps

but 1: accuracy determines time step

but 2 : implicit schemes are harder / impossible to solve

in general form Euler forward Euler backward

Page 31: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

DIFFUSION EQUATION

The finite difference approximation for the second derivative

Page 32: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

DIFFUSION EQUATION

euler forward / central difference

accuracy and

stability

condition

Page 33: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

MATSUNO SCHEMETime differencing:

C * jn+1 −Cj

n

Δt= u0

∂C∂x% & '

( ) * j

n

Cjn+1 −C j

n

Δt= u0

∂C *∂x

% & '

( ) * j

n+1

Step 1

Step 2

∂C∂t

= −u0∂C∂x

Page 34: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Lax-Wendroff schemeA well-known finite difference scheme:

Taylor series:

Since€

Cjn+1 =Cj

n +Δt ∂C∂t

$ % &

' ( ) j

n+Δt2 ∂

2C∂t2$

% &

'

( ) j

n

+ ...

∂2C∂t2

= u02 ∂

2C∂x2

Cjn+1 =Cj

n − u0Δt∂C∂x% & '

( ) * j

n+u02Δt2

2∂2C∂x2%

& '

(

) * j

n

+ ...

∂C∂t

= −u0∂C∂x

Page 35: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Lax-Wendroff scheme

Cjn+1 =Cj

n − u0Δt∂C∂x% & '

( ) * j

n+u02Δt2

2∂2C∂x2%

& '

(

) * j

n

+ ...

which becomes:

Cjn+1 −Cj

n

Δt≈ −u0

Cj+1n −Cj−1

n

2Δx

%

& ' '

(

) * * +

u02Δt2

Cj+1n − 2Cj

n +Cj−1n

2Δx

%

& ' '

(

) * *

∂C∂t

= −u0∂C∂x

central difference central difference

Page 36: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Spectral method

x j = jΔx, j =1,2,...,N, where NΔx = L.

Set of uniformly spaced grid points in one dimension

The Fourier series of C, whoose values are given only at N grid points, requires N Fourier coefficients. The Fourier expansion of C is

C x j( ) = Ck exp 2πikx j /L( )k=1

N∑ = Ck exp 2πikjΔx / NΔx( )( )

k=1

N∑ = Ck exp 2πikj /N( )

k=1

N∑

Ck are the Fourier coefficients. The inverse of this equation yields the complex Fourier coefficients from the grid point values:

Ck =1N

C x j( )j=1

N∑ exp −2πikj /N( ) (2)

Page 37: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Spectral methodFor the periodic domain, L, the time-dependent distribution of C can be expressed as

Substituting this equation into the linear advection equation (1) yields N independent first order ordinary differential equations :

At initial time, t=0, we need to compute the complex Fourier coefficients from eq. 2 and then integrate the system (3) in time, implying that we need only to numerically approximate the time derivative. Note that since the Fourier coefficients are complex, (3) represents a system of 2N equations

C x,t( ) = Ck t( )exp 2πikx /L( )k=1

N∑

dCkdt

= −2πiu0kL

Ck for k =1,2,...,N

∂C∂t

= −u0∂C∂x

(1)

(3)

Page 38: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Lecture 3

Page 39: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

1D SHALLOW-WATER EQN’S

assume wave solution

dispersion relation

phase velocity

group velocity

Page 40: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

WAVE ON A GRID: aliasing

long wave

short wavelimit

aliasing

Page 41: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

1D SHALLOW-WATER EQN’S

only spatial discretization

assume wave solution

dispersion relation

phase velocity

group velocity

long wave short wave limit

(linear, non-rotational, inviscid)

cg* =

dωdk

= ± gH cos(kΔx)

Page 42: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

LEAP-FROG SCHEME

centered in time & centered in spacestencil

grid waves2 decoupled grids

u,h

u,h

u,h

u,h u,h u,h u,h

u,h u,h u,h

u,h u,h

u,h

u,h

u,h

u,h

u,h

u,h u,h u,h

u,h

u,h

u,h

u,h

u,hu,h

u,h

Page 43: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

LEAP-FROG SCHEME

centered in time & centered in spacestencil

no grid wavesstaggered grid

h h

u u u u

u u u

h h

u

h

h

h

h

u u u

h

u

h

hh

hh h

two times faster (but also coarser)

Page 44: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

Dispersion relation• Numerical phase speeds

cu* =

ωk

=c

kΔxsin(kΔx)

cs* =

ωk

=2c

kΔxsin(

kΔx2

)

u = unstaggered grid s = staggered grid

Page 45: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

2D SHALLOW-WATER EQN’S(linear, inviscid)

assume wave solution

dispersion relation

spatial discretization

again: short waves have too small phase velocity and a group velocity in the wrong direction

Page 46: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

2D SHALLOW-WATER EQN’S(linear, inviscid)

assume wave solution

dispersion relation

short waves are gravity waves

long waves are inertial oscillations

Page 47: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STAGGERED GRIDSArakawa Aunstaggered

Arakawa B Arakawa C

h hh

v

interpolation

u* u*

v*

v*

uh

Page 48: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STAGGERED GRIDSArakawa Aunstaggered

Arakawa B Arakawa C

h

u

v

interpolation

u u uh* h*

v*

Page 49: Second year master programme - science.uu.nl project csgdelde102/SOAC numerical methods.pdf · frames were rendered using Renderman. Brickmap volumes generated for each time step

STAGGERED GRIDS

medium

coarse

fineArakawa B grid

Arakawa C - grid

True solution