numerics for geofluid dynamics

numerics for geofluid dynamics

numerics for geofluid dynamics


M. D.
This flashcard set delves into the numerical methods used in geophysical fluid dynamics at a university level, focusing on schemes like Euler, leap-frog, and Heun for solving equations. It covers topics such as grid types, stability, accuracy, and the application of these methods to wave equations and shallow water equations. The set is particularly useful for students and researchers in fluid dynamics who need to understand the implementation and implications of various numerical schemes in modeling fluid behavior.
Flashcards
41
Students
1
Language
English
Category
Physics
Level
University
Created / Updated
21.07.2018 / 25.07.2018

Flashcards

Discuss the graphics for the choose of grid for the linearised shallow water equations without friction!  

The linearized shallow water equations or the gravity-inertia wave equations are:

\(\frac{\partial u}{\partial t}-fv=-g\frac{\partial h}{\partial x}\\ \frac{\partial v}{\partial t}+fu=-g\frac{\partial h}{\partial y}\\ \frac{\partial h}{\partial t}+H(\frac{\partial u}{\partial x}+\frac{\partial v}{\partial y})=0\)

 

If we consider solutions in wave form than we obtain:

\(.\\\omega^2=f^2+gH(k^2+l^2)\)

For each of the three grids we use the simplest centred approximations for the space derivative and the Coriolis terms.

If we substitute the wave solution into the numerical schemes we get the frequency equations. This are basically dependent of two paramters: \(k\Delta x\) and \(gH/f^2\) (Rossby Radius to the square)

The equations are not shown but discussed with the following graphic:

Grid A:

  1. The frequency reaches a maximum at  \(k\Delta x=\pi/2\) , i.e. a wave length of 4 grids. The group velocity for this wave length is zero, which means the wave energy stays near that point. 
  2. For \(\pi/2 < k \Delta x < \pi\)the frequency decreases as the wave number increases. Thus, the group velocity vector has the wrong sign. 
  3. For the two-grid-interval wave (\(k\Delta x=\pi\)) the group velocity vector is again zero. 

Grid B:

  1. The frequency increases monotonically. 
  2. Reaches a maximum for \(k\Delta x=\pi\) . There the group velocity is again zero. 

