FE 1D method and hat functions

  • Context: MHB 
  • Thread starter Thread starter Carla1985
  • Start date Start date
  • Tags Tags
    1d Functions Method
Click For Summary

Discussion Overview

The discussion revolves around the finite element method (FEM), specifically focusing on the use of hat functions and their application in constructing piecewise linear functions. Participants explore the formulation of these functions, their properties, and the implications for calculations involving differentiation and integration.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • Carla introduces the definition of hat functions and expresses confusion about summing them in their general form.
  • Some participants suggest visualizing the functions and their combinations to better understand the piecewise nature of the solution.
  • There is a discussion about how the coefficients scale the hat functions and how this affects the overall shape of the combined function.
  • Carla raises a concern about performing calculations involving multiple equations, particularly with differentiation and multiplication of the hat functions.
  • Another participant clarifies that the piecewise function can be analyzed one piece at a time, which simplifies the calculations.
  • Carla mentions the need to calculate integrals involving the derivatives of the hat functions to build a matrix for solving coefficients.
  • Participants discuss the cases for the integrals based on the relationship between indices \(i\) and \(j\), leading to different outcomes depending on whether they are equal, differ by one, or differ by more than one.
  • There is a back-and-forth about the correctness of the reasoning regarding the areas under the curves of the hat functions and how they contribute to the integrals.

Areas of Agreement / Disagreement

Participants generally agree on the definitions and properties of the hat functions, but there are varying interpretations regarding the calculations involving their derivatives and integrals. The discussion remains unresolved on some of the finer points of these calculations.

Contextual Notes

Participants note that the calculations depend on the specific values of \(h\) and the relationships between the indices \(i\) and \(j\). There are also assumptions about the piecewise nature of the functions that influence the integration results.

Who May Find This Useful

This discussion may be useful for students or practitioners working on finite element methods, particularly those interested in the mathematical foundations of piecewise functions and their applications in numerical analysis.

Carla1985
Messages
91
Reaction score
0
Hi all, I'm doing a project on the finite elements method and am struggling to understand a part of it.

I have defined the hat functions as:

\[
\phi_i(x) =
\begin{cases}
\frac{x-x_{i-1}}{h} & \text{if } x_{i-1}\leq x<x_i \\
\frac{x_{i+1}-x}{h} & \text{if } x_i\leq x<x_{i+1}\\
0 & \text{otherwise}
\end{cases}
\]

I know this means that for each $\phi_i(x_i)$ is 1 when i=j and 0 the rest of the time. The part I'm stuck on is the next step:

\[
u_h(x) = \sum_{j=1}^{n-1}c_j\phi_j(x)
\]

How do I sum these functions in their general form?

Regards
Carla
 
Last edited by a moderator:
Mathematics news on Phys.org
Carla1985 said:
Hi all, I'm doing a project on the finite elements method and am struggling to understand a part of it.

I have defined the hat functions as:

\[
\phi_i(x) =
\begin{cases}
\frac{x-x_{i-1}}{h} & \text{if } x_{i-1}\leq x<x_i \\
\frac{x_{i+1}-x}{h} & \text{if } x_i\leq x<x_i{i+1}\\
0 & otherwise
\end{cases}
\]

I know this means that for each $\phi_i(x_i)$ is 1 when i=j and 0 the rest of the time. The part I'm stuck on is the next step:

\[
u_h(x) = \sum_{j=1}^{n-1}c_j\phi_j(x)
\]

How do I sum these functions in their general form?

Regards
Carla

Hey Carla! ;)

I think it would help if you visualize it.

Suppose we pick $h=1$ and $c_1=2, c_2=3,c_3=1$.
Can you draw each $\phi_i$?
And then draw the combined $u_h$?

What does $u_h$ look like?
Can you come up with a general form for its formula?
 
I like Serena said:
Hey Carla! ;)

I think it would help if you visualize it.

Suppose we pick $h=1$ and $c_1=2, c_2=3,c_3=1$.
Can you draw each $\phi_i$?
And then draw the combined $u_h$?

What does $u_h$ look like?
Can you come up with a general form for its formula?

I know the c's scale each of the hats so at i=1 there would be a point of height 2, at i=2 a point at height 3 etc, combining these would give a piecewise polynomial of straight lines between each point, so a line from (1,2) to (2,3) etc. I'm not sure how I get a general form from that though
 
Carla1985 said:
I know the c's scale each of the hats so at i=1 there would be a point of height 2, at i=2 a point at height 3 etc, combining these would give a piecewise polynomial of straight lines between each point, so a line from (1,2) to (2,3) etc. I'm not sure how I get a general form from that though

Indeed, if we pick $x$ between $x_i$ and $x_{i+1}$, we can find $u_h(x)$ as a linear interpolation between $c_i$ and $c_{i+1}$.
A linear interpolation is the same as a weighted average:
$$u_h(x) = \frac{(x-x_i)c_{i+1} + (x-x_{i+1})c_{i}}{x_{i+1}-x_{i}}\qquad\text{if }x_i \le x < x_{i+1}$$
Or:
$$u_h(x) = \frac{x-x_i}{h}c_{i+1} + \frac{x-x_{i+1}}{h}c_{i}\qquad\quad\text{if }x_i \le x < x_{i+1}$$
 
