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^2
      
      with 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 ) = 0
      
      where v is any finite element space basis vector.
    
    The information on this web page is distributed under the MIT license.
backward_euler is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a FreeFem++ version and a MATLAB version and an Octave version and a Python version and an R version.