euler, a FreeFem++ code which uses the Forward 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 forward 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 for u in the following integral equation:

        Integral ( u - uold ) v 
        + dt ( d/dx uold d/dx v + d/dy uold d/dy v - f(x,y,told,uold) v ) = 0
where 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 GNU LGPL license.


Source Code:

Last revised on 26 April 2021.