{ "metadata": { "name": "", "signature": "sha256:a7d635f37a3a118f65c5e2a051fd27b84dc7b41ff7627418beacef1a7d78fd1c" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Advection Equation and the REA algorithm\n", "by Mauricio J. Del Razo S. 2014\n", "\n", "In this notebook we will develop and explain the REA (reconstruct, evolve and average algorithm) for the advection equation. Since any homogeneous hyperbolic linear system of equations can be decoupled into a system of advection equations, this finite volume method algorithm is a fundamental block in the numerical solution of hyperbolic problems. The ideas presented with this algorithm will remain to be relevant for non-linear systems." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Decoupling into a system of advection equations\n", "\n", "Consider a system of one dimensional linear hyperbolic equations, written in its first order form,\n", "\n", "$$\n", "\\bar{q}_t + \\mathbf{A} \\bar{q}_x = 0. \n", "$$\n", "\n", "We can decompose the matrix $\\mathbf{A} = \\mathbf{R \\Lambda R^{-1}}$, as the product of the matrix of eigenvectors $\\mathbf{R}$ with the diagonal matrix of eigenvalues $\\mathbf{\\Lambda}$ and the inverse of $\\mathbf{R}$. Substituiting into the previus equation and multipling by $\\mathbf{R^{-1}}$ on the left side, we obtain\n", "\n", "$$\n", "\\mathbf{R^{-1}} \\bar{q}_t + \\mathbf{\\Lambda R^{-1}} \\bar{q}_x = 0. \n", "$$\n", "\n", "We can do the change of variable $\\bar{w} = \\mathbf{R^{-1}}\\bar{q}$, and as $\\mathbf{R^{-1}}$ is constant in time and space, we obtain,\n", "\n", "$$\n", "\\bar{w}_t + \\mathbf{\\Lambda} \\bar{w}_x = 0,\n", "$$\n", "\n", "where $\\mathbf{\\Lambda}$ is the diagonal matrix of eigenvalues. This yields a system of uncoupled advection equations, where the propagation speeds correspond to the eigenvalues of $\\mathbf{\\Lambda}$ or $\\mathbf{A}$. This means that if we can solve an advection equation numerically, we can solve the original system of hyperbolic equations. \n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. The REA algorithm for the advection equation\n", "\n", "Consider now a simple one dimensional advection equation for some quantity $q$,\n", "\n", "$$\n", "q_t + c q_x = 0, \\\\[3mm]\n", "q(x,0) = q_0(x).\n", "$$\n", "\n", "It has solution $q(x,t) = q_0(x-ct)$, like shown below,\n", "\n", "\n", "\n", "We would like to develop a numerical method that solves this equation and conserves the quantity $q$. We will first need to divide the space into grid cells $\\mathcal{C_i}=(x_{i-1/2},x_{i+1/2})$ separated by $\\Delta x$ and consider the cell averages of $q$ to be,\n", "\n", "$$\n", "Q_i^n = \\frac{1}{\\Delta x} \\int_{x_{i-1/2}}^{x_{i+1/2}} q(x,t_n) dx\n", "$$\n", "\n", "Once this is decided, we can begin the REA algorithm (for a detailed explanation see [LeVeque 2002](http://depts.washington.edu/clawpack/book.html) ):\n", "\n", "