Difference between revisions of "NumMethodsPDEs"

From SourceWiki
Jump to navigation Jump to search
Line 41: Line 41:
  
 
:<math>f'(x) \approx \frac{f(x+h) - f(x)}{h} </math>
 
:<math>f'(x) \approx \frac{f(x+h) - f(x)}{h} </math>
 +
 +
=Parabolic equations: Crank-Nicolson=
 +
 +
The 1D heat equation:
 +
 +
:<math>\frac{\partial u}{\partial t}=\fac{\partial^2u}{\partial x^2} </math>

Revision as of 16:25, 2 February 2011

Numerical Methods for PDEs: Solving PDEs on a computer

Introduction

In this tutorial, we'll take a look at how we might model aspects of the world around us on a computer. When we use mathematics to describe many of the phenomena that we see we end up using Partial Differential Equations (PDEs), and so we seek ways to solve these numerically.

As a notation shorthand, we'll use [math]\displaystyle{ u_x }[/math] to represent the partial derivative of u with respect to x:

[math]\displaystyle{ u_x = \frac{\partial u}{\partial x} }[/math]

Looking at Nature (& a quick philosophical aside)

When we observe nature, certain patterns crop up again and again. For example, in the the field of electrostatics, if a function [math]\displaystyle{ f }[/math] describes a distribution of electric charge, then Poisson's equation:

[math]\displaystyle{ {\nabla}^2 \varphi = f. }[/math]

gives the electric potential [math]\displaystyle{ \varphi }[/math].

However, Poisson's equation also describes the steady state temperature of a material when subjected to some heating and also crops up when considering gravitational potentials..

What's going on here? Why the recycling of the same equation? Is Poisson's equation fundamental in some way? Well, yes I suppose it is. However, we can look at it another way and say that Poisson's equation is the way we describe--using the language of maths--steady state phenomena which involve potentials. OK, this sounds a bit out there, but consider the following very general equation for a moment (it's a second-order linear equation in two variables):

[math]\displaystyle{ Au_{xx} + Bu_{xy} + Cu_{yy} + Du_x + Eu_y + Fu = G }[/math]

It turns out that we can categorise certain instances of this equation and then relate these categories to the kind of phenomena that they describe:

  • Parabolic: [math]\displaystyle{ B^2 - 4AC = 0 }[/math]. This family of equations describe heat flow and diffusion processes.
  • Hyperbolic: [math]\displaystyle{ B^2 - 4AC \gt 0 }[/math]. Describe vibrating systems and wave motion.
  • Elliptic: [math]\displaystyle{ B^2 - 4AC \lt 0 }[/math]. Steady-state phenomena.

That's pretty handy!

Discritisation

OK, so far so good. However, the functions and variables that we've considered thus far are continuous, meaning that they could have an infinite number of values. This is fine when solving equations analytically, but we need to deal with a finite number of values when working with a digital computer. We need a way to discritise our problems. Happily, help is at hand from the Taylor series. Recall that we can approximate the value of a function at a point distant from x using a linear summation of derivatives of the function at x:

[math]\displaystyle{ f(x+h) \approx f(x) + \frac{f'(x)}{1!}h + \frac{f''(x)}{2!}h^2 + \cdots }[/math]

Let's truncate this series after the first differential and rearrange:

[math]\displaystyle{ f'(x) \approx \frac{f(x+h) - f(x)}{h} }[/math]

Parabolic equations: Crank-Nicolson

The 1D heat equation:

[math]\displaystyle{ \frac{\partial u}{\partial t}=\fac{\partial^2u}{\partial x^2} }[/math]