The Spectral Method

29
1 The Spectral Method

description

The Spectral Method. Definition. where (e m ,e n )= δ m,n. e n = basis of a Hilbert space (.,.): scalar product in this space. In L 2 space. where f * : complex conjugate of f. Discretization: limit the sum to a finite number of terms. - PowerPoint PPT Presentation

Transcript of The Spectral Method

Page 1: The Spectral Method

1

The Spectral Method

Page 2: The Spectral Method

2

Definition

mmm xettx )()(),( where (em,en)=δm,n

en= basis of a Hilbert space(.,.): scalar product in this space

L

dxeffe0

*),(In L2 space where f*: complex conjugate of f

Discretization: limit the sum to a finite number of terms

M

mmm xettx )()(),(

(consistent if the em’s are appropriately ordered)

Page 3: The Spectral Method

3

The Galerkin procedure• Linear case

• If em’s are eigenfunctions of H: Hem=λmem

)(),(

H

t

txH: linear space operator

RxetHxett

M

mmm

M

mmm

)()()()( R: discretization error

we assume R to be a function of the omitted em’s onlytherefore R is orthogonal to em (m ≤ M) (alternatively we minimize ||R||2)

M

m

M

mnnmmnm

m eReHeeedt

d),(),(),(

||δm,n dxHee mn

*|| ||

0

tnnn

n nedt

d

0

analytical solution (no need to discretize in t)

compute once and store

Page 4: The Spectral Method

4

One-dimensional linear advection equation

0

t

)()0,( f

periodic boundary conditions ),2(),( tnt

• Analytical solution

)(),( tft phase speed: γ=cte (rad/s)

• Basis functions: Fourier functions eimλ (eigenfunctions of ∂/∂λ)

2

0,2 nm

inim dee

M

Mm

imm ett )(),(

ω being a real field ==> ω-m(t)= ωm*(t); we need to solve only for 0≤m ≤M

• Galerkin procedure

Mmindt

tdn

n

0;0)(

this is a system of 2M+1 equations (decoupled) for the(complex) ωn coefficients

Page 5: The Spectral Method

5

One-dimensional linear advection equation (2)

• Exact solutiontin

nn et )0()(

ωn(0)

nγ/2π

- in physical space

M

m

timm

M

m

imtimm tfeeet )()0()0(),( )(

the same form as the analytical solutionno dispersion due to the space discretizationbecause the derivatives are computed analytically

Page 6: The Spectral Method

6

Calculation of the initial conditions• computation of ωm(0) given ω(λ,0)

- Direct Fourier transform

2

0

)0,()0( deA immm

where Am: normalization factor

- Inverse Fourier transform

m

immm etBt )(),(

Bm: normalization factors

• Discrete Fourier transforms

- Direct :

K

i

imimm

ieA1

' )()0(

- Inverse : M

m

immmi

ietBt )(),( '

Transformations are exact if K2M+1

Procedure: Fast Fourier Transform (FFT) algorithm

Products of two functions have no aliassing if K3M+1

Page 7: The Spectral Method

7

The linear gridUnfitted function

Fitted withquadraticgrid

Fitted withlineargrid

3M+1 points in λ ensure noaliassing in computations ofquadratic terms (case ofEulerian advection) Quadratic grid

2M+1 points in λ ensureexact transforms of linearterms to grid-point and backLinear grid

Page 8: The Spectral Method

8

Stability analysism

m imdt

d

• Leapfrog scheme

no need to discretizein time if we do nothave other terms in theequation

nm

nm

nm im

t

2

11

imnnm eWTry 0

Substituting and dividing by W(n-1)

1)(012 2222 tmtimWWtimW

11 tmW 1 W conditionally stable and neutral

- Comparison with finite differencesU0=RγM~N/2Δx=2πR/N

x

tUtM 0

1

0 x

tU

if using the quadratic grid M~N/3 ---->

2

30 x

tU

Page 9: The Spectral Method

9

Graphical representation

tt t

m

2

)( ttm )( ttm

)(tmtt

m

tt

tt

m

tt

Page 10: The Spectral Method

10

Non-linear advection equation

t

M

j

M

n

nnjjmm

M

m d

deeet

dt

d)(

M

m

immeF

2

= there are more wavenumbers on the r.h.s. than in the original function

Galerkin procedure

kk Ftdt

d )( k=0 …. M

therefore Fm m>M are not usedbut no aliassing produced because of misrepresentation

Page 11: The Spectral Method

11

Non-linear advection equation (cont)Calculation of Fk

• Interaction coefficients

M

j

M

nknjnjk eeeinF ),(

Ijnk ---> interaction coeff. matrixI is not a sparse matrix

• Transform method

M

nnn

M

n

nn eind

de

I. FFTf(λl); l=1, … L

M

jjje

g(λl); l=1, … LI. FFT

F(λl) = - f(λl)•g(λl) M

kkkeF

D. FFT

can be shown to have no aliassing if L 3M+1

Page 12: The Spectral Method

12

One-dimensional gravity-wave equations

conditionsperiodicboundaryinitial

Ht

h

hg

t

)(&

0

0

M

m

imm ett )(),(

M

m

imm ethth )(),(

• Galerkin procedure

kk

kk

Hkidt

dh

hgkidt

d

tgHikkk

k

tgHikkk

k

ehhgHhkdt

hd

egHkdt

d

02

2

02

2

2

no need to discretize in time

Page 13: The Spectral Method

13

One-dimensional gravity-wave equations (cont)

• Explicit time stepping (leapfrog)

nk

nk

nk

nk

nk

nk

tHikhh

tghik

2

211

11no need to transformto grid-point space

• Stability and dispersion (von Neumann method)

tnink

tnink

ehh

e

0

0assume

substituting: gHtkt 222 )()(sin

gHMtgHtMreal

11)( 22

gH

x

~smaller thanwith finitedifferences

gHtm

gHtm

mv f

)asin( dispersion due solely

to the time discretization

Page 14: The Spectral Method

14

One-dimensional gravity-wave equations (cont)

• Implicit time stepping

)(2

12

)(2

12

1111

1111

nm

nm

nm

nm

nm

nm

nm

nm

tHimhh

hhtgim 1nm substituting

)])(1(2[)(1

1 221122

1 gHtmhtHimgHtm

h nm

nm

nm

Decoupled set of equations because the basis functions eimλ are eigenfunctions of the space operator ∂/ ∂λ with eigenvalues im

• Stability and dispersion

using von Neumann we get

tanyforrealgHtmt 222 )()(tan stable

gHtm

gHtm

mv f

)atan( dispersion larger than

in leapfrog scheme

Page 15: The Spectral Method

15

Shallow water equations

conditionsperiodicboundaryandinitial

y

v

x

u

yv

xu

t

yfu

y

vv

x

vu

t

v

xfv

y

uv

x

uu

t

u

)(

0)(

0

0

Linearize about a basic state U0, V0, Φ0 and assume f=cte=f0 (f-plane approx)

),,('

),,('

),,('

0

0

0

tyx

tyxvVv

tyxuUu

substitute and neglect productsof perturbations

)''

('''

''

'''

''

'''

000

000

000

y

v

x

u

yV

xU

t

yuf

y

vV

x

vU

t

v

xvf

y

uV

x

uU

t

u

Page 16: The Spectral Method

16

Leapfrog (explicit) time schemeStability according to von Neumann

ilyimxtni

ilyimxtni

ilyimxtni

eee

eeevv

eeeuu

0

0

0

'

'

'

assume and substitute

0)(2

02

02

00000000

00000000

00000000

ilvimuilVimUt

ee

ilufilvVimvUt

eev

imvfiluVimuUt

eeu

titi

titi

titi

Page 17: The Spectral Method

17

Leapfrog (explicit) time scheme stability (cont)

0)sin(1

0)sin(1

0)sin(1

000000000

00000000

00000000

lvmulVmUtt

luiflvVmvUvtt

mvifluVmuUutt

or, calling ),,(~

000 vuZ

0~~~~)sin(

00

ZHZlVmUt

t

where

0

0

0~~

00

0

0

lm

lif

mif

H

Page 18: The Spectral Method

18

Leapfrog (explicit) time scheme stability (cont)

calling

lVmUt

t00

)sin(

0~

)~~~~

( ZIH

this system has non-trivial solutions if 0~~~~ IH

0)( 20

220

3 flm)(

0

220

20 lmf

for α to have a real solution

)sin( t )( 00 lVmUt 1

The most restrictive case is when )( 220

20 lmf which gives

)(

122

02

000 LMfLVMUt

Page 19: The Spectral Method

19

)(cos)(

0

2220

20 tlmf

Semi-implicit time scheme stabilityFollowing the same steps as in the explicit scheme we arrive at:

0)cos()cos(

)cos(0

)cos(0~~

00

0

0

tltm

tlif

tmif

H

therefore

])(cos)()[()sin( 2220

2000 tlmflVmUtt

if 00022

0 )()( flVmUlm

)()tan( 220 lmtt

LVMUt

00

1

Page 20: The Spectral Method

20

Spherical harmonicsOrthogonal basis for spherical geometry

immn

mn ePY )(),( m: zonal wavenumber

n: total wavenumber

λ= longitudeμ= sin(θ) θ: latitudePn

m: Associated Legendre functions of the first kind

)()(

0;)1()1(!2

1

)!(

)!()12()( 22/2

mn

mn

nmn

mnm

nmn

PP

md

d

nmn

mnnP

1

1,)()(

2

1sn

ms

mn dPP

2

0,2 lm

ilim dee

Page 21: The Spectral Method

21

Spectral representation

M

Mm

N

mn

mn

mn YtXtX ),(),(),,,(

n-|m|: effective meridional wavenumber

1

1

2

0

)(),,,(4

1),( ddePtXtX imm

nmn

spectral transform

Since X is a real field, Xn-m=(Xn

m)*

• Fourier coefficients

2

0

),,,(2

1),,( detXtX im

m direct Fourier transform

N

mn

mn

mnm PtXtX )(),(),,(

orinverse Legendretransform

Page 22: The Spectral Method

22

Some spherical harmonics (n=5)

Page 23: The Spectral Method

23

Spherical harmonics (cont)• Properties of the spherical harmonics

mn

mn imY

Y

eigenfunctions of the operator ∂/ ∂λ

mn

mn Y

a

nnY

22 )1(

eigenfunctions of the laplacian operatorsemi-implicit method leads to a decoupledset of equations

2/1

2

22

1112

14;)1()1(

n

mnYnYn

Y mn

mn

mn

mn

mn

mn

latitudinal derivatives easy to compute although the spherical harmonics are not eigenfunctions of the latitudinal derivative operator

Page 24: The Spectral Method

24

Spherical harmonics (cont.)• Usual truncations

N=min(|m|+J, K) pentagonal truncationM=J=K triangularK=J+M rhomboidalK=J>M trapezoidal

m

n

Mm

n

M

m

n

Mm

n

M

pentagonal triangular

rhomboidal trapezoidal

K=J=MK

K

K=J

J

J

Page 25: The Spectral Method

25

Gaussian gridUse of the transform method for non-linear terms

• Integrals with respect to λ ---> 3M+1 points equally spaced in λ

• Integrals with respect to μ computed exactly by means of Gaussian quadrature using the values at the points where

0)(0 GN

P Gaussian latitudes

In triangular truncation NG (3N+1)/2

Gaussian latitudes are approximately equally spacedsame spacing as for λ

Page 26: The Spectral Method

26

The reduced Gaussian grid

Full grid Reduced grid

• Triangular truncation is isotropic• Associated Legendre functions are very small when m is large and |μ| near 1

Page 27: The Spectral Method

27

The linear Gaussian gridQuadratic

gridLineargrid

Exact transformsto g.p. and back

Yes Yes

Alias-freecomputation ofquadratic terms

Yes No

Number ofdegrees offreedom

at least(3N+1)2/2

at least(2N+1)2/2

Ratio of degreesof freedomg.p. / spec

4.472at T213

2.at TL319

Gibbsphenomena

Yes Yesbut to a lesser

extent

Page 28: The Spectral Method

28

Two resolutions using the same Gaussian grid

T213 orography TL319 orography

Page 29: The Spectral Method

29

Diffusion0;2

KAKt

A

mn

mn A

a

nnK

t

A2

)1(

very simple to apply

2

24 )1(

a

nn

- Leapfrog

•Stability

01)1(

22

2

a

nntK

physical solution 0≤λ≤1 stablecomputational solution λ≤-1 unstable

- Forward

)1(

2

nKn

at

- Backward (implicit)

)()1()()(

2ttA

a

nnK

t

tAttA mn

mn

mn

decoupled system

of equations

2

)1(1

1

a

nntK

0≤λ≤1 Stable