2
$\begingroup$

I am a bit confused with nodal basis functions $h_i$ and the corresponding lagrange polynomials $l_i$. For linear functions, it's quite clear, on $[x_0,x_1]$ the nodal basis is $h_0 = l_0 = 1-x$.

But with quadratic basis functions, there are $l_0^1 = 1-x^2$ and $l_0^2=\frac{(x-1)(x-2)}{2}$ associated with the node and the interval $[x_0,x_1]$. Further, the function $l_{-1}^3 = \frac{(x-0)(x-1)}{2}$ still has support from the left side as well.

In this graphic this seems to be resolved by taking an interval $[x_0,x_2]$ for quadratic elements.

I am currently trying to build some matrix $\langle h_i,h_j\rangle = \int h_i h_j$ and try to figure out, which functions need to be integrated together on an interval $[x_i, x_{i+1}]$. My current example is just a periodic 1D-Interval with edges $e_i = [x_i, x_{i+1}]$.

Now i am confused, if i want to use the $h_i$ functions for this, or $l_i$ functions, and if i need to have distinctions if i am using the corresponding function to the left or right side or how i match the overlapping intervals when using functions, which have a support bigger than one interval.

This is how my functions are overlapping on $[0,1]$ (so for example $1-x^2$ has support on two elements). centered functions left sided functions right sided functions

So there are six functions on each interval and three on each node, just as the graphic linked above. But there the interval $[0,2]$ is used, so that the $1-x^2$ function is $0$ outside with some inner node not belonging to other elements, while i have only nodes on the limits of the elements, so the function has support on two elements as well.

$\endgroup$
  • 1
    $\begingroup$ I might not have actually answered your question. Are you asking how to determine the basis functions of different orders or how to construct the mass/strain matrices basis on basis functions of different orders? I think I answered the first one, but now that I re-read your question I'm beginning to think you are asking the second. Could you elaborate on what you are having trouble with? $\endgroup$ – cbcoutinho Apr 21 '16 at 20:09
  • $\begingroup$ Yes, the question is not about the basis functions or interpolating with them, but about the integrals in the mass/stiffness matrices. Over the interval i have these six lagrange polynomials, belonging to four different nodes and i can't get my head around which functions need to be considered for $\int_0^1 h_i h_j$. $h_i, h_j$ are linear combinations of 3 functions, two having support on the interval. But from the global point of view, the 6 $l_i$ as in the graphs above have support on the interval. $\endgroup$ – allo Apr 22 '16 at 8:06
  • $\begingroup$ When solving, the matrix adds several $h_i$ together, so i guess the final sum involves all $l_i$ with support on the interval. But how to divide them into the matrix entries is not so obvious, when multiplying two of the hat functions. For linear elements it's easy as they only have support on one interval. For a interval twice as big it seems easy by taking some inner node, but that node then doesn't belong to other intervals as in my example. $\endgroup$ – allo Apr 22 '16 at 8:08
  • 1
    $\begingroup$ That is a much better way to phrase the question, I'm sorry I missed that in your original post. I'll see if I can write a second answer that elaborates on that aspect instead of editing my previous answer. $\endgroup$ – cbcoutinho Apr 22 '16 at 8:24
3
$\begingroup$

By using basis functions, you are stating how a variable changes between nodes by knowing only information at the nodes. These nodes are used to 'fit' a set of polynomial basis functions, and then the field variable you are interested in is then a summation of each basis function with the corresponding value of your field variable at each node. Mathematically, you would write that as:

$$ \phi = \sum_{i=1}^N H_i\hat{\phi}_i, \forall i$$

where $N$ is the number of basis functions, and $H$ is the basis function itself, and $\hat{\phi}$ is the value of your field variable at the nodes. This is equivalent to the dot product of the vector of basis functions and the vector of nodal values, respectively:

$$ \phi = \underline{H} \cdot \underline{\hat{\phi}} $$

For every set of basis functions, the required number of points is dependent on the order of the basis function you want to use. For a set of linear basis functions (order = 1), you need 2 points. For quadratic (order = 2), you need 3 points, and so forth. Basically, you need the lowest number of points to fully define the polynomial.

A quadratic basis function has the form: $$ H_i = \alpha_i + \beta_i x + \gamma_i x^2 $$

Since it is quadratic, you need three points. Let's say we have $x = [x_1, x_2, x_3]$, then you could set up the following three equations for your first basis function to determine the polynomial coefficients, where it equals 1 at $x_1$ and 0 at the other nodes:

