0% found this document useful (0 votes)
93 views17 pages

Numerical Modelling Workshop

The document is a final report summarizing the use of numerical modeling to solve a physical problem represented by the wave equation. It describes: 1) The wave equation and its analytical solution using separation of variables. 2) The specific physical problem of modeling string oscillation with fixed ends. 3) The numerical solution using the finite difference method to transform the PDE into algebraic equations solved using MATLAB code. 4) A stability check showing the numerical solution is stable with a sufficiently small time step.

Uploaded by

sherif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views17 pages

Numerical Modelling Workshop

The document is a final report summarizing the use of numerical modeling to solve a physical problem represented by the wave equation. It describes: 1) The wave equation and its analytical solution using separation of variables. 2) The specific physical problem of modeling string oscillation with fixed ends. 3) The numerical solution using the finite difference method to transform the PDE into algebraic equations solved using MATLAB code. 4) A stability check showing the numerical solution is stable with a sufficiently small time step.

Uploaded by

sherif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

UGA

Numerical Modelling Workshop Final Report


POLIMI-UGA ERASMUS EXCHANGE PROGRAM

Sherif Ahmed Fouad Mohamed Yehya


1-22-2021
Table of Contents
1. Introduction …………………………………………………………… 2
2. Wave Equation ………………………………………………………… 2
3. Physical Problem ……………………………………………………… 3
4. Analytical Solution …………………………………………………… 4
5. Numerical Solution …………………………………………………… 7
6. Stability Check …………………………………………………………… 11
7. Skills learnt and Problem Over tackled ……………………… 12
8. References ………………………………………………………………… 16

1
1. Introduction
The aim of this report is solving a physical problem represented by wave
equation, which is nothing but 2nd order partial differential equation using an
appropriate numerical methodology to model and solve our wave equation.
Besides, the numerical modelling we will go not so far through the analytical
solution of the wave equation to feel how much the numerical modelling
facilitate our way for solving the mathematical models.
2. Wave Equation
The wave equation is an important second-order linear partial
differential equation for the description of waves—as they occur in classical
physics—such as mechanical waves.
The wave equation is one of the most important equations in mechanics. It
describes not only the movement of strings and wires, but also the movement
of fluid surfaces, e.g., water waves. The wave equation is surprisingly simple to
derive and not very complicated to solve although it is a second order PDE.
The equation is a good description for a wide range of phenomena because it is
typically used to model small oscillations about an equilibrium, for which
systems can often be well approximated by Hooke's law. Solutions to the wave
equation are of course important in fluid dynamics, but also play an important
role in electromagnetism, optics, gravitational physics, and heat transfer.
Especially important are the solutions to the Fourier transform of the wave
equation, which define Fourier series, spherical harmonics, and their
generalizations.
The wave equation for a plane wave traveling in the x direction is

where v is the phase velocity of the wave and y represents the variable, which
is changing as the wave passes. This is the form of the wave equation which
applies to a stretched string or a plane electromagnetic wave. The
mathematical description of a wave makes use of partial derivatives.

2
In two dimensions, the wave equation takes the form:

which could describe a wave on a stretched membrane.

3. Physical Problem
Our physical problem is to model and solve an oscillation of an elastic
string with 2 fixed ends as in figure 1:

Figure 1
So, we assume that the problem is 1D problem represented by the simple form
of the wave equation:

=𝑐 ------------------------------------ (1)

 U: vertical displacement
 C: wave propagation speed in m/s
 x: spatial coordinate
 t: time
 C^2=T/R T: force of tension on the string R: Mass per unit length
 BCs: U (0, t)=0 U (L, t)=0 L: the length of the string
 ICs: U(x,0)=F(x) Ut(x,0)=G(x)

3
My assumptions in the problem:
 Thin flexible string with negligible weight
 The two ends of the string are clamped, so the displacements are zero at the ends
 Initial displacement profile is given
 Initial velocity is considered zero

4. Analytical Solution Overview


 The main objective of the analytical solution is verifying our numerical
