backward_euler, a FreeFem++ code which uses the (implicit) backward Euler method to approximate the solution of a time dependent boundary value problem (BVP).
Our problem is posed on the unit square, with zero boundary conditions, and having the exact solution
u = sin(pi x) sin(pi y) e^(-t)The boundary value problem is posed as
du d^2 u d^2 u -- - ----- - ----- = (2 pi^2 - 1 ) sin(pi x) sin(pi y) e^(-t) dt dx^2 dy^2with initial condition at t=0:
u(x,y,0) = sin(pi x) sin(pi y)and boundary condition
u(x,y,t) = 0
The backward Euler method allows us to take a time step dt, using the solution uold at the previous step, replacing the time derivative by (u-uold)/dt. As a finite element expression, the problem is to solve the following integral equation for u:
Integral ( u - uold ) v + dt ( ux vx + uy vy - f(x,y,t,u) v ) = 0where v is any finite element space basis vector.
The computer code and data files described and made available on this web page are distributed under the MIT license