CVE 154 Lesson 1 Introduction To Numerical Solutions

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

CVE 154 – Statics of Rigid Bodies

LESSON 1:
INTRODUCTION TO
NUMERICAL SOLUTIONS
NUMERICAL SOLUTIONS
 Numerical methods or solutions are techniques developed to
solve mathematical problems using only the four basic arithmetic
operations of addition, subtraction, multiplication and division.

+ – * /
 These techniques require a large number of arithmetic
calculations to be performed repeatedly until an appropriate
answer with minimal error is arrived. Luckily, with the use of
computers, this task is now made easier. Hence, the usage of
these techniques to solve engineering problems have increased.
NUMERICAL SOLUTIONS
The mathematical problems we will be learning how to solve with
numerical solutions are the following types:

1. Roots of Equations. These problems are


concerned with the value of a variable or
a parameter that satisfies a single
nonlinear equation.
Solve for x when f(x) = 0

2. Systems of Linear Algebraic Equations.


These problems are concerned with
y
values that simultaneously satisfies a set
of linear algebraic equations.
Solve for x and y:
A1 x + B1 y = C1 x
A2 x + B2 y = C2
NUMERICAL SOLUTIONS
3. Curve Fitting. The problems here involves using regression, to fit a curve
that best match the trend of data points, or interpolation to find
intermediate data points from an established curve.

4. Integration. From a physical representation,


this involves finding the area under a curve
bounded by limits.
𝑏
I= 𝑎
𝑓(𝑥) dx
a b
NUMERICAL SOLUTIONS
5. Ordinary Differential Equations. We frequently see mathematical models
of engineering problems as ODEs since many physical laws are couched in
terms of the rate of change of a quantity rather than the magnitude of the
quantity itself

Given:
𝑑𝑥 Δ𝑥
≅ = 𝑓 𝑡, 𝑦
𝑑𝑡 Δ𝑡
Solve for y as a function of t
𝑦𝑖:1 = 𝑦𝑖 + 𝑓 𝑡𝑖 , 𝑦𝑖 Δ𝑡
MATHEMATICAL MODELING
 A mathematical model can be broadly defined as a formulation or equation
that expresses the essential features of a physical system or process in
mathematical terms. In general sense,
𝐷𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡 𝑖𝑛𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡 𝑓𝑜𝑟𝑐𝑖𝑛𝑔
=𝑓 , 𝑝𝑎𝑟𝑎𝑚𝑒𝑡𝑒𝑟𝑠,
𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛𝑠
where:
dependent variable = is a characteristic that usually reflects the behavior or
state of the system
independent variable = are usually dimensions, such as time and space,
along which the system’s behavior is being determined
parameters = are reflective of the system’s properties or composition
forcing functions = are external influences acting upon the system
MATHEMATICAL MODELING
 Take Newton’s 2nd Law 𝐹 = 𝑚𝑎. Writing it in the same format, we get:
𝐹
𝑎=
𝑚
where:
𝑎 = acceleration (the dependent variable reflecting the systems behavior)
𝐹 = net force (the forcing function)
𝑚 = mass (a parameter reflecting a property of the system)
Note that there is no independent variable, since we are not yet predicting how
acceleration varies with time and space.
 This model in its algebraic form is very simple. Hence, a solution can be easily
solved without the use of numerical solutions.
MATHEMATICAL MODELING
 To demonstrate a more complex mathematical model of a
physical phenomena, we derive a model that modifies
Newton’s 2nd Law. For example, if we are asked to
determine the terminal velocity of a free falling body near
the earth’s surface such as a parachutist.
 Let us represent the acceleration the parachutist
experiences as the rate of change of velocity with respect
to time:
𝑑𝑣
𝑎=
𝑑𝑡

 From the figure, we can see 2 external forces that affect the
system. Assuming forces directed downwards are positive,
the net force the body experiences is :
𝐹 = 𝐹𝐷 + −𝐹𝑈
𝐹 = 𝐹𝐷 − 𝐹𝑈
MATHEMATICAL MODELING
 In this system, the downward force 𝐹𝐷 would be due to gravity
𝐹𝐷 = 𝑚𝑔
where 𝑔 is the acceleration due to gravity.
 The upward force 𝐹𝑈 would be due to air resistance (drag). This is usually
