Simple FEM demo

The effect of mesh Peclet number Pe=\frac{ah}{2\alpha} is demonstrated in the following simple 1D FEM sol’n of advection-diffustion equation. The sol’n is written in Mathematica.

au_x-\nu u_x=s(x)

u=0 \quad \text{at } x=0,x=L

with s as the source function. Here we assume constant advection velocity a and diffusion coefficient \nu.
Variational form:

a(w,u)+c(a;w,u)=(w,s)

with

a(w,u)=\int_0^L{w_x\nu u_x}dx, c(a;w,u)=\int_0^L{w a u_x}dx, (w,s)=\int_0^L{w s}dx

Assuming equal grid size h in the interval and linear shape function, it can be shown the linear equations for node value is

a \frac{u_{i+1}-u_{i-1}}{2h}-\nu \frac{u_{i+1}-2u_i+u_{i-1}}{h^2}=\frac{s_{i+1}+4s_i+s_{i-1}}{6}

Notice that LHS is the central difference of u_x and u_{xx}, but the RHS is weighted average of source.

The mathmatica code and result can be found here.

The output shows the oscillation introduced by large Peclet number. Essentially it is caused by unsymmetry of the equation, induced by advection velocity terms.  I’ll try to revisit this phenomenon later.

This slideshow requires JavaScript.