Grid C: 

  1. The frequency increases monotonically in a similiar way to the one for the B-grid, when the Rossby Radius is longer than a half grid (\((\sqrt{(gH)/f}> \frac{\Delta x}{2})\) .
  2. If the Rossby-Radius resolution fall beneath that, then the frequency will decrease for increasing wavenumber throughout \(0< k\Delta x <\pi \)
  3. The big advantage of the C-grid: Velocities are perpendicular on the walls of the grid-box, which makes differentiating straightforward. 

Taylor Series. 

Taylor series of f(x) at the point a:

\(Tf(x;a)=\sum^{\infty}_{n=0}\frac{f^{(n)}(a)}{n!}(x-a)^n\)

Which method is typically used for the numerical solution of differential equations?

The grid point method

Consistency: What is it? 

  • A numerical scheme needs to be above all consistent.
  • This means that the approximation should approach the derivative when the grid interval approaches zero. 
  • For a consistent scheme the truncation error needs to be at least of order one. 

What is the truncation error?

The truncation error gives a measure of how accurately the difference quotient approximates the derivative for small values of \(\Delta x\).

The usual measure of this is the order of accuracy. This is the lowest power of \(\Delta x\) that appears in the truncation error. 

How is the algebric equation, obtained by replacing derivatives with finite difference approximations, called?

finite difference approximation or finite difference scheme. 

 

What is the error of a numerical solution?

The difference between the numerical and the true solution. 

\(u_j^n-u(j\Delta x,n\Delta t)\)

Most of the time we cannot find the error of the solution. However, we can always find a meassure of accuracy. 

What is Convergence? A consistent scheme does not need to be convergent. Why?

The truncation error of a consitent scheme can be made abitrarily small by a suffiecient reduction of the increments \(\Delta x\;and\;\Delta t\).

Although, this cannot be expected for the error of the numerical solution: \(u^n_j-u(j\Delta x, n \Delta t)\)

Definition: If the error of the numerical solution approaches zero as the grid is refined, the solution is called convergent. If this holds for any initial conditions, than the scheme is called convergent too. 

Consistency od a scheme does not guarantee convergence!

For convergence of a scheme, the initial conditions needs to lie within the domain of dependency.

For the advection equations  (Euler forward and upstream) this is the case if the CFL criterion holds. That is:

\(c\Delta t \leq\Delta x \)

(If a scheme is convergent it is also stable!)

consistency plus stability gives convergence!

What is the connection between consitency, stability and convergence?

consistency plus stability gives convergence!

Finite time differences: facts without formula (with order of accuracy, centred/uncentred, explicit/implicit)

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

         

         

 

 

 

 

 

 

 

 

 

 

 

 

 

What is stability?

A solution \(u^n_{j}\) is stable if the error \(u^n_j-u(j\Delta x,n\Delta t)\)remains bounded as n increases, for fixed values of \(\Delta x\) and \(\Delta t\).

Of course, we assume that also the true solution is bounded, which is usually the case. 

A finite difference scheme is stable if this is true for any initial condition. 

Explain the Von Neumann's method!

  • only able to test the stability of linear equations or linearized versions
  • most frequently used
  • main concept: every solution to a linear equation can be expressed in a Fourier series, where each harmonic component is also a solution to the equation. Thus, it is enough to study the stability of one Fourier Component on it's own! That is: \(u_j^n=u_0e^{ik(j\Delta x-C_Dn\Delta t)}\)
  • We analyze stability with the amplification factor \(\lambda\). If the true solution doesn't grow over time it is sufficient fo stability that: \(|\lambda|\leq1\).
  • we define: \(U^{n+1}=\lambda U^{(n)}\)

Are in general centred or uncentred schemes with higher order of accuracy?

In general, centred scheme has an accuracy of order 2, whereas uncentred scheme are only of order 1 in accuracy!

The oscillation equation

equation: \(\frac{dU}{dt}=i\omega U\)

analytical solution: \(U(t)=U(0)e^{i\omega t}\)

start with the stability analysis: \(U^{(n+1)}=\lambda U^{n}\)

We define \(\lambda=|\lambda|e^{i\Theta}\)

Then the numerical solution can formally be written as:

\(U^{(n)}=|\lambda|^nU^{(0)}e^{in\Theta}\)

\(|\lambda|(<,>,=) 1\) leads to: damping, unstable or neutral

The relative phase change leads to:

\(\frac{\Theta}{\omega\Delta t}(>=<)1\) leads to: accelerating, no effect, decelerating

For accuracy we want to have the ampflification factor and the relative phase speed close to unity. Unless it is a computational mode. Then we want strong damping!

 

Euler scheme:

  • \(\lambda =1+ip\)
  • unconditionally unstable

Backward Scheme:

  • \(\lambda=\frac{1}{1+\omega\Delta t}(1+i\omega\Delta t)\)
  • unconditionally stable
  • it is always damping and damping increases with frequency.

Trapezoidal scheme:

  • \(\lambda=\frac{1}{1+\frac{1}{4}p^2}(1-\frac{1}{4}p^2+ip)\)
  • \(|\lambda|=1\)
  • the trapezoidal scheme is always neutral (and thus stable)

Matsuno scheme:

  • stable if: \(|\omega\Delta t|\leq 1\) (so time step must be small enough!)

Heun scheme:

  • very weak unstable. With small time steps often the instability can be tolerated

Leap-frog scheme:

  • stable and neutral if \(|\omega \Delta t|\leq1\)

 

Fazit: Ich would use leap frog because it has a high accuracy and under specific conditions it is stable and even neutral! Although it is implicit what is in general more complicated to deal with, so then trapezoidal would be an alternative: unconditionally neutral. Unconditionally unstable is the euler forward and thus not useable. The Heun Scheme is also unconditionally unstable but at some situation tolerable. 

Is it possible to avoid the computational mode?

 

  • It's through the "round of error" that one can not eliminate the computational mode completely, even when it was avoided in the initail conditions. 
  • Although " round of errors" are of little effect in atmospheric models. 
  • It can be shown that the Heun scheme is a good choice to compute the computional initial condition, since it will give a smaller amplitude of the computational mode. 

with oscillation and friction term: A combination of schemes:

We might like to use the leapfrog scheme for the oscillation term but we cannot use it for the friction term. So we use two different schemes with Euler forward for the friction!

 

\(\frac{du}{dt}=i\omega u-\gamma u\\\frac{u_j^{n+1}-u_j^{n-1}}{2\Delta t}=i\omega u^n-\gamma u^{n-1}\)

Euler forward scheme

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

Backward Scheme 

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

Trapezoidal Scheme 

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

Matsuno or Euler Backward Scheme 

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

Heun Scheme 

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

leap-frog scheme

To define time schemes, we consider the equation:

\(\frac{du}{dt}=f(u,t)\;\;\;where\;\;u=u(t)\)

  1. Two-level-schemes: use timesteps n and n+1
    1. \(u^{n+1}=u^n+\int^{(n+1)\Delta t}_{n\Delta t}f(u,t)dt\)
    2. Euler or forward scheme:
      • \(u^{n+1}=u^n+\Delta tf^n\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred

      • explicit

    3. Backward scheme:

      • \(u^{n+1}=u^n+\Delta tf^{n+1}\)

      • first order accurate scheme: \(O(\Delta t)\)

      • uncentred
      • implicit 
    4. Trapezoidal scheme
      • \(u^{n+1}=u^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      • implicit
    5. Matsuno or Euler-backward scheme
      • to increase the accuracy: first an Euler forward time step, than a backward step
      • \(1.\;u^{n+1/2}=u^n+\Delta t f^n\\ 2.\;u^{n+1}=u^n+\Delta tf^{n+1/2}\)
      • explicit
      • first order accurate scheme: \(O(\Delta t)\)

    6. Heun scheme
      • first Euler forward, then Trapezoidal
      • \(1.\;U^{n+1*}=U^{n}+\Delta t*f^n\\2.\;U^{n+1}=U^n+\frac{1}{2}\Delta t(f^n+f^{n+1})\)
      • second order of accuracy
      • explicit 

 

  1. Three-level-schemes: use timesteps n-1, n, n+1
    1. \(u^{n+1}=u^{n-1}+\int^{(n+1)\Delta t}_{(n-1)\Delta t}f(u,t)dt\)
    2. leapfrog scheme
      • \(u^{n+1}=u^{n-1}+2\Delta tf^n\)
      • second order accurate scheme: \(O((\Delta t)^2)\)

      •  

        most widely used scheme in atmospheric and ocean models. 

What is a staggered grid and what are the advantages? Explain it with the gravity waves. 

The one-dimensional gravity waves: 

\(\frac{\partial u}{\partial t}=-g\frac{\partial h}{\partial x},\;\;\frac{\partial h}{\partial t}=-H\frac{\partial u}{\partial x}\)

The differential/difference equations for the one-dimensional case are: 

\(\frac{u_j}{\partial t}=-g\frac{h_{j+1}-h_{j-1}}{2\Delta x},\;\;\frac{\partial h_j}{\partial t}=-H\frac{u_{j+1}-u_{j-1}}{2\Delta x}\)

If we use for that a non-staggered grid (like the A-grid), than we will have two elementary subgrids, with the solution on one of these subgrids beeing completely decoupled from the other. Thus it would be better to calculate only one of these solutions, that is, to use a staggered grid (like the C-grid). 

This reduces computation time by a fator of two and the truncation error stays the same. £££

What grid is the most used for the linear shallow water equations? Explain in words.

  • We have shown, that the C-grid is the best choose for gravity waves. The error for the numerical solution can be decreased through the win in computation time. 
  • Although, wheres the space derivatives are straight forward for the C-grid, the Corilis term is complicated to calculate. 
  • To decide wheter which grid is to choose, we investigate the effect of the space distribution of dependent variables on the dispersive properties of the gravity-inertia waves. This will be done using the simplest centered approximations for the space derivatives, leaving the time derivatives in their differential form. That is the differential-diffrence equation.

The frequency equation for the one-dimesnional system (when wave soltions were plugged in) is: 

\((\frac{\vartheta}{f})^2=1+\frac{gH}{f^2}k^2\)

with the Rossby Radius of deformation is: 

\(R=\frac{\sqrt{gH}}{f}\)

It follows that the frquency of the gravity-inertia waves is monotonically increasing function of k. Therefore the group velocity is never zero. This is very important for the geostrophic adjustment process, as it precludes a local accumulation of wave energy. 

We now look at the effect of the finite differencing in space in this case. Obtaining again the frequency equation, we find that the non-dimensional frequency \(\vartheta/f\) depend on the two paramters: \(k\Delta x\) and \(R\Delta x\)

For the one-dimensional case C and B have also a monotinically increasing frequency as a function of wavenumber. Although the two-grid wave has a group velocity of zero. 

In the two-deminsional case, only the C-grid as no negative group velocities for all kombination of wavenumbers l and k. Although if the Rossby Radius is smaller than a half grid (\(\sqrt{gH}/f<\Delta x/2\)) than the group velocity is everywhere negative. However, this does not happen for typical grid sizes used in atmospheric models and thus the C-grid is the best choice to simulate the geostrophic adjustment process.  

Advection Equation: An overview: 

 

Analytical:

\(\frac{\partial u}{\partial t}-c\frac{\partial u}{\partial x}\)

solution: \(u(t,x)=f(x-ct)\) 

-----------------

Euler forward: Only stable when with upstream space differencing. Introduces a strong damping. The CFL criterion must be also fulfilled. 

Leap-frog scheme: conditionally stable with the CFL criterion. 

Fazit: I would use leapfrog since it has a higher order of accuracy than the others. 

Study