represented by a linear relationship between force and velocity of the body.
Imagine you are riding a car. When you lower the windows and extend your
hand outside, you would suddenly feel that your hand is being pushed back by
some imaginary force. Then, as the car speeds up, the force pushing your
hand back would also feel stronger. This is air resistance that you are feeling.
The relationship can be written by setting a parameter 𝑐 (drag coefficient)
that takes into account all factors that makes the air resistance proportional to
velocity.
𝐹𝑈 = 𝑐𝑣
 Substituting all these that we have derived into the original equation for
Newton’s 2nd Law:
MATHEMATICAL MODELING
𝐹
Newton’s 2nd Law: 𝑎=
𝑚
𝑑𝑣 𝑚𝑔 − 𝑐𝑣
=
𝑑𝑡 𝑚
𝑑𝑣 𝑐
=𝑔− 𝑣
𝑑𝑡 𝑚
 The resulting mathematical model that we have derived is an ordinary
differential equation (ODE). The exact solution for the velocity of the falling
parachutist cannot be obtained using simple algebraic manipulation.
ANALYTICAL SOLUTION
 To get the exact or analytical solution, we would need to deploy advance
techniques in calculus. Recall the technique of separation of variables.
𝑑𝑣 𝑐
=𝑔− 𝑣
𝑑𝑡 𝑚
𝑑𝑣
𝑐 = 𝑑𝑡
𝑔− 𝑣
𝑚

 After separating variables, we need to manipulate the left side function to


make it match an integration formula. The integration formula we use for this
is the formula for integration that leads to a logarithmic function.
𝑓′ 𝑥
𝑑𝑥 = 𝑙𝑛 𝑓 𝑥 + 𝐶
𝑓 𝑥
ANALYTICAL SOLUTION
 So, we manipulate the left side to make the numerator a derivative of the
denominator function.
𝑑𝑣
𝑐 = 𝑑𝑡
𝑔− 𝑣
𝑚
1
𝑑𝑣 = 𝑑𝑡
𝑐
−𝑔 −1 + 𝑣
𝑔𝑚
𝑐 1 𝑐
− 𝑑𝑣 = 𝑑𝑡 −
𝑚 −𝑔 −1 + 𝑐 𝑣 𝑚
𝑔𝑚
𝑐
𝑔𝑚 𝑐
𝑑𝑣 = − 𝑑𝑡
𝑐 𝑚
−1 + 𝑣
𝑔𝑚
𝑐 𝑐
Note: 𝑑𝑥 = 𝑑𝑣, 𝑓 𝑥 = −1 + 𝑣 and 𝑓′ 𝑥 =
𝑔𝑚 𝑔𝑚
ANALYTICAL SOLUTION
 Therefore we can now use the formula to evaluate the integral on the left side.
𝑐
𝑔𝑚 𝑐
𝑑𝑣 = − 𝑑𝑡
𝑐 𝑚
−1 + 𝑣
𝑔𝑚

𝑐 𝑐
𝑙𝑛 −1 + 𝑣 + 𝐶𝐿 = − 𝑡 + 𝐶𝑅 𝐶𝐿 and 𝐶𝑅 are constants
𝑔𝑚 𝑚
𝑐 𝑐
𝑙𝑛 ;1: 𝑣 ; 𝑡: 𝐶𝑅 ; 𝐶𝐿
𝑒 𝑔𝑚 =𝑒 𝑚

𝑐 𝐶𝑅 ; 𝐶𝐿 ;
𝑐
𝑡
−1 + 𝑣=𝑒 𝑒 𝑚
𝑔𝑚
𝐶𝑅 ; 𝐶𝐿
 Let a constant 𝑘 = 𝑒 , we get
𝑐 ;
𝑐
𝑡
−1 + 𝑣=𝑘𝑒 𝑚
𝑔𝑚
𝑐 ;
𝑐
𝑡
𝑣 =1+𝑘𝑒 𝑚
𝑔𝑚
𝑔𝑚 ;
𝑐
𝑡
𝑣= 1+𝑘𝑒 𝑚
𝑐
ANALYTICAL SOLUTION
 Therefore, the general solution to the problem is:
𝑔𝑚
𝑣 𝑡 = 1 + 𝑘 𝑒 ; 𝑐/𝑚 𝑡
𝑐
 To get the particular solution, we need some initial conditions to evaluate the
