Resolution of the 1D Poisson's equation using local Shape Functions

From KratosWiki
Revision as of 10:21, 9 December 2008 by JMora (Talk | contribs)
Jump to: navigation, search
The problem to solve is:
BarraFEM.jpg


 A(\varphi) = \frac{d}{dx} \left( k \frac{d \varphi}{dx} \right) + Q = 0 ~~ in ~ 0 \le x \le l
 B(\varphi) = 
\begin{cases} 
  \varphi - \overline{\varphi} = 0  & in ~ x = 0 \\
  k \frac{d \varphi}{dx} + \overline{q} = 0  & in ~ x = l
\end{cases}


with the following analytical solution:


\varphi (x) = - \frac{Q}{2 k} x^2 + \frac{- \overline q + Q l}{k} x + \overline \varphi


k \nabla \varphi (x) = Q (l - x) - \overline q


The weak form of the integral equation is:


 
    {
    \int_0^l \frac{d W_i}{dx} k \sum_{j=1}^n \frac{d N_j}{dx} a_j dx = \int_0^l W_i Q dx + \left[ W_i q \right ]_{x=0} - \left[ W_i \overline q \right ]_{x=l}
    }


and the approach solution is written by using the shape functions as:


 \varphi (x) \cong \hat \varphi (x) = \sum_{i=1}^n N_i (x) \varphi_i


Resolution using 1 element with two nodes

One single element means to cover the entire domain with the local functions.


1DFEM1node.jpg


\hat \varphi (x) = N_1 (x) \varphi_1 + N_2 (x) \varphi_2


\frac{ d \hat \varphi (x)}{dx} = \frac{ d N_1 (x) }{dx} \varphi_1 + \frac{ d N_2 (x) }{dx} \varphi_2