solution and fell how the numerical solution is useful specially when the
PDE become more complex.

 Give us an exposure about how the numerical solution should behave.

=𝑐

So, we will use separation of variables technique which we can convert the 2nd
order PED to 2 ODES easy to solve.
Step 1:
Apply the method of Separation of variables obtain 2 ODEs to from PED.
Step 2:
Determine solution for ODEs satisfy BCs.
Step 3:
Use Fourier’s series for compose solution from step 2 to get a solution to PDE
that also satisfy the ICs.
1. 𝑢 = 0 @ 𝑢(0, 𝑡 )
2. 𝑢 = 0@𝑢(𝑙, 𝑡)

Left and right side pinned.

4
ICS:
1. 𝑈(𝑋, 0) = 𝐹(𝑋)
F(x) specify initial deflection.
2.Ut (𝑡 = 𝑜) = 𝑔(𝑥)
G(x) specify initial velocity profile assume ~ 0 means string was not in motion.

Step 1: apply separation of var method.


Assume
𝑢(𝑥, 𝑡) = 𝑓(𝑥) G(𝑡)

= 𝑓(𝑥) 𝑔(𝑡) _----------------------------(1)

= 𝑓(𝑥) 𝑔(𝑡) _2

By using 1,2 in 1_D wave eqn.


∴ 𝑓𝑔 = 𝑐 𝑓𝑔 (divided by 𝑐 𝑓𝑔 )

= = 𝑅 (R means separation constant)

Here we separated the variables!


Now we have 2 ODEs.
1. 𝑔(𝑡) − 𝑐 𝑘 𝑔(𝑡) = 0 _1
2. 𝑓(𝑥) − 𝑅 𝑓(𝑥) = 0 _2
Second order linear ODE
Step 2: satisfy BCs.
𝑢(𝑜, 𝑡) = 0 = 𝑓(0) 𝑔(𝑡) left side 1.
𝑢(𝑙, 𝑡) = 0 = 𝑓(𝑙) 𝑔(𝑡) right side 2
For 1 𝑓(0)𝑔(𝑡) = 0
𝑓(𝑜) = 0 𝑔(𝑡) = 0
So, 𝑓(𝑜) = 𝑓(𝑙) = 0
So, for 𝑓(𝑥) − 𝑅 𝑓(𝑥) = 0

5
Mechanical analogy undamped oscillator
Not trivial only if K< 0 lets assume it k= −𝑝
𝑓(𝑥) = 𝐴 cos 𝑃𝑋 + 𝐵 sin 𝑃𝑋
Applying the 2 BCs we get:

A= 0 P= 𝑁∈𝑍

SO, Fn (x) =B sin 𝑥 𝑛 ∈ 𝑧 family of solution n: frequency

With same procedures

Gn (t) = Bn cos(𝜆𝑛𝑡) + 𝐵𝑛 sin(𝜆𝑛𝑡 ) 𝑛 ∈ 𝑧 𝜆𝑛 =

So, we get Un (𝑥, 𝑡) = 𝐹𝑛 (𝑥) 𝐺𝑛 (𝑡)

Un (𝑥, 𝑡) = [𝐵𝑛 cos 𝜆𝑛𝑡 + 𝐵𝑛 sin 𝜆𝑛𝑡] sin ----------------- (*)

Eigen functions satisfying the BCs.


Step 3: using Fourier series to get Bn
Using the ICs 𝑢(𝑥, 0) = 𝑓(𝑥) (position)
So, by sub in (*)

𝑛𝜋𝑥
𝐵𝑛 sin = 𝑓(𝑥)
𝑙

Using Fourier Bn= ∫ 𝑓(𝑥) sin 𝑑𝑥

Same way using ICs Ut(𝑥, 0) = 𝑔(𝑥) (velocity)

𝐵𝑛 = ∫ 𝑔 𝑥 sin 𝑑𝑥 𝑛𝜖𝑧

6
For solving the equations check MATLAB numerical code in appendix 1, Here is
the simulation results of the analytical solution:

Figure 2: the simulation results of the analytical solution