value of the constant 𝑘. For example if the parachutist is initially at rest, then
𝑣 0 = 0 at time 𝑡 = 0.
𝑔𝑚
0= 1 + 𝑘 𝑒 ; 𝑐/𝑚 0
𝑐
𝑐
0 = 1+𝑘 1
𝑔𝑚
𝑘 = −1
ANALYTICAL SOLUTION
 Therefore, the particular solution to the parachutist problem is:
𝑔𝑚
𝑣 𝑡 = 1 − 𝑒 ; 𝑐/𝑚 𝑡
𝑐
where:
𝑣 𝑡 = velocity (dependent variable)
𝑡 = time (independent variable)
𝑐 = drag coefficient (parameter)
𝑚 = mass (parameter)
𝑔 = acceleration due to gravity (forcing function)
 Next, we will apply this solution we have derived to a specific problem.
SAMPLE PROBLEM
EXAMPLE 1: ANALYTICAL SOLUTION:
A parachutist of mass 68.1 kg jumps We insert the known values into the
out of a stationary hot air balloon. Use equation. To make it less confusing, we will
𝑔𝑚 not write units in the equation. However,
𝑣 𝑡 = 1 − 𝑒 ; 𝑐/𝑚 𝑡 take note that the equation must be
𝑐
to compute the terminal velocity the dimensionally homogeneous (units must be
parachutists reaches before he opens his the same or related).
chute. The drag coefficient is equal to 9.8 68.1
𝑣 𝑡 = 1 − 𝑒 ; 12.5/68.1 𝑡
12.5 kg/s. Use 9.8 m/s2 as the value for 12.5
acceleration due to gravity. 𝑣 𝑡 = 53.3904 1 − 𝑒 ;0.183553597𝑡
Using the equation, plot the curve
formed for time t=0 to t=20 seconds. Note that terminal velocity of a free falling
Use an interval of 2 seconds. body is the maximum velocity that can be
reached by that body as it falls freely to the
ground. After it is reached, acceleration will
stop and the velocity remains constant. This
means even if the time is increased, velocity
will not change.
SAMPLE PROBLEM
Looking at the formula, we can easily get the terminal velocity. We can do this by letting
the time t approach ∞ (infinity). If this happens, the value of the exponential
𝑒 ;0.183553597𝑡 would approach zero.
lim 𝑣 𝑡 = lim 53.3904 1 − 𝑒 ;0.183553597𝑡 = 53.3904
𝑡→∞ 𝑡→∞

Therefore, the terminal velocity is 53.3904 m/s.


Using Excel, the following results are obtained.

time t velocity v
(s) (m/s) Velocity Curve of the Parachutist up to t=20 s
0 0.0000 60.0000
2 16.4050
50.0000
4 27.7693
6 35.6418 40.0000
8 41.0953
30.0000 Velocity curve
10 44.8731
Terminal Velocity
12 47.4902 20.0000
14 49.3031
10.0000
16 50.5590
18 51.4290 0.0000
0 5 10 15 20 25
20 52.0317
NUMERICAL SOLUTION
 We use finite divided difference to approximate the first derivative of velocity with
respect to time (slope of the curve) to the slope of a line within a finite interval.

𝑑𝑣 Δ𝑣 𝑣 𝑡𝑖:1 − 𝑣 𝑡𝑖
= =
𝑑𝑡 Δ𝑡 𝑡𝑖:1 − 𝑡𝑖

where:
Δ𝑣 = difference in velocities
Δ𝑡 = difference in time
𝑣 𝑡𝑖 = velocity at initial time 𝑡𝑖
𝑣 𝑡𝑖:1 = velocity at a later time 𝑡𝑖:1

 We will substitute this approximation


to the mathematical model of the
velocity of the parachutist we have
developed earlier.
NUMERICAL SOLUTION
𝑑𝑣 𝑐
=𝑔− 𝑣
𝑑𝑡 𝑚
𝑣 𝑡𝑖:1 − 𝑣 𝑡𝑖 𝑐
= 𝑔 − 𝑣 𝑡𝑖
𝑡𝑖:1 − 𝑡𝑖 𝑚
𝑐
𝑣 𝑡𝑖:1 − 𝑣 𝑡𝑖 = 𝑔 − 𝑣 𝑡𝑖 𝑡𝑖:1 − 𝑡𝑖
𝑚
𝑐
𝑣 𝑡𝑖:1 = 𝑣 𝑡𝑖 + 𝑔 − 𝑣 𝑡𝑖 𝑡𝑖:1 − 𝑡𝑖
𝑚
 Notice that the term in brackets is the right-hand side of the differential