By using the Galerkin method (W_i = N_i \,, it can be obtained:


 
    \int_0^l \frac{d N_i}{dx} k \left ( \frac{d N_1}{dx} \varphi_1 + \frac{d N_2}{dx} \varphi_2 \right ) dx = \int_0^l N_i Q dx + \left[ N_i q \right ]_{x=0} - \left[ N_i \overline q \right ]_{x=l} \qquad i=1,2


for i=1:
 
    \int_0^l \frac{d N_1}{dx} k \left ( \frac{d N_1}{dx} \varphi_1 + \frac{d N_2}{dx} \varphi_2 \right ) dx = \int_0^l N_1 Q dx + q_0


because N_1(0)=1 \, and N_1(l)=0 \,


1DFEM1nodeN1.jpg


for i=2:
 
    \int_0^l \frac{d N_2}{dx} k \left ( \frac{d N_2}{dx} \varphi_1 + \frac{d N_2}{dx} \varphi_2 \right ) dx = \int_0^l N_1 Q dx - \overline q


because N_2(0)=0 \, and N_2(l)=1 \,


1DFEM1nodeN2.jpg


in matricial form:

\begin{bmatrix}
  K_{11} & K_{12} \\
  K_{21} & K_{22} 
\end{bmatrix}
\begin{Bmatrix} 
  \varphi_1 \\ 
  \varphi_2
\end{Bmatrix}
=
\begin{Bmatrix} 
  f_1 \\ 
  f_2
\end{Bmatrix}


with:


K_{ij}=\int_0^{l} \frac{d N_i(x)}{dx} k  \frac{d N_j(x)}{dx} dx
f_{1}=\int_0^{l} N_1(x) Q dx + q_0 \,
f_{2}=\int_0^{l} N_2(x) Q dx - \overline q


To be more practical, this system of equations can be particularised for some specific polynomial shape functions:

 \begin{align}
  N_1^{(e)}(x) = \frac{x_2^{(e)} - x}{l^{(e)}} & \qquad \frac{d N_1^{(e)}(x)}{dx} = -\frac{1}{l^{(e)}} \\
  N_2^{(e)}(x) = \frac{x - x_1^{(e)}}{l^{(e)}} & \qquad \frac{d N_2^{(e)}(x)}{dx} = \frac{1}{l^{(e)}}
 \end{align}
Therefore:

 \begin{align}
   K_{11}^{(e)} &= K_{22}^{(e)} = - K_{12}^{(e)} = - K_{21}^{(e)} = \frac{k}{l^{(e)}} \\
   f_1 &= \frac{Q l}{2} - q_0 \\
   f_2 &= \frac{Q l}{2} + \overline q
 \end{align}



  \frac{k}{l}
  \begin{bmatrix}
    1 & -1 \\
    -1 & 1 
  \end{bmatrix}
  \begin{Bmatrix} 
    \varphi_1 \\ 
    \varphi_2
  \end{Bmatrix}
  =
  \begin{Bmatrix} 
    \frac{Q l}{2} - q_0 \\ 
    \frac{Q l}{2} + \overline q
  \end{Bmatrix}



 \begin{align}
    \varphi_1 & = \overline \varphi\\ 
    \varphi_2 & = \frac{Q l^2}{2 k} -  \frac{\overline q l}{k} + \overline \varphi
 \end{align}


\varphi_2 \, is the same value which it has been obtained with the analytical solution. Nevertheless, the global solution is clearly different:



  \hat \varphi (x) = \frac{l - x}{l} \varphi_1 + \frac{x}{l} \varphi_2  = \overline \varphi + \frac{1}{k} \left ( \frac{Q l}{2} - \overline q \right ) x \ne - \frac{Q}{2 k} x^2 + \frac{- \overline q + Q l}{k} x + \overline \varphi = \varphi(x)


To obtain the reaction to the fixed \overline \varphi \, value, the first equation of the matricial system of equations can be used:


\frac{k}{l} (\varphi_1 - \varphi_2) = \frac{Q l}{2} + q_0 \qquad \Rightarrow \qquad \frac{k}{l} \left( \overline \varphi - \left( \frac{Q l^2}{2 k} -  \frac{\overline q l}{k} + \overline \varphi \right) \right) = \frac{Q l}{2} + q_0


q_0 = \overline q - Q l \qquad \Rightarrow  \qquad  \underbrace{ q_0 + Q l }_{inflow} - \underbrace{ \overline q }_{outflow} = 0



Resolution using two elements with two nodes

Two elements with two nodes each means the use of three global nodes:


\hat \varphi (x) = N_1 (x) \varphi_1 + N_2 (x) \varphi_2 + N_3 (x) \varphi_3


1DFEM2nodes.jpg


Locally, it is equivalent to:



  \left . 
    \begin{align}
       N_1 &= N_1^{(1)} \\
       N_1 &= 0 
    \end{align}
  \right \}
    \quad
    \begin{align}
       0  \le & x  \le l/2 \\
       l/2  \le & x  \le l
    \end{align}
  1DFEM2nodeN1.jpg

  \left . 
    \begin{align}
       N_2 &= N_2^{(1)} \\
       N_2 &= N_1^{(2)}
    \end{align}
  \right \}
    \quad
    \begin{align}
       0  \le & x  \le l/2 \\
       l/2  \le & x  \le l
    \end{align}
  1DFEM2nodeN1N2.jpg

  \left . 
    \begin{align}
       N_3 &= 0 \\
       N_3 &= N_2^{(2)} 
    \end{align}
  \right \}
    \quad
    \begin{align}
       0  \le & x  \le l/2 \\
       l/2  \le & x  \le l
    \end{align}
  1DFEM2nodeN2.jpg


 
    \int_0^l \frac{d N_i}{dx} k \left ( \frac{d N_1}{dx} \varphi_1 + \frac{d N_2}{dx} \varphi_2 + \frac{d N_3}{dx} \varphi_3\right ) dx = \int_0^l N_i Q dx + \left[ N_i q \right ]_{x=0} - \left[ N_i \overline q \right ]_{x=l} \qquad i=1, 2, 3


for i=1:

    \int_0^{l/2} \frac{d N_1^{(1)}}{dx} k \left ( \frac{d N_1^{(1)}}{dx} \varphi_1 + \frac{d N_2^{(1)}}{dx} \varphi_2 \right ) dx = \int_0^{l/2} N_1^{(1)} Q dx + \left[ N_1^{(1)} q \right ]_{x=0} - \left[ N_1^{(1)} \overline q \right ]_{x=l} = \underbrace{\int_0^{l/2} N_1^{(1)} Q dx }_{f_1^{(1)}} + q_0


for i=2:

    \int_0^{l/2} \frac{d N_2^{(1)}}{dx} k \left ( \frac{d N_1^{(1)}}{dx} \varphi_1 + \frac{d N_2^{(1)}}{dx} \varphi_2 \right ) dx + \int_{l/2}^{l} \frac{d N_1^{(2)}}{dx} k \left ( \frac{d N_1^{(2)}}{dx} \varphi_2 + \frac{d N_2^{(2)}}{dx} \varphi_3 \right ) = \underbrace{\int_0^{l/2} N_2^{(1)} Q dx }_{f_2^{(1)}} + \underbrace{\int_{l/2}^{l} N_1^{(2)} Q dx }_{f_1^{(2)}}