I like Serena said:
Indeed, if we pick $x$ between $x_i$ and $x_{i+1}$, we can find $u_h(x)$ as a linear interpolation between $c_i$ and $c_{i+1}$.
A linear interpolation is the same as a weighted average:
$$u_h(x) = \frac{(x-x_i)c_{i+1} + (x-x_{i+1})c_{i}}{x_{i+1}-x_{i}}\qquad\text{if }x_i \le x < x_{i+1}$$
Or:
$$u_h(x) = \frac{x-x_i}{h}c_{i+1} + \frac{x-x_{i+1}}{h}c_{i}\qquad\quad\text{if }x_i \le x < x_{i+1}$$
Ok, I think I understand that, though I'm still struggling to get my head around working with a function that has more than one equation. For example I have differentiations and multiplications eg $\phi^1_1\phi^1_2$ and $f\phi_1$ etc. How can I do those sort of calculations without one equation?
 
Carla1985 said:
Ok, I think I understand that, though I'm still struggling to get my head around working with a function that has more than one equation. For example I have differentiations and multiplications eg $\phi^1_1\phi^1_2$ and $f\phi_1$ etc. How can I do those sort of calculations without one equation?

I'm not sure I understand what it is that you are struggling with.

It's a piece wise function.
The function is the same on each piece, just with a different $i$.
So we look at one piece at a time.
On one piece it is just one equation.

Anyway, what do you mean with those differentiations and multiplications?

Regards,
I like Serena
 
I like Serena said:
I'm not sure I understand what it is that you are struggling with.

It's a piece wise function.
The function is the same on each piece, just with a different $i$.
So we look at one piece at a time.
On one piece it is just one equation.

Anyway, what do you mean with those differentiations and multiplications?

Regards,
I like Serena

Sorry, I didn't explain very well. A further step is to calculate $\int^1_0\phi '_i\phi '_j\ dx$ but $\phi '_i$ can be $\frac{1}{h}$, $-\frac{1}{h}$ or $0$, same for $\phi '_j$.

I'm calculating these to build a matrix to solve for c's.
 
Carla1985 said:
Sorry, I didn't explain very well. A further step is to calculate $\int^1_0\phi '_i\phi '_j\ dx$ but $\phi '_i$ can be $\frac{1}{h}$, $-\frac{1}{h}$ or $0$, same for $\phi '_j$.

I'm calculating these to build a matrix to solve for c's.

To calculate those, you will need to distinguish the cases:
  1. $i=j$
  2. $i$ and $j$ differ by $1$
  3. $i$ and $j$ differ by more than $1$
What would the integral look like in each of those cases?

ILS x
 
I like Serena said:
To calculate those, you will need to distinguish the cases:
  1. $i=j$
  2. $i$ and $j$ differ by $1$
  3. $i$ and $j$ differ by more than $1$
What would the integral look like in each of those cases?

ILS x
I'm not sure if its the right way of thinking about it but I think (taking h=1 for now) if i=j they are the squared terms so the differentials of 1 and then -1 are both squared hence both 1, so the graph would just be 1 between 0 and 1, then the area would be y=1. For i and j differ by 1, half of each hat would over lap, except one half would always be positive, the other negative so the area would be -1/2. Lastly if they differ by more than 1 it would be 0 as there would be no overlap. I think if h is different everything would be divided by h

Is that close?
 
  • #10
Carla1985 said:
I'm not sure if its the right way of thinking about it but I think (taking h=1 for now) if i=j they are the squared terms so the differentials of 1 and then -1 are both squared hence both 1, so the graph would just be 1 between 0 and 1, then the area would be 1. For i and j differ by 1, half of each hat would over lap, except one half would always be positive, the other negative so the area would be -1/2. Lastly if they differ by more than 1 it would be 0 as there would be no overlap. I think if h is different everything would be divided by h

Is that close?

Yep. Close.

Let's pick an arbitrary $h$.

Then we have:
$$\int_0^1 \phi_i'(x)\phi_j'(x) dx = \begin{cases}
\frac 1 h \cdot \frac 1 h \cdot h + -\frac 1 h \cdot -\frac 1 h \cdot h &\text{if }i=j \\
\frac 1 h \cdot -\frac 1 h \cdot h&\text{if }|i-j|=1 \\
0 &\text{otherwise}
\end{cases}$$

$$\int_0^1 \phi_i'(x)\phi_j'(x) dx = \begin{cases}
\frac 2 h &\qquad\qquad\qquad&\text{if }i=j \\
-\frac 1 h&&\text{if }|i-j|=1 \\
0 &&\text{otherwise}
\end{cases}$$
 
  • #11
Oh actually everything would be x2 as only each half of the hat is in one interval, so if h=1 half the hat area would be 1 but so would the other half so it would be 2 altogether

- - - Updated - - -

I like Serena said:
Yep. Close.

Let's pick an arbitrary $h$.

Then we have:
$$\int_0^1 \phi_i'(x)\phi_j'(x) dx = \begin{cases}
\frac 1 h \cdot \frac 1 h \cdot h + -\frac 1 h \cdot -\frac 1 h \cdot h &\text{if }i=j \\
\frac 1 h \cdot -\frac 1 h \cdot h&\text{if }|i-j|=1 \\
0 &\text{otherwise}
\end{cases}$$

$$\int_0^1 \phi_i'(x)\phi_j'(x) dx = \begin{cases}
\frac 2 h &\qquad\qquad\qquad&\text{if }i=j \\
-\frac 1 h&&\text{if }|i-j|=1 \\
0 &&\text{otherwise}
\end{cases}$$

Thank you! Its all just clicked into place, having a break helped to think of it differently :)
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
831