0% found this document useful (0 votes)
28 views

Chapter 1 Simple Initial-Value Problems: Example 1: Acceleration of A Car

This chapter introduces numerical methods for solving initial value problems through examples. It discusses solving for the acceleration of a car from initial conditions of zero velocity and distance traveled using Newton's second law. It also examines modeling a landslide-generated tsunami as an initial value problem where the initial water surface is still and land does not move. The chapter then focuses on numerically solving for the falling trajectory of a sphere in a fluid, identifying the relevant forces of gravity, buoyancy, and drag, and detailing the governing equations derived from Newton's second law.
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)
28 views

Chapter 1 Simple Initial-Value Problems: Example 1: Acceleration of A Car

This chapter introduces numerical methods for solving initial value problems through examples. It discusses solving for the acceleration of a car from initial conditions of zero velocity and distance traveled using Newton's second law. It also examines modeling a landslide-generated tsunami as an initial value problem where the initial water surface is still and land does not move. The chapter then focuses on numerically solving for the falling trajectory of a sphere in a fluid, identifying the relevant forces of gravity, buoyancy, and drag, and detailing the governing equations derived from Newton's second law.
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/ 9

Computational Fluid Dynamics Chapter 1

Chapter 1 Simple initial-value problems

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.

Initial condition Time 1


Water surface Surface wave

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


 
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.

1.2 Numerical solution of a falling sphere


1.2.1 Force analysis
Consider a sphere falling in a fluid (i.e. air or water), the sphere will accelerate due to its weight.
At the same time there is a buoyancy force from the fluid and the drag force, which is the resistance
force from the fluid in the opposite direction of the sphere’s velocity (see Figure 1 for the directions
of all the forces). We define a coordinate Y whose origin is at the initial position of the sphere and
whose direction points downwards. Before we analyze the problem, we first get us familiar with all
the relevant parameters that are listed in Table 1.
Table 1 Parameters used in the analysis of a falling sphere in a still fluid
Parameter Symbol Unit Value
2
Gravitational acceleration g m/s 9.81
Time t s
Diameter of the sphere D m
Density of the sphere ρs kg/m3
Volume of the sphere V m3 V=πD3/6
Mass of the sphere m kg ρs V
Weight of the sphere W N W=mg
Falling distance of the sphere Y m
dY
Falling velocity of the sphere V m/s V
dt
d2 Y
Acceleration of the sphere a m/s2 a 2
dt
Buoyancy force FB N FB  md g
3
Density of the fluid ρ kg/m
Kinematic viscosity of the fluid ν m2/s
vD
Reynolds number Re nondimensional Re 

1
Drag force FD N FD   CD A | v | v
2
Drag coefficient CD nondimensional
Project area A m2 A=πD2/4

Figure 2 shows that three forces act on the sphere: the weight, the drag force and the buoyancy
force. The weight is


 
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

FB= mdg, Buoyancy force


FD= 0.5ρCDA|V|V, drag force

Fluid

W= mg, weight
Y

Figure 2 Forces on a falling sphere in a fluid.

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 .

1.2.1 Governing equation


The governing equations are the equations that the unknown variables satisfy or follow. In the
example in section 1.2, the unknown variable is the displacement of the sphere. The governing
equation of the displacement Y can be derived based on the Newton’s second law, which describe the
relationship between the total force and the motion of the sphere.


 
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)

The total force F on the sphere is


F  W  WB  FD
1 (6)
 (m  md ) g  CD A | V | V
2
According to the Newton’s second law, the acceleration of the sphere a=F/m, i.e.
md CD A
a  (1  )g  |V |V (7)
m 2m

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


 
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