5. Numerical Solution
We are going to attempt to solve this physical problem using the finite
difference method as an application of the numerical mythology for
solving the mathematical models.

5.1 Finite difference method


The finite difference method was among the first approaches applied to the
numerical solution of differential equations. It was first utilised by Euler,
probably in 1768. The finite difference method is directly applied to the
differential form of the governing equations.
finite-difference methods (FDM) are a class of numerical techniques for
solving differential equations by approximating derivatives with finite
differences. Both the spatial domain and time interval (if applicable)
are discretized, or broken into a finite number of steps, and the value of the
solution at these discrete points is approximated by solving algebraic equations
containing finite differences and values from nearby points.

7
Finite difference methods convert ordinary differential equations (ODE)
or partial differential equations (PDE), which may be nonlinear, into a system of
linear equations that can be solved by matrix algebra techniques. Modern
computers can perform these linear algebra computations efficiently which,
along with their relative ease of implementation, has led to the widespread use
of FDM in modern numerical analysis. Today, FDM are one of the most
common approaches to the numerical solution of PDE, along with finite
element methods.

 Finite Difference Method Main Goals


1. Replace the PDEs with algebraic equations
2. Solve the algebraic equations to develop algorithm.
 FDM Techniques
1. Forward difference
2. Backward difference
3. Centred difference
As we are dealing with 2nd order partial differential equation the most
appropriate scheme to use is centred difference method

Figure 2: Finite difference method schemes

8
Central difference formulas from the Taylor’s series expansion:

Solution Steps:

9
Transformation to algebraic equation:

Three level of time needed at T=0

10
Now we can code our system of equations using MATLAB (Appendix 2) to
simulate the solution of the wave equation using the numerical method.

Figure 3: Simulation Results of the Numerical Solution

11
6. Numerical Stability Check
For the scheme to be numerically stable, you have to choose sufficiently
small-time steps.

The MATLAB code result regarding the stability check:

The results analysis and comparison between the numerical and


analytical solution:
Analytical Numerical

Inputs Inputs
L=4 L=4
C=400 C=400
T=0.01 sec T=0.01 sec

Initial conditions Initial conditions


f(X)=sin(n*pi*x) f(X)=sin(n*pi*x)
g(x)=0 g(x)=0

Bondaroy Conditions Bondaroy Conditions


u (0, t) =0 u (0, t) =0
u (L, t) =0 u (L, t) =0

Output Output
Max(u)=1.4 Max(u)=1.35

12
7. Skills Learnt and Problems over tackled
Through this workshop I have learnt the concept of mathematical
modelling and the how to think regarding the modelling of a specific
physical problem to be modelled in mathematical form to be ready for
solving either in analytical method or numerical method.

This way of thinking is essential for engineers as transforming the physical


problem into a mathematical set of equation is a fundamental
engineering concept.

After that, I have got a dive through the analytical solution I have learnt
what is meant by the method of characteristics and how to use it to
transform the PDEs into ODE can be treated in much easier way and
solved, besides that I touched myself the importance of a preliminary
analytical solution for giving me an idea about the results that I should
obtain from the numerical model.

Heading to the main objective of this workshop, which is learning the


different numerical methods, So I have studied the finite difference
method and understood its concept and different schemes, Then I have
managed to code the set of algebraic equations resulted from the central
difference scheme using MATLAB programming language with improved
my skills a bit, it is illustrated in appendix section.

Through this journey in accompany with the equations I faced many


problems regarding the PDEs concepts and properties as mathematics is
not my major but by self-searching and learning I managed to overcome
this point and go directly achieving the objective of the workshop.

13
APPENDIX 1
ANALYTICAL SOLUTION MATLAB CODE

14
APPENDIX 2
NUMERICAL SOLUTION MATLAB CODE

15
REFRENCES

1. C:/Dokumente und Einstellungen/Erich/Eigene Dateien/paper/vorlpde1/pdebook.dvi (uni-


leipzig.de)
2. Introductory Finite Difference Methods for PDEs (man.ac.uk)
3. Numerically Solving Partial Differential Equations - YouTube

16

You might also like