# Basic Aspects of the Semi-Lagrangian Method for Fluid Mechanics

When modeling phenomena by means of physical laws like it is the case in many applications arising from engineering or numerical weather forecasting, the targeted result often not only depends on time but in addition on space.

These models typically lead to partial differential equations which themself are notorious hard to deal with and in particular when they are nonlinear. These harder to solve equations arise quickly. An example is the famous Navier-Stokes equation which intends to describe the evolution of a velocity field. It has the form:

Before continuing let us **roughly** look at how this equation is derived and how naturally above non-linearity appears:

There exists an enormous amount of methods to solve equations like this numerically: Finite differences, finite elements, finite volumes, spectral methods … All these have its own strengths and weaknesses.

The method we will look at, which is called Semi Lagrangian Method, stands out a little bit from traditional approaches. One can roughly say, it ‘stays with Newton’ and has not to deal with above non-linearity.

The main idea is instead of solving the partial differential equation for the entire field, to just solve equation **(1)** for each volume. The later is an ordinary differential equation (ODE) and the ‘problematic’ non-linearity does not appear.

Before continuing let me make you attentive on how we silently simplified the targeted problem: In many application **F** involves derivatives of **u**. For instance when friction forces are taken into account. We will leave this out since it drastically complicates the theory around the subject.

Above stated strategy sometimes is referred as Lagrangian method. The Semi Lagrangian method tries to cope with the inherited dilemma by ensuring at each grid point an estimate of the velocity field is being made after each time step. This works in detail as follows:

This already describes the Semi Lagrangian method. Next let us get some confirmation by looking at its convergence. Of course you can jump over this part if you are not interested in these details.

## Example Implementation:

Next, let us apply the Semi Lagrangian methods to an easy example implemented in Julia.

This intends to simulate a 2-dimensional velocity field on which as only force the Coriolis force is acting. This force is implemented in **F** and only depends on the velocity. It acts on particles to always drift to the right.

The function **main **should look quite familiar to you, since it almost corresponds to above Semi Lagrangian scheme on ‘paper’.

The function **interpolate **looks a little more complex, but only because we have to incorporate boundary conditions. That is, we assume the flow is on a rectangular area and all boundaries are open. So, volumes can flow out and in without restriction.

Letting this code running and plotting the trajectory of a single volume, we obtain:

This trajectory is followed by the volume in clock-wise direction. Of course, this example is not really of much interest, but it is the one for which above theoretical considerations do apply. If you have knowledge in fluid-dynamics, feel invited to extend above code in order to incorporate coupling of pressure density and temperature.

## Final Notes:

We assumed the r.h.s, that is **F**, to only depend on time, space and velocity. In many applications there is additional dependency on second order derivatives of velocity resulting from friction forces or on first order derivatives by coupling with the density. The Semi Lagrangian method also can be applied to these more complex scenarios, but then the theoretical foundation is much more involved. For methods which still keep the theory at a satisfactory level one is best referred to so called spectral methods. But beside of this the Semi Lagrangian method gets its appealing beauty since the underlying physics is incorporated into the model in the most natural way.