FEM Method for the Wave Equation

Click For Summary

Discussion Overview

The discussion revolves around the application of the finite element method (FEM) to a one-dimensional wave equation. Participants explore the formulation of the wave equation in the context of FEM, addressing challenges related to the input function and the nature of the solution.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses confusion about applying FEM to the wave equation, particularly regarding the role of the function ##f(x)## when it is related to ##T(x)##.
  • Another participant discusses the formulation of the wave equation as a PDE and derives a system of ODEs, indicating that the test functions ##N_i## are used to approximate ##T##.
  • A later reply confirms the successful application of FEM to the problem, sharing a plot comparing numerical results to an analytical solution.
  • Another participant questions the nature of the input function ##f(x)## in the wave equation, noting its role as a constant and its influence on the amplitude, while seeking justification for its value.

Areas of Agreement / Disagreement

Participants appear to have differing views on the nature and role of the input function ##f(x)## in the wave equation, with no consensus reached on its justification or specific value. The application of FEM itself seems to have been successfully demonstrated by one participant, but the discussion on the input function remains unresolved.

Contextual Notes

There are limitations regarding the assumptions made about the input function ##f(x)## and its dependence on the specific context of the wave equation. The discussion also reflects the complexity of transitioning from PDEs to ODEs in the FEM framework.

bob012345
Gold Member
Messages
2,323
Reaction score
1,041
TL;DR
How to set up the Finite Element Method of a 1D Wave Equation.
I am trying to understand how to apply the finite element method for a simple 1D wave equation with four elements for learning purposes.

$$\frac{d^2 T(x)}{dx^2} = -f(x)$$

I am stuck because the structure of the equations set up in Numerical Methods for Engineers by Chapra and Canale as shown here seems to assume one knows what the function ##f(x)## is. What if ##f(x)## is ##T(x)## as in the wave equation? Is that case doable? Thanks.

0.jpg
 
  • Like
Likes   Reactions: Delta2
Physics news on Phys.org
I assume N_i are test functions with T approximated by T_1N_1(x) + T_2N_2(x). If so, then \frac{d^2T}{dx^2} + kT(x) = -f(x) where f is a known source term gives <br /> \begin{multline*}<br /> \int_{x_1}^{x_2} N_i(x)\frac{d^2T}{dx^2} + kN_i(x)T(x) + N_i(x)f(x)\,dx \\=<br /> \left[ N_i(x)\frac{dT}{dx}\right]_{x_1}^{x_2} <br /> +\int_{x_1}^{x_2} -\frac{dN_i}{dx}\frac{dT}{dx} + kN_i(x)T(x) + N_i(x)f(x)\,dx<br /> \end{multline*} which results in <br /> \begin{multline*}<br /> \begin{pmatrix}<br /> \int_{x_1}^{x_2} \left(\frac{dN_1}{dx}\right)^2\,dx &amp; \int_{x_1}^{x_2} \frac{dN_1}{dx}\frac{dN_2}{dx} \,dx \\<br /> \int_{x_1}^{x_2} \frac{dN_1}{dx}\frac{dN_2}{dx} \,dx &amp; \int_{x_1}^{x_2} \left(\frac{dN_2}{dx}\right)^2\,dx<br /> \end{pmatrix}<br /> \begin{pmatrix} T_1 \\ T_2 \end{pmatrix} \\<br /> - k\begin{pmatrix} \int_{x_1}^{x_2} N_1^2(x)\,dx &amp; \int_{x_1}^{x_2} N_1(x)N_2(x)\,dx \\<br /> \int_{x_1}^{x_2} N_1(x)N_2(x)\,dx &amp; \int_{x_1}^{x_2} N_2^2(x)\,dx \end{pmatrix}<br /> \begin{pmatrix} T_1 \\ T_2 \end{pmatrix} \\<br /> = <br /> \begin{pmatrix}<br /> N_1(x_2) \frac{dT}{dx}(x_2) - N_1(x_1) \frac{dT}{dx}(x_1) \\<br /> N_2(x_2) \frac{dT}{dx}(x_2) - N_2(x_1) \frac{dT}{dx}(x_1) \end{pmatrix} +<br /> \begin{pmatrix}<br /> \int_{x_1}^{x_2} N_1(x)f(x)\,dx \\ <br /> \int_{x_1}^{x_2} N_2(x)f(x)\,dx<br /> \end{pmatrix}.\end{multline*} I'm sure the authors will give an example of this at some point.

The wave equation is actually a PDE, so T_1 and T_2 are not constants but functions of time. You therefore end up with the system of ODEs <br /> A\begin{pmatrix} \frac{d^2T_1}{dt^2} \\ \frac{d^2T_2}{dt^2} \end{pmatrix} = -c^2 B \begin{pmatrix} T_1 \\ T_2 \end{pmatrix} + (\mbox{boundary terms}) where B is the stiffness matrix and <br /> A = \begin{pmatrix} \int_{x_1}^{x_2} N_1^2(x)\,dx &amp; \int_{x_1}^{x_2} N_1(x)N_2(x)\,dx \\<br /> \int_{x_1}^{x_2} N_1(x)N_2(x)\,dx &amp; \int_{x_1}^{x_2} N_2^2(x)\,dx \end{pmatrix}.
 
  • Like
Likes   Reactions: Delta2 and bob012345
I worked it out and it works great! Thanks. Here is a plot of the points calculated by the Finite Element Method as compared to the exact analytical solution ##\psi(x)= \sqrt{\frac{2}{10}}sin(\frac{\pi x}{10})## of an infinite potential well of width 10 units.;

desmos-graph (7).png
 
Last edited:
  • Like
Likes   Reactions: Delta2
What does the input function ##f(x)## represent in the case of a wave equation? I know from experience it is a constant and it is necessary to solve the linear equations. I also noticed it can be scaled to get the amplitude I want but I am having trouble justifying it and what value to give it.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K