# Shape Functions

(Difference between revisions)
 Revision as of 10:27, 20 October 2008 (view source)JMora (Talk | contribs) (→One-dimensional Shape Functions)← Older edit Latest revision as of 18:43, 23 August 2011 (view source)JMora (Talk | contribs) (46 intermediate revisions by 2 users not shown) Line 1: Line 1: − The '''Shape Functions''' or '''basis fuctions'''[http://en.wikipedia.org/wiki/Finite_element_analysis#Choosing_a_basis] are used to obtain an approach solution ($\overline{\varphi} (x)$) to the exact solution ($\varphi (x)$) in the Finite Element Method as a lineal combination of some kind of well known functions $N_i(x) \frac{}{}$. + The '''Shape Functions''' or '''basis fuctions'''[http://en.wikipedia.org/wiki/Finite_element_analysis#Choosing_a_basis] are used to obtain an approach solution ($\hat\varphi (x)$) to the exact solution ($\varphi (x)$) in the Finite Element Method as a lineal combination of some kind of well known functions $N_i(x) \frac{}{}$. − ::$\varphi (x) \cong \overline{\varphi} (x) = \sum_{i=0}^n N_i (x) a_i$ + ::$\varphi (x) \cong \hat \varphi (x) = \sum_{i=0}^n N_i (x) a_i$ Some typical shape functions are: Some typical shape functions are: Line 7: Line 7: # Monomials[http://en.wikipedia.org/wiki/Monomial]: # Monomials[http://en.wikipedia.org/wiki/Monomial]: #* $N_i (x) = x^i \frac{}{}$ #* $N_i (x) = x^i \frac{}{}$ − #* $\overline{\varphi} (x) = \sum_{i=0}^n a_i x^i = a_0 + \sum_{i=1}^n a_i x^i$ + #* $\hat \varphi (x) = \sum_{i=0}^n a_i x^i = a_0 + \sum_{i=1}^n a_i x^i$ # Fourier Functions[http://en.wikipedia.org/wiki/Fourier_series]: # Fourier Functions[http://en.wikipedia.org/wiki/Fourier_series]: #* $N_i (x) = sin ~ i x, cos ~ i x$ #* $N_i (x) = sin ~ i x, cos ~ i x$ − #* $\overline{\varphi} (x) = \sum_{i=0}^n a_i sin ~ i x + \sum_{i=0}^n \beta_i cos ~ i x = a_0 + \sum_{i=1}^n a_i sin ~ i x + \sum_{i=1}^n \beta_i cos ~ i x$ + #* $\hat \varphi (x) = \sum_{i=0}^n a_i sin ~ i x + \sum_{i=0}^n \beta_i cos ~ i x = a_0 + \sum_{i=1}^n a_i sin ~ i x + \sum_{i=1}^n \beta_i cos ~ i x$ # Exponential Functions[http://en.wikipedia.org/wiki/Exponential_functions]: # Exponential Functions[http://en.wikipedia.org/wiki/Exponential_functions]: #* $N_i (x) = e^{bix} \frac{}{}$ #* $N_i (x) = e^{bix} \frac{}{}$ − #* $\overline{\varphi} (x) = \sum_{i=0}^n a_i e^{bix}$ + #* $\hat \varphi (x) = \sum_{i=0}^n a_i e^{bix}$ These functions can be defined: These functions can be defined: * globally (to be applied over the whole domain $\Omega \frac{}{}$ of our problem); for example, using a polynomial function: * globally (to be applied over the whole domain $\Omega \frac{}{}$ of our problem); for example, using a polynomial function: − ** $\varphi (x) \cong \overline{\varphi} (x) = a_0 + a_1 x + a_2 x^2 + ... + a_n x^n = \sum_{i=0}^n a_i x^i$ + ** $\varphi (x) \cong \hat \varphi (x) = a_0 + a_1 x + a_2 x^2 + ... + a_n x^n = \sum_{i=0}^n a_i x^i$ ** note that the $n ~ a_i \frac{}{}$ values can be obtained if a set of $n ~ \varphi_i \frac{}{}$ values are known, typically for each point position ($x_i \frac{}{}$, what is called the node); ** note that the $n ~ a_i \frac{}{}$ values can be obtained if a set of $n ~ \varphi_i \frac{}{}$ values are known, typically for each point position ($x_i \frac{}{}$, what is called the node); * or locally (in subdomains of $\Omega \frac{}{}$); : * or locally (in subdomains of $\Omega \frac{}{}$); : − ** $\varphi (x) \cong \overline{\varphi} (x) = N_1^{(e)}(x) \varphi_1^{(e)} + N_2^{(e)}(x) \varphi_2^{(e)} + ... ~ + N_n^{(e)}(x) \varphi_n^{(e)} = \sum_{i=1}^n N_i^{(e)} (x) \varphi_i^{(e)}$ + ** $\varphi (x) \cong \hat \varphi (x) = N_1^{(e)}(x) \varphi_1^{(e)} + N_2^{(e)}(x) \varphi_2^{(e)} + ... ~ + N_n^{(e)}(x) \varphi_n^{(e)} = \sum_{i=1}^n N_i^{(e)} (x) \varphi_i^{(e)}$ ** $N_1^{(e)}(x), ..., N_n^{(e)}(x)$ are, in this case, the '''''polynomial interpolation functions''''' defined for each subdomain or element, and $\varphi_i^{(e)}$ is the value of the solution for each node '''''i'''''; ** $N_1^{(e)}(x), ..., N_n^{(e)}(x)$ are, in this case, the '''''polynomial interpolation functions''''' defined for each subdomain or element, and $\varphi_i^{(e)}$ is the value of the solution for each node '''''i'''''; ** each $N_i^{(e)}(x)=1$ in their  corresponding node '''''i''''', and $N_i^{(e)}(x)=0$ for the rest of the nodes; ** each $N_i^{(e)}(x)=1$ in their  corresponding node '''''i''''', and $N_i^{(e)}(x)=0$ for the rest of the nodes; Line 28: Line 28: * if they present continuity over the domain (or subdomain); * if they present continuity over the domain (or subdomain); * if they respect the boundary conditions (for example, if $\Gamma_0=0\frac{}{}$, then  $N_i(x_0)=0 \frac{}{}$); * if they respect the boundary conditions (for example, if $\Gamma_0=0\frac{}{}$, then  $N_i(x_0)=0 \frac{}{}$); + + + __TOC__ Line 41: Line 44: − :The solution $\varphi^{(e)} (x)$ for each element can be approached by their corresponding $\overline{\varphi}^{(e)} (x)$ to be expressed using the shape functions: + :The solution $\varphi^{(e)} (x)$ for each element can be approached by their corresponding $\hat \varphi^{(e)} (x)$ to be expressed using the shape functions: − ::$\varphi^{(e)}(x) \cong \overline{\varphi}^{(e)} (x) = \sum_{i=0}^1 N_i (x) \alpha_i$ + ::$\varphi^{(e)}(x) \cong \hat \varphi^{(e)} (x) = \sum_{i=0}^1 N_i (x) \varphi_i$ :If the shape functions are lineal polynomials, this expression becomes: :If the shape functions are lineal polynomials, this expression becomes: − ::$\overline{\varphi}^{(e)} (x) = \sum_{i=0}^1 \alpha_i x^i = \alpha_0 + \alpha_1 x$ + ::$\hat \varphi^{(e)} (x) = \sum_{i=0}^1 \alpha_i x^i = \alpha_0 + \alpha_1 x$ Line 60: Line 63: \begin{align} \begin{align} − \overline{\varphi}^{(e)} (x_1) & = \varphi^{(e)}_1 = \alpha_0 + \alpha_1 x_1^{(e)} \\ + \hat \varphi^{(e)} (x_1) & = \varphi^{(e)}_1 = \alpha_0 + \alpha_1 x_1^{(e)} \\ − \overline{\varphi}^{(e)} (x_2) & = \varphi^{(e)}_2 = \alpha_0 + \alpha_1 x_2^{(e)} + \hat \varphi^{(e)} (x_2) & = \varphi^{(e)}_2 = \alpha_0 + \alpha_1 x_2^{(e)} \end{align} \end{align} Line 94: Line 97: \right \} \Rightarrow \right \} \Rightarrow − \overline{\varphi}^{(e)} (x) = \left( \varphi^{(e)}_1 - \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} x_1^{(e)}  \right) + \left( \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right) x + \hat \varphi^{(e)} (x) = \left( \varphi^{(e)}_1 - \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} x_1^{(e)}  \right) + \left( \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right) x [/itex] [/itex] Line 103: Line 106: ::$::[itex] − \overline{\varphi}^{(e)} (x) = \underbrace {\left( \frac{x^{(e)}_2 - x} {x_2^{(e)}- x_1^{(e)} }\right)}_{N_1^{(e)}(x)} \varphi^{(e)}_1 + \underbrace {\left( \frac{x - x^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right)}_{N_2^{(e)}(x)} \varphi^{(e)}_2 + \hat \varphi^{(e)} (x) = \underbrace {\left( \frac{x^{(e)}_2 - x} {x_2^{(e)}- x_1^{(e)} }\right)}_{N_1^{(e)}(x)} \varphi^{(e)}_1 + \underbrace {\left( \frac{x - x^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right)}_{N_2^{(e)}(x)} \varphi^{(e)}_2$ [/itex] ::$::[itex] − \overline{\varphi}^{(e)} (x) = N_1^{(e)}(x) \varphi^{(e)}_1 + N_2^{(e)}(x) \varphi^{(e)}_2 = \sum_{i=1}^2 N_i^{(e)}(x) \varphi^{(e)}_i + \hat \varphi^{(e)} (x) = N_1^{(e)}(x) \varphi^{(e)}_1 + N_2^{(e)}(x) \varphi^{(e)}_2 = \sum_{i=1}^2 N_i^{(e)}(x) \varphi^{(e)}_i$ [/itex] Line 151: Line 154: :A detailed description of [[One-dimensional Shape Functions|'''how to obtain these shape functions''']] can help to understand the great importance of selecting the right order. :A detailed description of [[One-dimensional Shape Functions|'''how to obtain these shape functions''']] can help to understand the great importance of selecting the right order. + + + + === One-dimensional Lagrangian Elements === + Line 202: Line 210: == Two-dimensional Shape Functions == == Two-dimensional Shape Functions == + === The Three Node Linear Triangle === + :The solution $\varphi^{(e)} (x,y)$ for each triangular element can be approached by their corresponding $\hat \varphi^{(e)} (x,y)$ to be expressed using the shape functions: + + ::$\varphi^{(e)}(x,y) \cong \hat \varphi^{(e)} (x,y) = \sum_{i=1}^n N_i (x,y) \varphi^{(e)}_i$ + + :If the shape functions are lineal polynomials (three-node triangular element, n=3), and remembering: + + ::$+ N_i^{(e)}(x_j,y_j) = + \begin{cases} + 1, & i = j \\ + 0, & i \ne j + \end{cases} +$ + + :this expression can be written as: + + ::$N_i^{(e)} (x,y) = \frac{1}{2 A^{(e)}} \left [ a_i^{(e)} + b_i^{(e)} x + c_i^{(e)} y \right ] \qquad$      with $A^{(e)} \,$ the element area and   $i=1, 2, 3 \,$ + + + :And the system of equations is: + + + ::$+ \begin{bmatrix} + 1 & x_1^{(e)} & y_1^{(e)} \\ + 1 & x_2^{(e)} & y_2^{(e)} \\ + 1 & x_3^{(e)} & y_3^{(e)} + \end{bmatrix} + \begin{bmatrix} + a_1^{(e)} & a_2^{(e)} & a_3^{(e)} \\ + b_1^{(e)} & b_2^{(e)} & b_3^{(e)} \\ + c_1^{(e)} & c_2^{(e)} & c_3^{(e)} + \end{bmatrix} + = 2 ·A^{(e)}· + \begin{bmatrix} + 1 & 0 & 0 \\ + 0 & 1 & 0 \\ + 0 & 0 & 1 + \end{bmatrix} +$ + + + :The element area is computed as the half of the determinant of the coordinates matrix: + + + ::$2 ·A^{(e)} = + \begin{vmatrix} + 1 & x_1^{(e)} & y_1^{(e)} \\ + 1 & x_2^{(e)} & y_2^{(e)} \\ + 1 & x_3^{(e)} & y_3^{(e)} + \end{vmatrix} +$ + + + :[[Image:Three node triangle.jpg]] + + + :Finally, the different parameters can be expressed in terms of the nodal local coordinates as: + + + ::$a_i^{(e)}=x_j^{(e)}y_k^{(e)}-x_k^{(e)}y_j^{(e)}$ + + ::$b_i^{(e)}=y_j^{(e)}-y_k^{(e)}$ + + ::$c_i^{(e)}=x_k^{(e)}-x_j^{(e)}$ + + + :with  $i=1,2,3; \quad j=2,3,1; \quad k=3,1,2 \,$ + + + + For a more detailed description, visit [[Two-dimensional Shape Functions]] == Three-dimensional Shape Functions == == Three-dimensional Shape Functions == + + + [[Category:Shape Functions]]

## Latest revision as of 18:43, 23 August 2011

The Shape Functions or basis fuctions are used to obtain an approach solution ( $\hat\varphi (x)$) to the exact solution ( $\varphi (x)$) in the Finite Element Method as a lineal combination of some kind of well known functions $N_i(x) \frac{}{}$. $\varphi (x) \cong \hat \varphi (x) = \sum_{i=0}^n N_i (x) a_i$

Some typical shape functions are:

1. Monomials:
• $N_i (x) = x^i \frac{}{}$
• $\hat \varphi (x) = \sum_{i=0}^n a_i x^i = a_0 + \sum_{i=1}^n a_i x^i$
2. Fourier Functions:
• $N_i (x) = sin ~ i x, cos ~ i x$
• $\hat \varphi (x) = \sum_{i=0}^n a_i sin ~ i x + \sum_{i=0}^n \beta_i cos ~ i x = a_0 + \sum_{i=1}^n a_i sin ~ i x + \sum_{i=1}^n \beta_i cos ~ i x$
3. Exponential Functions:
• $N_i (x) = e^{bix} \frac{}{}$
• $\hat \varphi (x) = \sum_{i=0}^n a_i e^{bix}$

These functions can be defined:

• globally (to be applied over the whole domain $\Omega \frac{}{}$ of our problem); for example, using a polynomial function:
• $\varphi (x) \cong \hat \varphi (x) = a_0 + a_1 x + a_2 x^2 + ... + a_n x^n = \sum_{i=0}^n a_i x^i$
• note that the $n ~ a_i \frac{}{}$ values can be obtained if a set of $n ~ \varphi_i \frac{}{}$ values are known, typically for each point position ( $x_i \frac{}{}$, what is called the node);
• or locally (in subdomains of $\Omega \frac{}{}$); :
• $\varphi (x) \cong \hat \varphi (x) = N_1^{(e)}(x) \varphi_1^{(e)} + N_2^{(e)}(x) \varphi_2^{(e)} + ... ~ + N_n^{(e)}(x) \varphi_n^{(e)} = \sum_{i=1}^n N_i^{(e)} (x) \varphi_i^{(e)}$
• $N_1^{(e)}(x), ..., N_n^{(e)}(x)$ are, in this case, the polynomial interpolation functions defined for each subdomain or element, and $\varphi_i^{(e)}$ is the value of the solution for each node i;
• each $N_i^{(e)}(x)=1$ in their corresponding node i, and $N_i^{(e)}(x)=0$ for the rest of the nodes;

Some important aspects to consider in the shape functions are:

• if they present continuity over the domain (or subdomain);
• if they respect the boundary conditions (for example, if $\Gamma_0=0\frac{}{}$, then $N_i(x_0)=0 \frac{}{}$);

## One-dimensional Shape Functions A one-dimensional bar to be analysed using the finite element method (FEM) can be divided in N-1 elements (e) limited by their N nodes i: The solution $\varphi^{(e)} (x)$ for each element can be approached by their corresponding $\hat \varphi^{(e)} (x)$ to be expressed using the shape functions: $\varphi^{(e)}(x) \cong \hat \varphi^{(e)} (x) = \sum_{i=0}^1 N_i (x) \varphi_i$
If the shape functions are lineal polynomials, this expression becomes: $\hat \varphi^{(e)} (x) = \sum_{i=0}^1 \alpha_i x^i = \alpha_0 + \alpha_1 x$ Note that $x^{(e)}_1$ and $x^{(e)}_2$ are the first and second nodal coordinates of the element (e), where the solution $\varphi^{(e)}_1$ and $\varphi^{(e)}_2$, respectively, has to be obtained. \left . \begin{align} \hat \varphi^{(e)} (x_1) & = \varphi^{(e)}_1 = \alpha_0 + \alpha_1 x_1^{(e)} \\ \hat \varphi^{(e)} (x_2) & = \varphi^{(e)}_2 = \alpha_0 + \alpha_1 x_2^{(e)} \end{align} \right \} \Rightarrow \begin{bmatrix} 1 & x_1^{(e)} \\ 1 & x_2^{(e)} \end{bmatrix} \begin{bmatrix} \alpha_0 \\ \alpha_1 \end{bmatrix} = \begin{bmatrix} \varphi^{(e)}_1 \\ \varphi^{(e)}_2 \end{bmatrix} \left . \begin{align} \alpha_0 & = \varphi^{(e)}_1 - \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} x_1^{(e)} \\ \alpha_1 & = \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \end{align} \right \} \Rightarrow \hat \varphi^{(e)} (x) = \left( \varphi^{(e)}_1 - \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} x_1^{(e)} \right) + \left( \frac{\varphi^{(e)}_2 - \varphi^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right) x

This expression can be written in terms of the nodal values for the unknown: $\hat \varphi^{(e)} (x) = \underbrace {\left( \frac{x^{(e)}_2 - x} {x_2^{(e)}- x_1^{(e)} }\right)}_{N_1^{(e)}(x)} \varphi^{(e)}_1 + \underbrace {\left( \frac{x - x^{(e)}_1}{x_2^{(e)}- x_1^{(e)}} \right)}_{N_2^{(e)}(x)} \varphi^{(e)}_2$ $\hat \varphi^{(e)} (x) = N_1^{(e)}(x) \varphi^{(e)}_1 + N_2^{(e)}(x) \varphi^{(e)}_2 = \sum_{i=1}^2 N_i^{(e)}(x) \varphi^{(e)}_i$

Therefore, the shape forms can be expressed in terms of the nodal coordinates: \begin{align} N_1^{(e)}(x) & =\frac{x_2^{(e)} - x}{x_2^{(e)}-x_1^{(e)}} = \frac{x_2^{(e)} - x}{l^{(e)}} \\ N_2^{(e)}(x) & =\frac{x - x_1^{(e)}}{x_2^{(e)}-x_1^{(e)}} = \frac{x - x_1^{(e)}}{l^{(e)}} \end{align}

Again, note that the shape function corresponding to each node takes the unity value in that node and the zero value in the other: $N_1^{(e)}(x) = \begin{cases} 1, & x=x_1 \\ 0, & x=x_2 \end{cases} \qquad N_2^{(e)}(x) = \begin{cases} 0, & x = x_1 \\ 1, & x = x_2 \end{cases}$ More than two nodes can be used for each element. The following images show the shape functions for the quadratic (three nodes for each element) and cubic (four nodes for each element) case:  A detailed description of how to obtain these shape functions can help to understand the great importance of selecting the right order.

### One-dimensional Lagrangian Elements

The shape functions based in this kind of polynomials, equivalents to the polynomial Lagrange, give the name to a particular set of finite elements called the Lagrangian elements.
For this case, the shape functions can be written: $N_i^{(e)}(x)=\frac{(x - x_1)(x - x_2)... (x - x_{i-1})(x - x_{i+1})...(x - x_n)}{(x_i - x_1)(x_i - x_2)... (x_i - x_{i-1})(x_i - x_{i+1})...(x_i - x_n)}$ $N_i^{(e)}(x) = \prod_{j=1 (j \ne i)}^n \frac{x - x_j}{x_i - x_j}$

These expressions can be normalised using the natural coordinate system, based in $\frac{}{} \xi$, a variable defined in terms of $\frac{}{} x_c$, the central coordinate of the element, as follows: $\xi = 2 \frac{x - x_c}{l^{(e)}}$

Note that $\frac{}{} \xi = -1$ in the left node, $\frac{}{} \xi = 0$ in the central point of the element, and $\frac{}{} \xi = 1$ in the right node of the element.

For the Linear case, this transformation can be illustrated:  In this way, all the shape functions can be expressed and, therefore obtained, independently of the real geometry, and then easier to implement. $N_i^{(e)}(\xi) = \prod_{j=1 (j \ne i)}^n \left( \frac{\xi - \xi_j}{\xi_i - \xi_j} \right)$

The final specific expressions for the 1D Linear element are: $N_1^{(e)}(\xi) = \frac {\xi - \xi_2}{\xi_1 - \xi_2} = \frac{1}{2} (1 - \xi)$ $N_2^{(e)}(\xi) = \frac {\xi - \xi_1}{\xi_2 - \xi_1} = \frac{1}{2} (1 + \xi)$

Check other normalised shape functions for higher order elements.

## Two-dimensional Shape Functions

### The Three Node Linear Triangle

The solution $\varphi^{(e)} (x,y)$ for each triangular element can be approached by their corresponding $\hat \varphi^{(e)} (x,y)$ to be expressed using the shape functions: $\varphi^{(e)}(x,y) \cong \hat \varphi^{(e)} (x,y) = \sum_{i=1}^n N_i (x,y) \varphi^{(e)}_i$
If the shape functions are lineal polynomials (three-node triangular element, n=3), and remembering: $N_i^{(e)}(x_j,y_j) = \begin{cases} 1, & i = j \\ 0, & i \ne j \end{cases}$
this expression can be written as: $N_i^{(e)} (x,y) = \frac{1}{2 A^{(e)}} \left [ a_i^{(e)} + b_i^{(e)} x + c_i^{(e)} y \right ] \qquad$     with $A^{(e)} \,$ the element area and $i=1, 2, 3 \,$

And the system of equations is: $\begin{bmatrix} 1 & x_1^{(e)} & y_1^{(e)} \\ 1 & x_2^{(e)} & y_2^{(e)} \\ 1 & x_3^{(e)} & y_3^{(e)} \end{bmatrix} \begin{bmatrix} a_1^{(e)} & a_2^{(e)} & a_3^{(e)} \\ b_1^{(e)} & b_2^{(e)} & b_3^{(e)} \\ c_1^{(e)} & c_2^{(e)} & c_3^{(e)} \end{bmatrix} = 2 ·A^{(e)}· \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$

The element area is computed as the half of the determinant of the coordinates matrix: $2 ·A^{(e)} = \begin{vmatrix} 1 & x_1^{(e)} & y_1^{(e)} \\ 1 & x_2^{(e)} & y_2^{(e)} \\ 1 & x_3^{(e)} & y_3^{(e)} \end{vmatrix}$ Finally, the different parameters can be expressed in terms of the nodal local coordinates as: $a_i^{(e)}=x_j^{(e)}y_k^{(e)}-x_k^{(e)}y_j^{(e)}$ $b_i^{(e)}=y_j^{(e)}-y_k^{(e)}$ $c_i^{(e)}=x_k^{(e)}-x_j^{(e)}$

with $i=1,2,3; \quad j=2,3,1; \quad k=3,1,2 \,$

For a more detailed description, visit Two-dimensional Shape Functions