equation itself. That is, it provides a means to compute the rate of change or
slope of 𝑣. Thus, the differential equation has been transformed into an
equation that can be used to determine the velocity algebraically at 𝑡𝑖:1 using
the slope and previous values of 𝑣 and 𝑡.
NUMERICAL SOLUTION
 If you are given an initial value for velocity at some time 𝑡𝑖 , you can easily
compute velocity at a later time 𝑡𝑖:1 . This new value of velocity at 𝑡𝑖:1 can in
turn be employed to extend the computation to velocity at 𝑡𝑖:2 and so on.
Thus, at any time along the way,
𝑛𝑒𝑤 𝑜𝑙𝑑 𝑠𝑡𝑒𝑝
= + 𝑠𝑙𝑜𝑝𝑒
𝑣𝑎𝑙𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 𝑠𝑖𝑧𝑒
 This approach is formally called Euler’s method named after Swiss
mathematician and engineer Leonhard Euler.
Trivia:
His family name Euler is usually mispronounced by people. It should be
pronounced “OY–ler”. For Germans, sometimes the r becomes silent.
SAMPLE PROBLEM
EXAMPLE 2:
A parachutist of mass 68.1 kg jumps out of a stationary hot air balloon. Use
𝑐
𝑣 𝑡𝑖:1 = 𝑣 𝑡𝑖 + 𝑔 − 𝑣 𝑡𝑖 𝑡𝑖:1 − 𝑡𝑖
𝑚
to compute the terminal velocity the parachutists reaches before he opens his chute. The
drag coefficient is equal to 12.5 kg/s. Use 9.8 m/s2 as the value for acceleration due to
gravity.
Using the equation, plot the curve formed for time t=0 to t=20 seconds. Use an
interval of 2 seconds.

NUMERICAL SOLUTION:
Just like the analytical solution, the parachutists is initially at rest. Therefore, at the start,
𝑣 𝑡𝑖 = 0 at time 𝑡𝑖 = 0. The time interval considered is 2 seconds.
For 𝑖 = 1 𝑎𝑛𝑑 𝑖 + 1 = 2: 𝑣 𝑡1 = 0, 𝑡1 = 0 and 𝑡2 = 2
12.5
𝑣 𝑡2 = 0 + 9.8 − 0 2 − 0 = 19.60 𝑚/𝑠
68.1
SAMPLE PROBLEM
For 𝑖 = 2 𝑎𝑛𝑑 𝑖 + 1 = 3: 𝑣 𝑡2 = 19.6, 𝑡2 = 2 and 𝑡3 = 4
12.5
𝑣 𝑡3 = 19.60 + 9.8 − 19.60 4 − 2 = 32.00 𝑚/𝑠
68.1
For 𝑖 = 3 𝑎𝑛𝑑 𝑖 + 1 = 4: 𝑣 𝑡3 = 32.00, 𝑡3 = 4 and 𝑡4 = 6
12.5
𝑣 𝑡4 = 32.00 + 9.8 − 32.00 6 − 4 = 39.87 𝑚/𝑠
68.1
To speed up calculations, we will use Excel.
time t i velocity v i time t i+1 velocity v i+1 Velocity Curve of the Parachutist up to t=20 s
(s) (m/s) (s) (m/s)
60.0000
0 0.0000 2 19.6000
2 19.6000 4 32.0047 50.0000
4 32.0047 6 39.8555
40.0000
6 39.8555 8 44.8243
8 44.8243 10 47.9690 30.0000 Velocity curve

10 47.9690 12 49.9592 Terminal Velocity


20.0000
12 49.9592 14 51.2188
14 51.2188 16 52.0160 10.0000

16 52.0160 18 52.5206 0.0000


18 52.5206 20 52.8399 0 5 10 15 20 25
20 52.8399 22 53.0420
SAMPLE PROBLEM
The terminal velocity = 53.3904 m/s is reached at a later time.

time t i velocity v i time t i+1 velocity v i+1