$$ \begin{array}{r c l} H_1 = \alpha_1 + \beta_1 x_1 + \gamma_1 x_1^2 = 1 \\ H_1 = \alpha_1 + \beta_1 x_2 + \gamma_1 x_2^2 = 0 \\ H_1 = \alpha_1 + \beta_1 x_3 + \gamma_1 x_3^2 = 0 \\ \end{array} $$

NOTE: It's important to state that at a basis node $x_i$, only the corresponding basis function $H_i$ has a non-zero value of 1, all the others are 0. In other words $H_i(x_j) = \delta_{ij}$.

You could solve this anyway you like, but I prefer putting it all together and solving for the coefficients using linear algebra:

$$ \left[ \begin{matrix} 1 & x_1 & x_1^2 \\ 1 & x_2 & x_2^2 \\ 1 & x_3 & x_3^2 \\ \end{matrix} \right] \left[\begin{matrix} \alpha_1 & \alpha_2 & \alpha_3 \\ \beta_1 & \beta_2 & \beta_3 \\ \gamma_1 & \gamma_2 & \gamma_3 \\ \end{matrix}\right] = \left[\begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{matrix}\right] $$

Plugging in your solution for $\alpha_i, \beta_i, $ and $\gamma_i, \forall i$ back into the basis equations gives you your set of fitting polynomials, which combine together using our original equation of:

$$ \phi = \sum_{i=1}^N H_i\hat{\phi}_i, \forall i$$

I used a sample set of values (y = [2 3 1.5]) at x = [-1, 0, 1], and this was the end result. You see how a quadratic function fits through the three original points, and that the three basis functions themselves are the 'weights' of the sample points showing how the field variable changes between the basis nodes.

enter image description here

$\endgroup$
1
$\begingroup$

I don't completely understand your question. The shape functions for a quadratic element are plotted below.

enter image description here

Since the dimension of the space is 3, one needs 3 functions in the basis. They are well defined since they must satisfy the conditions $\phi_i(x_j) = \delta_{ij}$. This gives 3 conditions, which completely determines a quadratic polynomial.

$\endgroup$
  • $\begingroup$ Using this i get three functions, which are 1 at any point. When i now look at the interval $[0,1]$ for interpolation, i have four functions with support there, two defined on $[-1,1]$ and two defined on $[0,2]$. On each node i have three functions (lets say $\ell_j$)being $0$ there, so $h_i = \sum_j \ell_j$ interpolates on $[i-1, i+1]$. The question now is, which $\ell_j$ or $h_i$ are relevant to integrate $h_i h_j$ over $[0,1]$ when $h_j$ as test function is quadratic as well. I added a image of the overlapping functions to the question. $\endgroup$ – allo Apr 21 '16 at 8:38
  • $\begingroup$ $\sum \ell_j/3$ are with $\ell_j$ being $1$ on the node $i$. $\endgroup$ – allo Apr 21 '16 at 8:48
  • $\begingroup$ @allo, sorry, but I still don't understand what is your purpose. $\endgroup$ – nicoguaro Apr 21 '16 at 18:15
  • $\begingroup$ In the end the purpose is to build a system matrix with $\int h_i h_j$. This needs the integrals on one element, which should be $[x,x+h]$, while the quadratic functions are defined on an intervals $[x-h, x+h], [x-2h,x]$ and $[x,x+2h]$. In your image, i think you have the same as in my weblink above, using an element of width $2h$ for the functions. But my question is how to define the integral over an interval of $h$. Or if there is another easy to understand way to build the matrix. $\endgroup$ – allo Apr 22 '16 at 8:56
  • $\begingroup$ @allo, is your question about the size of the element then? How to compute the integrals when the size changes? $\endgroup$ – nicoguaro Apr 22 '16 at 14:00
1
$\begingroup$

My first answer focused on how to define the basis functions themselves; however, that didn't answer your question. Here I will describe how that relates to the mass/stiffness matrices.


Background

I'm going to explain how to build a mass matrix based on a continuous Galerkin approach to the finite element method using the 1D diffusion problem as an example:

$$ \nabla^2 \phi - f = 0$$

A quick step back into the FEM formulation, we want to convert our problem into a finite element problem. We start by making the assumption that we can represent the true solution by only using a finite number of nodes. We'll call the true solution $ \phi$ and the finite element solution $\hat{\phi}$. Our solution probably won't be perfect because of the approximation, but it'll be good enough. Another way of saying that is by calling it a residual:

$$\mathcal{R}\left( \hat{\phi} \right) = \nabla^2\hat{\phi} -f \cong 0 $$

We're now going to multiply our residual function with our finite element test functions, integrate that over the domain, and set the integral to zero (excellent analogy for why here). We end up with this statement:

