Chapter 1 Simple Initial-Value Problems: Example 1: Acceleration of A Car
Chapter 1 Simple Initial-Value Problems: Example 1: Acceleration of A Car
1.1 Introduction
In this chapter, simple, ordinary differential equations for initial-value problems will be solved
to understand the basic concepts of numerical methods. Practical examples will be used to
demonstrate the principles of numerical methods.
What is an initial-value problem? Mathematically, an initial value problem is an ordinary
differential equation together with the initial condition (a specified value) of the unknown function at
a given point in the domain of the solution.
The mathematical definition of the initial problem might be difficult to understand. To
understand initial problems physically, some physical examples of initial problem are explained
below.
Example 1: Acceleration of a car
A car is accelerated by the force from the engine. The problem can be solved by Newton’s second
law. If we know that the acceleration of the car equals the total force on the car divided by the mass
of the car, the problem can be solved. If the car is initially static, the initial condition (or the initial
values) of the car is that the velocity is zero and the driving distance is zero. The Newton’s second
law can be written in the following format
driving force friction force from the road resistance force from the air(drag force)
acceleration
mass of the car
If we know the ways for calculating all the forces and the initial conditions (values), we can find
out the velocity and the displacement (driving distance) at any time. One can solve this example,
after he/she understand the numerical method introduced in this chapter.
Example 2: Tsunami caused by landslides.
A landslide is the movement of rock, debris or earth down a slope. It is generally caused by
earthquakes. Tsunami waves can be generated by if a landslide occurs in water. Tsunamis caused by
landslides have been studied by many researchers because they damage the structures in oceans or
lakes seriously. Figure 1 is an example of the formation of the landslide and Tsunami waves caused
by a landslide.
Water Water
Land Land
Time 2 Time 3
Surface wave Surface wave
Water Water
Land Land
Figure 1 A sketch showing the process of a landslide, an example of initial value problems
1
Computational Fluid Dynamics Chapter 1
A landslide is a very complex initial value problem. Initially the water surface is still and the
land does not move. After a large amount of earth starts to slide along the slope, large surface waves
are generated and they travel towards to the deep water. Landslide can be solved by a sophisticated
computer program or studied by experiments in laboratories. One needs to have extensive and solid
knowledge about computational fluid dynamics if he/she is to predict Tsunamis by landslides using
CFD.
This chapter will introduce very basic concepts for solving initial value problems. In section 1.2,
the solution of a falling sphere in a fluid under the gravity will be solved to demonstrate the very
basic knowledge of numerical methods.
Figure 2 shows that three forces act on the sphere: the weight, the drag force and the buoyancy
force. The weight is
2
Computational Fluid Dynamics Chapter 1
W mg , (1)
the drag force can be approximately predicted by the following empirical formula
1
FD CD A | V | V , (2)
2
and the buoyancy force is calculated by
FB md g , (3)
where md is the displaced fluid mass by the sphere, i.e. the mass of the fluid with the same volume of
the sphere. The signs of the buoyancy and drag forces are negative because they are in the opposite
direction of the cylinder velocity.
Initial position
Y=0
Fluid
W= mg, weight
Y
To calculate the drag force, we need to know the drag coefficient CD. The drag coefficient CD
depends on the Reynolds number Re as shown in Figure 3. The Reynolds number is defined as
VD
Re (4)
A number of empirical formulae have been developed to calculate the drag coefficient based on
the experimental data. The most recent one derived by Mikhailov and Silva Freire (2013) is
CD
3808 1617933 / 2030 178861 / 1063 Re 1219 / 1084 Re 2 (5)
681 Re 77531 / 422 13529 / 976 Re 1 / 71154 Re 2
Figure 3 shows that the predicted drag coefficients calculated from Eq. (4) agree well with the
experimental data for Reynolds numbers up to Re 105 .
3
Computational Fluid Dynamics Chapter 1
1.E+03
1.E+02 Experimental data
Formula by Mikhailov and Silva Freire (2013)
CD
1.E+01
1.E+00
1.E‐01
1.E‐01 1.E+00 1.E+01 1.E+02 1.E+03 1.E+04 1.E+05 1.E+06
Re
Figure 3 Comparison between the experimental data of CD with the formula Eq. (5)
It is a simple concept that the velocity of the sphere and the acceleration of the sphere are the
first and second order derivatives of the displacement with respect to time, respectively, i.e.
dY
V (8)
dt
dV d d Y d2 Y
and a (9)
dt d t dt dt2
According to Equations (4) and (6), we have
dY
V (10)
dt
d V md CD A
1 g |V |V (11)
dt m 2m
d 2 Y md CD A d Y d Y
or 2
1 g (12)
dt m 2m d t d t
Eq. (12) is called the equation of motion of the sphere. The unknown in Eq. (12) is the
displacement Y. If we can find out Y, the velocity and acceleration can be found using Y.
Eqs (10) and (11) is another format of Eq. (12). It is very often that Eqs. (10) and (11) are solved
instead of Eq. (10), because first order differential equations can be solved easily. In the following, a
4
Computational Fluid Dynamics Chapter 1
simple numerical method will be introduced for solving equations (10) and (11). When solving the
problem, we need an initial condition, i.e. what the position and velocity of the sphere are initially.
We assume the sphere is initially static, i.e.
Y t 0 0 (13)
v t 0 0 (14)
Equations (13) and (14) means that the displacement Y and the velocity v are zero at the time of
t=0. Figure 4 is an example of the solution for the velocity. It shows the variation of the velocity with
time. The velocity, which is initially zero at t=0, increases with increasing time. When time is very
long, the velocity becomes constant because the weight-buoyancy force and the drag force balance
with each other.
V
Terminal velocity
Δt
O
t
t0 t1 t2 t3 t4 tn-1 tn tn+1
If we divide the time into many very small steps Δt and name Δt as the time step. The time at
each step can be represented as
t 0 , t 1 , t 2 ,..., t n1 , t n , t n1 ,.... (15)
In Equation (15), tn stands for the time of nΔt instead of the power of n. We know the definition
of the derivative is
dY Y Y n1 Y n
lim lim (16)
d t t 0 t t 0 t
dY Y n1 Y n
If the time step is very small, we can replace by with an acceptable error, i.e.
dt t
d Y Y n1 Y n
, if Δt is very small (17)
dt t
dY Y n1 Y n dV V n1 V n
Replying by and by , Eq. (10) and (11) can be rewritten as
dt t dt t
5
Computational Fluid Dynamics Chapter 1
Y n1 Y n
Vn (18)
t
V n1 V n m CD A n n
1 g |V |V (19)
t md 2m
Eqs. (14) and (15) can be rewritten as
Y n1 Y n tV n (20)
V n1 V n ta (21)
m CD A n n
a 1 d g |V |V (22)
m 2m
If the velocity and the displacement at t=0 ( v 0 and Y 0 ) are known, the velocity and the
displacement at t=Δt ( v1 and Y 1 ) can be calculated using Eqs. (20) and (21) and similarly, if the
velocity at t=nΔt is known, the velocity at any time of t=(n+1)Δt can be found out by repeatedly
using Eqs. (20) and (21).
The above mentioned numerical method is called Euler method. Eq. (20) and (21) are called
Euler method formulae, also called numerical integration equations. The Euler method is a first-order
numerical procedure for solving ordinary differential equations (ODEs).
A falling sphere is used as an example to explain the Euler method for solving the initial value
problem in this section. This method is the easiest method for solving the differential equations. One
can see that the key principle of the problem is the Newton’s second law. Many practical problems
that follow the Newton’s second law can be solved by the Euler method.
The accuracy of the solution depends on the time step Δt. The smaller the time step, the more
accuracy of the solution. After solving Eqs. (20) and (21), the falling velocity and distance at any
time can be found out. It is very often these two equations need to be solved repeatedly for hundreds,
thousands of times to get a whole picture how the sphere is falling. The numerical equations are
generally solved by developing computer programs and run programs on computers.
6
Computational Fluid Dynamics Chapter 1
If the time is extremely long, the sphere will ultimately stop accelerating and the velocity
dV dV
becomes a constant, i.e. 0 . Substituting 0 into Eq. (10) yields the terminal velocity
dt dt
Vterminal as
2(m md ) g
Vterminal (22)
CD A
The terminal velocity for parameters in Appendix A is 4.9577 m/s, which is close to the velocity
at the last time step shown in Figure 5.
Figure 5 The figures generated by the MATLAB program code in Appendix A for the problem of a
falling sphere. Left, velocity; right, displacement.
After we solved an equation using numerical method, we need to analyze how much uncertainty
is involved in the solution. If the drag coefficient CD is accurate, the solution shown in Figure 4 will
have very high accuracy. We need to know that the formula for calculating the drag force is an
empirical formula, which may involve uncertainty. In addition, due to the complexity of the fluid-
structure interaction, the drag coefficient is very often not a constant number.
7
Computational Fluid Dynamics Chapter 1
Appendix A
MATLAB program code for solving the problem of a falling sphere in a fluid.
8
Computational Fluid Dynamics Chapter 1
a = g*(1-md/m)-0.5*rho*A*CD*abs(v(n))*v(n) / m;
v(n+1) = v(n)+dt*a; % velocity at the next step
Y(n+1) = Y(n)+dt*v(n); % displacement at the next step
end
v_terminal = v_new;
Re_terminal = v_terminal*D/nu;
disp ('Terminal velocity = ');
disp(v_terminal);
disp ('Velocity at the last step=');
disp (v(nn));
disp ('Terminal Reynolds number =');
disp (Re_terminal);
fileID = fopen('results.txt','w');
for n=1:nn
fprintf(fileID,'%10.5e %12.8e\r\n',t(n),v(n));
end
fclose(fileID);
References
Mikhailov, M.D., Silva Freire, A.P., 2013. The drag coefficient of a sphere: An approximation using
Shanks transform. Powder Technology 237, 432-435.
9