Figure 4 A example of the solution for the velocity of a falling sphere

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 n1 , t n , t n1 ,.... (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 n1  Y n
 lim  lim (16)
d t t 0 t t 0 t
dY Y n1  Y n
If the time step is very small, we can replace by with an acceptable error, i.e.
dt t
d Y Y n1  Y n
 , if Δt is very small (17)
dt t
dY Y n1  Y n dV V n1  V n
Replying by and by , Eq. (10) and (11) can be rewritten as
dt t dt t


 
Computational Fluid Dynamics Chapter 1
 
Y n1  Y n
Vn (18)
t
V n1  V n  m  CD A n n
 1   g  |V |V (19)
t  md  2m
Eqs. (14) and (15) can be rewritten as
Y n1  Y n  tV n (20)
V n1  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.

1.2 Numerical solution of a falling sphere


Appendix A is an example METLAB program code for solving the sphere falling problems.
The parameters of the case are described below.
A sphere falls in the air with D=0.1 m, ρ=1.2 kg/m3, ρs=12 kg/m3, g=9.81 m/s2. The drag
coefficient is assumed to be constant of CD=1.2. The time step is chosen to be 0.002 s and total steps
to be calculated is 1001 (total time is 1000×0.002=2 s). After the problem is solved, we can find out
the velocity and the displacement of the sphere at any time within 2 s. The number of the time steps
needs to be increased if we want to know the solution after 2 s. Appendix A is a MATLAB program
code.
Figure 5 is a figures generated from the code in Appendix A. The velocity stops increasing with
time after some time. The displacement increases continuously because the sphere keeps falling
down.


 
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.

1.2 Review of the Euler method


If we have a differential equation
dx
 f  x, t  (23)
dt
where f(x,t) stands for a function of x and t, with the initial condition
x t  0  x0           (24) 
Numerically, Eq. (7) can be converted into a discretised equation:
x n 1  x n
 f ( x, t ) (25)
t
or x n 1  x n  tf ( x, t ) n (26)
where t is the time step and the subscript n+1 and n stands for the values at the time of t  nt and
t  (n  1)t , respectively.


 
Computational Fluid Dynamics Chapter 1
 
Appendix A
MATLAB program code for solving the problem of a falling sphere in a fluid.

% To simulate a falling sphere in a still fluid using the Euler method

% D = diameter of the sphere


% g = gravitational acceleration
% rho = density of the fluid
% rhos = density of the sphere
% pi = 3.141593
% m = mass of the sphere
% md = mass of the displaced fluid
% v = velocity of the sphere
% Vol = volume of the sphere
% dt = computational time step
% nn = total time step to be calculated
% Y(:) = displacement
% v(:) = velocity
% t(:) = time
% CD = drag coefficient
% v_terminal = terminal velocity
% a = acceleration
% nu = kinematic viscosity of the fluid
% Re = Reynolds number

% v_terminal = terminal velocity

clear; % clear the memory


D = 0.1; % diameter of the sphere
rho = 1.2; % density of the fluid
nu = 1e-5; % kinematic viscosity of the fluid
rhos = 12; % density of the sphere
pi = acos(-1); % pi = 3.14159
g = 9.81; % gravitational acceleration

A = pi*D^2/4; % projected area of the sphere


Vol= pi*D^3/6; % volume of the sphere
m = rhos*Vol; % mass of the sphere
md= rho*Vol; % mass of the displaced fluid, with the same vlume as the sphere
dt = 0.002; % comptuational time step
nn = 1001; % total steps to be calculated
Y = zeros(nn); % initially all the displacements are zero
v = zeros(nn); % initially all the velocities are zero
t = zeros(nn); % initially times are zero at all the steps
for n=1:nn-1
t(n+1) = t(n)+dt; % time step increased by dt
Re = abs(v(n))*D/nu; % Reynolds number
if(Re>0)
CD=3808*((1617933/2030)+(178861/1063)*Re+1219/1084*Re^2) ...
/(681*Re*(77531/422+13529/976*Re-1/71154*Re^2)); %cal. CD
else
CD = 1.2;
end


 
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

% open a figure window 1 for drawing the velocity plot


figure (01); %open a figure window
plot(t,v); % plot velocity versus t curve
xlabel('time (s)'); %honrizontal axis's label is 'time'
ylabel('v (m/s)'); %vertical axis's label is 'v'

% open a figure window 2 for drawing the displacemet plot


figure (02); %open a figue window
plot(t,Y); %plot displacement versus t curve
xlabel('time (s)'); %honrizontal axis's label is 'time'
ylabel('Y (m)'); %vertical axis's label is 'Y'

% v_terminal is the final velocity when t=infinite using iteration method


% Re_terminal is the final Reynolds number
v_old = 0;
CD = 1; % assume CD = 1, will be corrected
v_new = sqrt(2*(m-md)*g / (rho*A*CD)); % calculate a velocity using CD
while abs(v_new-v_old)>1e-5
Re = abs(v_new)*D/nu; % calculate Re using velocity
CD=3808*((1617933/2030)+(178861/1063)*Re+1219/1084*Re^2) ...
/(681*Re*(77531/422+13529/976*Re-1/71154*Re^2));
% calculate CD using Re
v_old = v_new;
v_new = sqrt(2*(m-md)*g / (rho*A*CD)); % calculate new velocity using new CD
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.


 

You might also like