$$ \int_\Omega \underline{N} \mathcal{R} \left( \hat{\phi} \right) \partial \Omega = \int_\Omega \underline{N} \left( \nabla^2\hat{\phi} -f \right) \partial \Omega = 0 $$

or

$$ \int_\Omega \underline{N} \left( \nabla^2\hat{\phi} \right) \partial \Omega = \int_\Omega \underline{N} \left( f \right) \partial \Omega $$

$\underline{N}$ is a vector of basis functions (length = number of nodes) used to discretize the system. $\hat{\phi}$ is the approximate solution to our problem, which is interpolated by a polynomial within each element. For the linear case, traversing along the element $s$ = [-1 1]:

$$ \hat{\phi}(s) = N_1(s)\tilde{\phi}_1 + N_2(s)\tilde{\phi}_2 = \underline{N}^T \underline{\tilde{\phi}}$$

Likewise, for the quadratic case:

$$ \hat{\phi}(s) = N_1(s)\tilde{\phi}_1 + N_2(s)\tilde{\phi}_2 + N_3(s)\tilde{\phi}_3 = \underline{N}^T \underline{\tilde{\phi}}$$

We're going to discretize the domain using 3 linear elements ($l_{1-3}$), which results in 4 nodes ($\tilde{\phi}_{1-4}$). Let's also assume we have Dirichlet boundaries at the ends $(\tilde{\phi}_{1} = \tilde{\phi}_{L} ~,~ \tilde{\phi}_{4} = \tilde{\phi}_{R})$:


It's common to construct the mass matrix in a block pattern, where we first create an elemental mass matrix corresponding to each element, and then fill it into the global mass matrix. Therefore, we are going to isolate our original equation to the first element:

$$ \int_{\Omega_1} \underline{N} \left( \nabla^2\hat{\phi} \right) \partial \Omega_1 = \int_{\Omega_1} \underline{N} \left( f \right) \partial \Omega_1 $$

And we are going to replace $\hat{\phi}$ with $\underline{N}^T \underline{\tilde{\phi}}$:

$$ \int_{\Omega_1} \underline{N} \left( \nabla^2 (\underline{N}^T \underline{\tilde{\phi}}) \right) \partial \Omega_1 = \int_{\Omega_1} \underline{N} \left( f \right) \partial \Omega_1 $$

Now I'm not going to go into these steps, but needless to say we can use integration by parts to convert the second derivative into a first derivative, after which you end up with this:

$$ \int_{\Omega_1} \frac{\partial\underline{N}}{\partial x} \frac{\partial\underline{N}^T}{\partial x} \underline{\tilde{\phi}} \partial \Omega_1 = \int_{\Omega_1} \underline{N} \left( f \right) \partial \Omega_1 $$


The answer to your question

Now I think you're asking, how do you turn this integral into an elemental matrix, which you are later going to add to the global matrix. And specifically, what is the influence of nodes using basis functions of higher order than 1? Well, going back to the linear element case, there are two nodes per element. That means the size of $\underline{N}$ is $(2,1)$. The resulting elemental block matrix is then:

$$ \left[ \begin{matrix} \int_{\Omega_1} \frac{\partial N_1}{\partial x} \frac{\partial N_1}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_1}{\partial x} \frac{\partial N_2}{\partial x} \partial \Omega_1 \\ \int_{\Omega_1} \frac{\partial N_2}{\partial x} \frac{\partial N_1}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_2}{\partial x} \frac{\partial N_2}{\partial x} \partial \Omega_1 \\ \end{matrix} \right] $$

For a quadratic element, there are 3 nodes. The resulting elemental block matrix has to reflect that, and is:

$$ \left[ \begin{matrix} \int_{\Omega_1} \frac{\partial N_1}{\partial x} \frac{\partial N_1}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_1}{\partial x} \frac{\partial N_2}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_1}{\partial x} \frac{\partial N_3}{\partial x} \partial \Omega_1 \\ \int_{\Omega_1} \frac{\partial N_2}{\partial x} \frac{\partial N_1}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_2}{\partial x} \frac{\partial N_2}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_2}{\partial x} \frac{\partial N_3}{\partial x} \partial \Omega_1 \\ \int_{\Omega_1} \frac{\partial N_3}{\partial x} \frac{\partial N_1}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_3}{\partial x} \frac{\partial N_2}{\partial x} \partial \Omega_1 & \int_{\Omega_1} \frac{\partial N_3}{\partial x} \frac{\partial N_3}{\partial x} \partial \Omega_1 \\ \end{matrix} \right] $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.