time t i velocity v i time t i+1 velocity v i+1 (s) (m/s) (s) (m/s)
(s) (m/s) (s) (m/s) 32 53.3550 34 53.3680
0 0.0000 2 19.6000 34 53.3680 36 53.3762
2 19.6000 4 32.0047 36 53.3762 38 53.3814
4 32.0047 6 39.8555 38 53.3814 40 53.3847
6 39.8555 8 44.8243 40 53.3847 42 53.3868
8 44.8243 10 47.9690 42 53.3868 44 53.3881
10 47.9690 12 49.9592 44 53.3881 46 53.3890
12 49.9592 14 51.2188 46 53.3890 48 53.3895
14 51.2188 16 52.0160 48 53.3895 50 53.3898
16 52.0160 18 52.5206 50 53.3898 52 53.3900
18 52.5206 20 52.8399 52 53.3900 54 53.3902
20 52.8399 22 53.0420 54 53.3902 56 53.3903
22 53.0420 24 53.1699 56 53.3903 58 53.3903
24 53.1699 26 53.2508 58 53.3903 60 53.3903
26 53.2508 28 53.3021 60 53.3903 62 53.3904
28 53.3021 30 53.3345 62 53.3904 64 53.3904
30 53.3345 32 53.3550 64 53.3904 66 53.3904
66 53.3904 68 53.3904
68 53.3904 70 53.3904
70 53.3904 72 53.3904
COMPARISON (Δt = 2seconds)
Velocity Curve of the Parachutist up to t=20 s
60.0000

50.0000

40.0000

30.0000 Analytical Curve


Numerical Curve

20.0000

10.0000

0.0000
0 5 10 15 20 25

 Looking at the chart, we can see a considerable difference in the results. This
is because the numerical solution assumes straight lines to approximate the
curved line of the analytical or exact solution.
COMPARISON (Δt = 0.1 seconds)
 To remedy this problem, we can select a very small value for the step size of the
numerical solution. For example, lets try a step size Δt = 0.1s The following are the
values for both analytical and numerical solution for the first 4 seconds.

time t ANALYTICAL NUMERICAL time t ANALYTICAL NUMERICAL


(s) velocity v velocity v (s) velocity v velocity v
(m/s) (m/s) (m/s) (m/s)
0.0 0.0000 0.0000 2.1 17.0777 17.2075
0.1 0.9711 0.9800 2.2 17.7381 17.8716
0.2 1.9245 1.9420 2.3 18.3866 18.5236
0.3 2.8605 2.8864 2.4 19.0232 19.1636
0.4 3.7796 3.8134 2.5 19.6483 19.7918
0.5 4.6819 4.7234 2.6 20.2620 20.4086
0.6 5.5678 5.6167 2.7 20.8645 21.0139
0.7 6.4376 6.4936 2.8 21.4561 21.6082
0.8 7.2915 7.3544 2.9 22.0369 22.1916
0.9 8.1300 8.1994 3.0 22.6072 22.7643
1.0 8.9532 9.0289 3.1 23.1671 23.3264
1.1 9.7614 9.8432 3.2 23.7168 23.8783
1.2 10.5549 10.6425 3.3 24.2565 24.4200
1.3 11.3340 11.4272 3.4 24.7863 24.9517
1.4 12.0989 12.1974 3.5 25.3066 25.4737
1.5 12.8499 12.9535 3.6 25.8174 25.9861
1.6 13.5873 13.6958 3.7 26.3189 26.4892
1.7 14.3112 14.4244 3.8 26.8112 26.9829
1.8 15.0220 15.1396 3.9 27.2947 27.4677
1.9 15.7198 15.8417 4.0 27.7693 27.9435
2.0 16.4050 16.5309
COMPARISON (Δt = 0.1 seconds)
 The chart below shows the comparison of the curves for analytical and numerical for
the first 20 seconds. We can see the numerical curve being very similar to the
analytical curve.
Velocity Curve of the Parachutist up to t=20 s
60.0000

50.0000

40.0000

30.0000 Analytical Curve


Numerical Curve

20.0000

10.0000

0.0000
0.0 5.0 10.0 15.0 20.0 25.0
REFERENCE
Chapra, S. C., & Canale, R. P. (2010). Numerical Methods for
Engineers (6th Edition). McGraw-Hill.
THE END

You might also like