# Scalar Advection Equation

## Motivation

The advection equation as it is imposed in the non-conservative form

<<latex($u_{t} + v \nabla \cdot (u) = 0$)>>

does only allow constant speeds for the advection (e.g. <<latex($v = 1$)>>. As this might be sufficient for many purposes, it might be necessary to define a more complex advection speed function in some cases. For this reasons the formulation of the equation has to be changed into the conservative form

<<latex($u_{t} + \nabla \cdot (v u) = 0$)>>

An example of the non-conservative form can be found in /examples/advection/advection.py. In the 2D case the advection speed is defined as <<latex($v = \begin{array}{*{1}{c}} 2 \\ 0 \\ \end{array}$)>>, which is a constant advection to the right.

## Imposing a space dependent advection

The first step will be a space dependent advection function for the 2D case with <<latex($v = v(x,y) = \begin{array}{*{1}{c}} -y \\ x \\ \end{array}$)>> which is a vortex.

1. Define the advection function based on the discr.interpolate_volume_function(function) method.

2. Build an operator by modifying: (use the allready existing AdvectionOperatorBase class in pde.py)

• the operator interface for the new advection function.
• the RHS to the conservative form.
• the BC's in order to provide a Dirichlet BC on the entire boundary.

## Imposing a time dependent advection

The second step will be a time and space dependent advection function for the 2D case with <<latex($v = v(x,y,t) = \begin{array}{*{1}{c}} -y \\ x \\ \end{array} \cdot sin(\pi t)$)>>.

1. Define the mentioned function.
2. Provide necessary changes to the operator interface by using the TimeDependetGivenFunction class from data.py. (an example for the use of this function can be found in examples/wave/wave-min.

3. Make sure to provide all necessary information to build the RHS. As the advection function now bases on data that changes every timestep it is important to provide them.

Hedge/Exercises/ScalarAdvection (last edited 2013-01-16 23:25:48 by AndreasKloeckner)