FE 1D method and hat functions

In summary: Regards,CarlaSorry, 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... something. sorry, can't remember what.
  • #1
Carla1985
94
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
  • #2
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?
 
  • #3
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
 
  • #4
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}$$
 
  • #5
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?
 
  • #6
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
 
  • #7
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.
 
  • #8
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
 
  • #9
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 :)
 

FAQ: FE 1D method and hat functions

What is the FE 1D method?

The Finite Element (FE) 1D method is a numerical technique used to solve partial differential equations (PDEs) in one-dimensional space. It involves dividing a continuous problem into smaller finite elements, solving for the approximate solution at each element, and then combining those solutions to approximate the overall solution.

How does the FE 1D method work?

The FE 1D method works by breaking down a continuous problem into smaller elements, usually in the form of line segments. These elements are connected at specific points called nodes, and the solution is approximated at each node using a combination of basis functions, such as hat functions. The solutions at each node are then combined to approximate the overall solution of the problem.

What are hat functions in the FE 1D method?

Hat functions are a type of basis function used in the FE 1D method. They are typically triangular-shaped functions that are zero at all nodes except for one, where they have a value of one. These functions are used to approximate the solution at each node and are combined to create a continuous solution throughout the entire domain.

What are the advantages of using the FE 1D method?

The FE 1D method has several advantages, including its ability to handle complex geometries and boundary conditions, its accuracy in approximating solutions, and its flexibility in using different types of basis functions. It also allows for easy refinement of the mesh, making it useful for solving problems with varying levels of detail.

What are some common applications of the FE 1D method?

The FE 1D method is commonly used in engineering and science fields for solving problems related to heat transfer, fluid dynamics, structural mechanics, and other physical phenomena. It is also used in the design and analysis of structures, such as bridges and buildings, and in the simulation of processes in various industries, such as aerospace, automotive, and biomedical.

Similar threads

Replies
8
Views
1K
Replies
1
Views
880
Replies
4
Views
2K
Replies
1
Views
10K
Replies
7
Views
2K
Replies
1
Views
2K
Replies
3
Views
1K
Back
Top