for i=3:

    \int_{l/2}^{l} \frac{d N_2^{(2)}}{dx} k \left ( \frac{d N_1^{(2)}}{dx} \varphi_2 + \frac{d N_2^{(2)}}{dx} \varphi_3 \right ) = \int_{l/2}^{l} N_2^{(2)} Q dx + \left[ N_2^{(2)} q \right ]_{x=0} - \left[ N_2^{(2)} \overline q \right ]_{x=l} = \underbrace{\int_{l/2}^{l} N_2^{(2)} Q dx }_{f_2^{(2)}} - \overline q


in matricial form:

\underbrace{
\begin{bmatrix}
  K_{11}^{(1)} & K_{12}^{(1)} & 0 \\
  K_{21}^{(1)} & K_{22}^{(1)} + K_{11}^{(2)} & K_{12}^{(2)} \\
  0 & K_{21}^{(2)} & K_{22}^{(2)} 
\end{bmatrix}
}_{K}
\underbrace{
\begin{Bmatrix} 
  \varphi_1 = \overline \varphi \\ 
  \varphi_2 \\
  \varphi_3
\end{Bmatrix}
}_{a}
=
\underbrace{
\begin{Bmatrix} 
  f_1^{(1)} + q_0 \\ 
  f_2^{(1)} + f_1^{(2)} \\
  f_2^{(2)} - \overline q
\end{Bmatrix}
}_{f}


with:


K_{ij}^{(e)}=\int_{l^{(e)}} \frac{d N_i^{(e)}(x)}{dx} k  \frac{d N_j^{(e)}(x)}{dx} dx
f_{i}^{(e)}=\int_{l^{(e)}} N_i^{(e)}(x) Q dx \,


In this case:

 \begin{align}
   K_{11}^{(e)} &= K_{22}^{(e)} = - K_{12}^{(e)} = - K_{21}^{(e)} = \frac{k}{l}^{(e)} \\
   f_1^{(e)} &= \frac{Q l}{2} \\
   f_2^{(e)} &= \frac{Q l}{2}
 \end{align}



  \begin{bmatrix}
    \left( \frac{k}{l} \right ) ^{(1)} & -\left( \frac{k}{l} \right ) ^{(1)} & 0\\
    -\left( \frac{k}{l} \right ) ^{(1)} & \left( \frac{k}{l} \right ) ^{(1)} + \left( \frac{k}{l} \right ) ^{(2)} & -\left( \frac{k}{l} \right ) ^{(2)} \\
    0 & - \left( \frac{k}{l} \right ) ^{(2)} & \left( \frac{k}{l} \right ) ^{(2)} 
  \end{bmatrix}
  \begin{Bmatrix} 
    \varphi_1 \\ 
    \varphi_2 \\
    \varphi_3
  \end{Bmatrix}
  =
  \begin{Bmatrix} 
    \frac{Q l^{(1)}}{2} + q_0 \\ 
    \frac{Q l^{(1)}}{2} + \frac{Q l^{(2)}}{2} \\
    \frac{Q l^{(2)}}{2} - \overline q
  \end{Bmatrix}


If l^{(e)}=l/2 \,



  \frac{2 k}{l} 
  \begin{bmatrix}
    1 & -1 & 0\\
    -1 & 2 & -1 \\
    0 & -1 & 1 
  \end{bmatrix}
  \begin{Bmatrix} 
    \varphi_1 \\ 
    \varphi_2 \\
    \varphi_3
  \end{Bmatrix}
  =
  \begin{Bmatrix} 
    \frac{Q l}{4} + q_0 \\ 
    \frac{Q l}{2} \\
    \frac{Q l}{4} - \overline q
  \end{Bmatrix}



 \begin{align}
    \varphi_1 & = \overline \varphi\\ 
    \varphi_2 & = \frac{3 Q l^2}{8 k} -  \frac{\overline q l}{2 k} + \overline \varphi \\
    \varphi_3 & = \frac{Q l^2}{2 k} -  \frac{\overline q l}{k} + \overline \varphi
 \end{align}


and again q_0 = \overline q - Q l \,


Come back to the Resolution of the Poisson's equation using local Shape Functions
Personal tools
Categories