hvalayer / fem_laplace_2D

Python implementation of Finite Element Method to solve Laplace equation
0 stars 1 forks source link

Solve 2D Laplace equation with Finite Element Method

Classical FEM framework to solve the Laplace equation over a unit square domain:

\nabla^2u = 0 \;,\; \forall (x,y)\in[0,1]\times[0,1]

The code is provided with the following example:

\forall (x,y)\in[0,1]\times[0,1]\;,
\begin{cases}
    &u(x,0) &= &\sin(\pi x) \\[0.5em]
    &u(x,1) &= &0 \\[0.5em]
    &u(0,y) &= &0 \\[0.5em]
    &u(1,y) &= &0
\end{cases},

which has analytical solution:

u(x,y) = \sin(\pi x)\left[\cos(\pi y) - \coth(\pi)\sinh(\pi y)\right]

The distribution of files is as follows: