Fluid Project
Fluid Project
INTRODUCTION
Having studying Fluid Mechanics Subject this semester (fourth semester), we have now come to
the phase that we can analyze the subject matters/contents with the help of MATLAB and
ANSYS software. This project was given to all the students. A group of 3 members was formed
and the task was done accordingly. The idea was to develop a program in MATLAB to analyze
the Source-Uniform flow combination. And also using ANSYS, we were told to visualize and
analyze flow in Venturimeter and different types of pipes.
1.1 Objectives
The main purpose of doing this project was to gain some basic and useful knowledge of
MATLAB and ANSYS software so that we can utilize that knowledge to accomplish the task
which was given to us. MATLAB and ANSYS software hold a significant role/importance in
engineering field, so we wanted to grab this opportunity to get know some basic stuff about these
software.
1
CHAPTER TWO
BACKGROUND OF STUDY
2.1 Introduction to MATLAB
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. Typical uses include:
MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows you to solve many technical computing problems, especially those
with matrix and vector formulations, in a fraction of the time it would take to write a program in
a scalar no interactive language such as C or FORTRAN.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide
easy access to matrix software developed by the LINPACK and EISPACK projects, which
together represent the state-of-the-art in software for matrix computation.
MATLAB features a family of application-specific solutions called toolboxes. Very important to
most users of MATLAB, toolboxes allow you to learn and apply specialized technology.
Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the
MATLAB environment to solve particular classes of problems. Areas in which toolboxes are
available include signal processing, control systems, neural networks, fuzzy logic, wavelets,
simulation, and many others.
This is a high-level matrix/array language with control flow statements, functions, data
structures, input/output, and object-oriented programming features. It allows both "programming
in the small" to rapidly create quick and dirty throw-away programs, and "programming in the
large" to create complete large and complex application programs.
2
The MATLAB working environment.
This is the set of tools and facilities that you work with as the MATLAB user or programmer. It
includes facilities for managing the variables in your workspace and importing and exporting
data. It also includes tools for developing, managing, debugging, and profiling M-files,
MATLAB's applications.
Handle Graphics.
This is the MATLAB graphics system. It includes high-level commands for two-dimensional and
three-dimensional data visualization, image processing, animation, and presentation graphics. It
also includes low-level commands that allow you to fully customize the appearance of graphics
as well as to build complete Graphical User Interfaces on your MATLAB applications.
This is a vast collection of computational algorithms ranging from elementary functions like
sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse,
matrix eigenvalues, Bessel functions, and fast Fourier transforms.
This is a library that allows you to write C and Fortran programs that interact with MATLAB. It
include facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a
computational engine, and for reading and writing MAT-files.
ANSYS develops and markets engineering simulation software. ANSYS software is used to
design products and semiconductors, as well as to create simulations that test a product's
durability, temperature distribution, fluid movements, and electromagnetic properties. In this
project our purpose of using ANSYS is for solving various fluid problems using CFD
(Computational Fluid Dynamics). For CFD analysis ANSYS provides two different software and
they are CFX and FLUENT. CFX and FLUENT are independently developed software for CFD
analysis and the only difference between them is their different problem solving approach. In our
case, we have used FLUENT for our project. These softwares use numerical method to solve any
sort of fluid problem because it is literally impossible to solve complex fluid problem by direct
analysis or by finding general solutions.
CFD is a computer simulation of the conditions of some fluid that is flowing. In the simulation,
the region with fluid in it is treated as a bunch of tiny blobs. There can be millions of these tiny
blobs. The conditions are taken to be the same everywhere inside each tiny blob. These
conditions can be different in one blob to another. But within a blob, there is no variation.
3
There are some equations (called the Naiver-Stokes equations) that relate how various
parameters change throughout the fluid. The parameters that we might be interested in are things
like the pressure in the fluid, the velocity in the fluid, its temperature, how much shear stress
there is due to viscosity, how fast the fluid is rotating, and so on. With this idea of breaking the
fluid up into discrete blobs, we can simplify the equations. It boils down to writing F=ma for
each blob. Here, we are treating conditions as being unchanging inside each blob. That’s an
approximation. In a continuous fluid, the conditions vary continuously all the way through the
fluid. By treating the fluid as being made up as all these separate blobs, we only have to solve
anything where the blobs touch each other. Effectively we have replaced the Navier-Stokes
equations, which are complicated differential equations, with much simpler algebraic equations
where the blobs touch. We have to solve for the conditions only where the blobs touch, but that’s
still millions of places. That’s where the computer comes in. It’s very good at chugging through
millions of simple calculations. Once it’s done, we have approximate values of the various
parameters at all locations inside the fluid. We have predicted how the fluid will behave.
Sometimes this approach can be spectacularly wrong. But if we know what we are doing and use
the tool properly, we get useful values of things like lift and drag of airplanes due to the fluid
flowing around them.
Velocity potential function is basically defined as a scalar function of space and time such that
it’s negative derivative with respect to any direction will provide us the velocity of the fluid
particle in that direction.
Where,
4
ur is the velocity component in radial direction and uθ is the velocity component in tangential
direction.
We can write here the continuity equation for incompressible steady flow in terms of velocity
potential function as mentioned here.
Stream function
Stream function is basically defined as a scalar function of space and time such that it’s partial
derivative with respect to any direction will provide us the velocity component at perpendicular
to that direction.
Stream function will be represented by Ψ i.e. psi. It is defined only for two dimensional flow.
Where,
ur is the velocity component in radial direction and uθ is the velocity component in tangential
direction.
Let us use the value of u and v in continuity equation; we will have following equation as
mentioned here.
5
Therefore existence of stream function (Ψ) indicates a possible case of fluid flow. Flow might be
rotational or irrotational.
If stream function (Ψ) satisfies the Laplace equation, it will be a possible case of an irrotational
flow.
Conditions in a body of fluid can vary from point to point and, at any given point, can
vary from one moment of time to the next. Flow is described as uniform if the velocity
at a given instant is the same in magnitude and direction at every point in the fluid. If,
at the given instant, the velocity changes from point to point, the flow is described as
Non-uniform. In practice, when a fluid flows past a solid boundary there will be
variations of velocity in the region close to the boundary. However, if the size and
shape of the cross-section of the stream of fluid are constant, the flow is considered to
be uniform.
6
Fig 2.1 :Uniform Flow
Consider a radial flow going away from the origin at a velocity vr as shown in Fig below.This
constitutes a Source Flow. This is a purely radial flow with no component of velocity in the
tangential direction, i.e., vθ. If m is the volumetric flow rate we have
i.e,
We can now write down velocity potential and stream function for this flow -
7
It is easily verified that vθ for this flow. Further, the equation we started out with , namely,
Eqn. is the continuity equation for the source flow. It states that the Volumetric flow rate (mass
flow rate when multiplied by density) is constant in a radial direction and is equal to m, which is
called the Strength of the source.
Another point to make is that the radial velocity vr becomes infinite at r = 0. So the origin is a
singularity of the flow.
If m is negative we have a flow which flows inwards and is called a Sink flow, which again has a
singularity at the origin.
8
2.3.4 Source in a Uniform Stream –Half-Body
Rankine Half-Body
9
A Rankine half body is a feature of fluid flow that is formed when a fluid source is added to a
fluid undergoing potential flow. Superposition of uniform flow and source flow yields the
rankine half body flow. A practical example of this type of flow is a bridge pier or a strut placed
in a uniform stream. The resulting stream function (ψ) and velocity potential (ϕ) are obtained by
simply adding the stream function and velocity potential for each individual flow.
Stagnation Point
A stagnation point is a point in a flow field where the local velocity of the fluid is
zero. Stagnation points exist at the surface of objects in the flow field, where the fluid is brought
to rest by the object. The Bernoulli equation shows that the pressure is highest when the velocity
is zero and hence static pressure is at its maximum value at stagnation points. This static pressure
is called the stagnation pressure.
2.3.5 MATLAB codes for combination of uniform flow and source flow:
We use following MATLAB codes for generating the combination of uniform flow and source
flow.
clc;
clear all;
U = 1;
[X Y] = meshgrid(-30:3:30, -30:3:30);
psi = U.*Y;
figure
% for stream line
10
contour(X, Y, psi, 'k-', 'linewidth', 2, 'showtext','on',
'textstep',2,'levelstep',2.5 );
xlim([-30 30]);ylim([-30 30]);
xlabel('X');ylabel('Y');
grid on;
hold on;
v = U.*X;
% for velocity potential function
contour(X, Y, v);
title('Uniform Flow','linewidth', 15);
clc;
clear all;
m = 30;
[X Y] = meshgrid(-30:0.11:30, -30:0.11:30);
psi = m/(2*pi)*atan(Y./X);
figure
% For streamline
contour(X, Y, psi, 'k-', 'linewidth', 2);
xlim([-30 30]);ylim([-30 30]);
xlabel('X');ylabel('Y');
grid on;
hold on;
v = (m/(2*pi))*log(sqrt(X.^2 + Y.^2));
% for velocity potential function
contour(X, Y, v, 'k-', 'linewidth', 1,'showtext','on',
'textstep',2,'levelstep',2.5);
title('SOURCE FLOW-STREAMLINES AND VELOCITY
POTENTIAL','LINEWIDTH',2);
11
% x and y value for second quadrant and corresponding stream
function (psi)
[X3, Y3] = meshgrid(-30:0.1:-0.0005, 0.0005:0.1:30);
psi3 = U.*Y3 + m/(2*pi)*atan(Y3./X3);
% x and y value for fourth quadrant and corresponding stream
function (psi)
[X4, Y4] = meshgrid(0.0005:0.1:30, -30:0.1:-0.00005);
psi4 = U.*Y4 + m/(2*pi)*atan(Y4./X4);
figure
12
2.4 Theory related to ANSYS Simulation
2.4.1 Venturimeter
A venturimeter is a device used to measure the fluid flow through pipes. This flow
measurement device is based on the principle of Bernoulli’s equation. Inside the pipe,
pressure difference is created by reducing the cross-sectional area of the flow passage.
This difference in pressure is measured with the help of manometer and helps in
determining rate of fluid flow or other discharge from the pipe line. As the main inlet
area is more as compared to throat, velocity of fluid at throat increases therefore
pressure decreases. By this, a pressure difference is created between the inlet and the
throat of the venturimeter. Hence, by reducing the cross-sectional area of the flow
passage, a pressure difference is created and we measure that difference in pressure by
using Bernoulli equation and discharge formula.
Governing Equations
Bernoulli Equation:
, where,
p = pressure of fluid
V= velocity of fluid
Z= height of fluid
13
Discharge Equation:
Flow in pipes mainly two types of losses viz. major loss and minor loss. Major loss occurs due to
the effect of the fluid's viscosity near the surface of the pipe or duct and is generally termed as
friction loss. While minor losses result from changes in geometry or added components to a
piping system. Minor losses along with major losses are responsible for pressure drops along a
pipe. As name suggests, the long piping system major loss is very large as compared to minor
losses but in case of small piping system and large number of changes in geometry, minor
losses could have higher value than major loss.
Major loss, which are associated with friction energy loss per length of pipe depends on
the flow velocity, pipe length, pipe diameter, and a friction factor based on the roughness of
the pipe, and whether the flow is laminar or turbulent (i.e. the Reynolds number of the flow).
Although the head loss represents a loss of energy, it does not represent a loss of total
energy of the fluid. The total energy of the fluid conserves as a consequence of the law of
conservation of energy. In reality, the head loss due to friction results in an equivalent increase
in the internal energy (increase in temperature) of the fluid.
By observation, the major head loss is roughly proportional to the square of the flow rate in
most engineering flows (fully developed, turbulent pipe flow).
The most common equation used to calculate major head losses in a tube or duct is the Darcy–
Weisbach equation.
14
Darcy–Weisbach equation:
, where:
Minor losses:
Although they often account for a major portion of the head loss, especially in process piping,
the additional losses due to entries and exits, fittings and valves are traditionally referred to as
minor losses. These losses represent additional energy dissipation in the flow, usually caused by
secondary flows induced by curvature or recirculation. The minor losses are any head loss
present in addition to the head loss for the same length of straight pipe.
15
Governing equation:
1. Mitre bend:
A mitre bend is a joint made by beveling each of two parts to be joined, usually at a 45° angle, to
form a corner, usually a 90° angle. The value of K for mitre bend without vane is 1.1.
16
4. Bends and Elbow:
Bend is a generic term for any offset or change of direction in the piping. It is a vague term that
also includes elbows. Pipe elbow is a standard fitting but bends are custom fabricated. Bend has
a larger radius then elbows and generally the most basic difference is the radius of curvature.
Elbows generally have radius of curvature between one to twice the diameter of the pipe. Bends
have a radius of curvature more than twice the diameter. Elbows have industrial standards and
have limitations to size, bend radius and angle. The angles are usually 45 deg or 90 degrees. All
others offsets are classified as pipe bends.
17
CHAPTER THREE
The shape of different flows were plotted using MATLAB for a given Uniform Velocity (U) = 1
m/s2 and mass flow rate(m) = 30 m3/s.
18
Fig 3.1: Streamlines of Uniform Flow
Depiction of Streamlines and velocity potential function of a Uniform Flow is shown in the
figure given below:
19
Fig 3.2: Source Flow
20
3.1.3 Combination of Uniform and Source Flow
21
Straight line represents distance (πb=D/2) from the X-axis line i.e, (HALF BODY WIDTH ON
ONE SIDE ).
For a constant mass flow rate (m), half- body width (D) varies inversely with velocity(U) of
Uniform Flow.
i.e, D =K*1/U
Fig 3.4 U= 2
For U= 2, the width of Half-Body is decreased which is evident from the figure above fig 3.4
22
Fig 3.5: U= 0.5
For U= 0.5, the width of Half-Body is increased which is evident from the figure above fig 3.5
23
3.2 For ANSYS Simulation
3.2.1 Venturimeter:
In order to compare our results obtained from ANSYS simulation with that from lab, we observe
the data from following table.
S.N. Volume flow Mass flow rate, Velocity at inlet, (m/s) Velocity at throat, (m/s)
rate, kg/s
Lab ANSYS Lab ANSYS
Table 1: table showing the difference in result obtained from lab and ANSYS
simulation
From this table, it is clear that the values of velocity of fluid at throat of venturimeter obtained in
lab and calculated from ANSYS are very close. This shows us that the results obtained by CFD
simulation are very accurate for simple flow and nearly matches to experimental data. Thus large
about of time and money can be saved using CFD simulations in comparison to conducting
experiment on the real object or prototype.
24
Velocity profile of fluid in venturimeter obtained from ANSYS:
Fig 3.6: velocity distribution of flow at inlet velocity mass flow rate=0.431kg/s
Above image obtained from ANSYS simulation shows us that there is maximum velocity of
fluid at the throat of venturimeter. The velocity of fluid at inlet of the venturimeter is constant
over the inlet area shown by the light blue color, whereas there is large variation in the velocity
of fluid over the outlet area of the venturimeter. This region shown by dark blue color is the
region of ‘no slip condition’ and the fluid is at rest in this region. It also shows us that the fluid
velocity goes on increasing up to the throat and then it starts decreasing.
25
Pressure distribution of fluid in venturimeter obtained from ANSYS:
Above image obtained from ANSYS shows us that there is high pressure at the inlet of the
venturimeter which is shown by the red color and the pressure goes on decreasing smoothly until
the throat, where the pressure is least, and then it starts increasing. There is very low pressure at
circumference of the throat shown by the blue color. This result also matches with the pressure
distribution of fluid obtained in the lab where there was maximum pressure at inlet, minimum at
throat and maximum at outlet.
26
3.2.1.1 Effect of entry and exit angles to flow:
To observe the effect of change in entry and exit angle, we performed simulation in ANSYS for
different inlet and outlet angles of venturimeter provided in lab.
Initial values of angle of inlet and exit of venturimeter are and respectively. We
performed ANSYS simulation for inlet mass flow rate =0.0431kg/s. For venturimeter of lab,
velocity of fluid at the throat, =0.2338m/s.
This shows us that, increasing the inlet angle of venturimeter increases the velocity at the throat
of venturimeter.
This shows us that, decreasing the inlet angle of venturimeter decreases the velocity at the throat
of venturimeter.
This shows us that, increasing the inlet angle of venturimeter decreases the velocity at the throat
of venturimeter.
This shows us that, decreasing the outlet angle of venturimeter increases the velocity at the throat
of venturimeter.
27
Fig 3.8: velocity profile of fluid in venturimeter with inlet angle 30 degree
Fig 3.9: pressure distribution of fluid in venturimeter with inlet angle 30 degree
28
Fig 3.10: velocity profile of fluid in venturimeter with inlet angle 15 degree
Fig 3.11: pressure distribution of fluid in venturimeter with inlet angle 15 degree
29
Fig 3.12: velocity distribution of fluid in venturimeter with outlet angle 20 degree
Fig 3.13: pressure distribution of fluid in venturimeter with outlet angle 20 degree
30
Fig 3.14: velocity distribution of fluid in venturimeter with outlet angle 7 degree
Fig 3.15: pressure distribution of fluid in venturimeter with outlet angle 7 degree
31
3.2.2 Losses in pipe:
We performed CFD simulation for different types of pipe fittings using ANSYS and observe the
outlet velocity for five different flow rates that we performed in the lab.
The various values of inlet and outlet velocities obtained from lab and ANSYS simulation is
tabulated below.
Table 2: inlet and outlet fluid velocities from ANSYS and lab in mitre bend
This table shows us that the inlet velocity of the fluid obtained at lab and from ANSYS is almost
same. Here, we actually didn’t directly observe the inlet and outlet velocity in lab but we
calculated it from flow rate, so we have same inlet and outlet velocity. But from ANSYS
simulation we see that there is slight increase in outlet velocity of the fluid.
32
Pressure distribution in mitre bend at flow rate Q=0.1627 l/s
This image shows the pressure distribution of fluid in mitre bend. It is clear from the
image that pressure of the inlet is quite higher than that in the outlet. The pressure is
quite high at the upper corner of the mitre bend which is shown by red color in the
above image. This very high pressure is due to the stagnation of the fluid at the
corner. Similarly there is a region of very low pressure represented by light blue color
in the above figure.
33
Velocity profile in mitre bend at flow rate Q=0.1627 l/s
From above fig we see that there is zigzag change in velocity of the fluid at the upper section of
the mitre bend. The region of blue dark blue color is the region ‘no slip condition’ and the fluid
particles have zero velocity at this region. There is a region of very high velocity which is
represented by red color in the above image.
The various values of inlet and outlet velocities obtained from lab and ANSYS simulation is
tabulated below.:
Table 3: inlet and outlet fluid velocities from ANSYS and lab in enlargement fitting
34
This table shows us that the inlet velocity of the fluid obtained at lab and from ANSYS is almost
same. Also it shows decrease in the outlet velocity of the fluid in sudden enlargement fitting.
This figure shows us that as soon as the fluid enters sudden enlargement there is instantaneous
drop in fluid velocity. The red color represents the high velocity zone whereas dark blue
represents ‘no slip zone’. The velocity of fluid goes on decreasing towards the outlet.
35
Fig 3.19: Pressure distribution in enlargement bends
This picture shows the pressure distribution of fluid in the enlargement bends. Clearly we can
observe that pressure goes on increases on increasing as fluid moves through sudden
enlargement. Initially it may seem that the pressure is decreasing but the initial decrease in the
pressure may be due to friction loss. Thus there is smooth increase in pressure after it enters the
enlargement section
The various values of inlet and outlet velocities obtained from lab and ANSYS simulation is
tabulated below.
36
Table 4: inlet and outlet fluid velocities from ANSYS and lab for contraction fitting
This table shows us that the inlet velocity of the fluid obtained at lab and from ANSYS is almost
same and there is large increment in outlet velocity of fluid in sudden contraction.
We observe from above fig that the pressure of the fluid goes on decreasing as it
moves through the contraction fitting.
37
Fig 3.21: pressure distribution in contraction fitting
Above velocity profile of fluid shows that the velocity of the fluid goes on increasing as it moves
through contraction fitting. The red color shows the zone of high velocity.
The various values of inlet and outlet velocities obtained from lab and ANSYS simulation is
tabulated below.
Table 5: inlet and outlet fluid velocities from ANSYS and lab for elbow bend
38
This table shows us that the inlet velocity of the fluid obtained at lab and from ANSYS is almost
same and it also shows that there is slight increment in the fluid velocity at the outlet section of
the elbow bend.
From above figure we see that there is radial pressure variation in elbow bend. The red zone
shows the highest pressure and dark blue represent very low pressure. Thus we observe that the
outer layers of fluid have high pressure and inner circumference of the elbow bend has low
pressure
39
Fig 3.23: velocity variation in 90 degree elbow
This image shows us that there is slight variation in fluid velocity along the elbow bend. At the
end of this bend there is slight increase in fluid velocity. Since there is no relative velocity
between walls and fluid so we can clearly see that there is negligible fluid velocity very close to
wall.
The various values of inlet and outlet velocities obtained from lab and ANSYS simulation is
tabulated below.
Table 6: inlet and outlet fluid velocities from ANSYS and lab for short bend
40
This table shows us that the inlet velocity of the fluid obtained at lab and from ANSYS is almost
same. Its shows slight increment in outlet velocity of the fluid but the increment is less among
other bends such as mitre and elbow.
The pressure distribution of short bend is quite similar to that of elbow except there is abit less
variation in pressure.
41
Fig 3.25: Velocity profiles of fluid in short bend
The velocity profile of short bend is quite similar to that of elbow except there is less variation in
fluid velocity across the bend. The figure shows us the outlet velocity is a bit lower than elbow
bend.
42
CHAPTER FOUR
4.1PROBLEM ENCOUNTERED
During the course of this project we encountered some specific problems which were mainly
because of insufficient knowledge or rather lack of knowledge of application of MATLAB
and ANSYS software. Some problems encountered are:
43
4.3 CONCLUSION
The project which was given to us was successfully completed with the combined effort of all of
us. We were able to develop MATLAB code to analyze the flow formed by the combination of
source and uniform flow and also were able to determine various parameters of the flow. We
found out the effect of uniform flow velocity on the width of Rankine half body.
Also in ANSYS we found out the flow pattern in venturimeter and different types of pipes. We
also calculated different parameters of the flow such as pressure, velocity, pressure head, etc. .
We also calculated losses in pipes for mitre, short bend, contraction, enlargement, and elbow.
After that we compared the result obtained from ANSYS to that of the Lab report. After
comparing it was found out that there were some differences in the reading of lab and to that of
ANSYS.
It was a great learning time for all the group members while doing this project. This project work
/ assignment helped us to be creative and explore best of ourselves. It also helped to know what
group work actually means. This helps us to be more communicative with our friends and
teachers and on various topics.
44
REFERENCE
Fundamentals of Fluid Mechanics ,Munson, Young
J. F. Douglas, J. M. Gasoriek, John Swaffield, Lynne Jack - Fluid Mechanics
Fox and McDonald’s Introduction to Fluid Mechanics
Yunus A. Çengel and John M. Cimbala -Fluid Mechanics
Frank M. White-Fluid Mechanics
45