ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

ECMM171P

2020-11-29 19:03:06  阅读:263  来源: 互联网

标签:ECMM171P friction should pipe fD factor your



ECMM171P Programming for Engineers
Assignment 1 - Friction Factors
Hand-in date: 18:00 Friday 27th November 2020
This assignment will count for 30% of your total grade in the course.
Remember that all work you submit should be your own work. This assignment is not
meant to be a team exercise. The University treats plagiarism very seriously.
Ensure that your program runs without any error on the Matlab versions R2019a and
later. Additionally, ensure that you pay careful attention to the instructions and marking
scheme below, particularly in regards to defining specific functions, commenting your code
appropriately and ensuring its readability.
You should submit your source code by 18:00 Friday 27th November 2020
If you have more general or administrative problems please e-mail me. Always include
the course number (ECMM171P) in the subject of your e-mail.
As a fluid flows through a pipe, it encounters resistance according to several factors, including
the diameter and wall roughness of the pipe, the velocity and viscosity of the fluid, and whether
the fluid is in a laminar or turbulent state. However, the relationship between these variables is
typically complex and nonlinear, meaning that we require computational techniques to predict
pressure losses – a requirement in a range of engineering design scenarios.
The purpose of this assignment is to create a predictive engineering tool to calculate the socalled
friction factor of a pipe flow, thereby providing an estimate of pressure loss per unit
length.
1 Theory
Consider a circular pipe of diameter D and length L, through which a fluid of density ρ is flowing
at a mean flow velocity U.
where the dimensionless quantity fD is referred to as the Darcy friction factor. The precise
value of the friction factor, however, is difficult to determine analytically for turbulent flows.
Its calculation depends on:
The Reynolds number
ECMM171P语言代写、Matlab程序实
µ
where µ is the dynamic viscosity of the fluid. Re dictates whether the fluid is in a turbulent
or laminar state: if Re < 2040 the flow can be assumed to be laminar, or if Re ≥ 2040
we assume it is turbulent.
For turbulent flows, the pipe’s relative roughness, r = /D, where  is the pipe’s effective
roughness height.
1
1.1 Calculating fD 2 YOUR TASKS
1.1 Calculating fD
If the flow is laminar, then the relationship for the friction factor is straightforward and can be
derived from the Poiseuille (laminar) flow profile, giving,
fD =
64
Re
On the other hand, if the flow is turbulent, the relationship is more complex. In this case, fD
can only be found by solving the nonlinear Colebrook-White equation.
Clearly, this relationship cannot be solved analytically. However, by rearranging this equation,
we can see that it can instead be turned into a root-finding problem; i.e. find fD such that the
function C(fD) = 0,
This is where your program will come into play! Your task is to write a Newton-Rapshon solver
that will solve this root finding problem.
2 Your Tasks
1. Write two functions called colebrook and colebrook deriv that evaluate C(fD) and the
derivative of C(fD) with respect to fD, respectively. These functions should include:
Inputs: the friction factor fD, the Reynolds number Re, and the relative roughness /D.
Outputs: the value of C(fd) and of the derivative of C(fD) respectively.
2. In order to find the root of a function f(x) using the Newton-Raphson algorithm, we
first require the function’s derivative f
0
(x) and an initial starting point x0,
which after enough iterations usually gives a good approximation to a root of f.
In this task, you should write a function called newton, which will perform NewtonRapshon
using your colebrook and colebrook deriv functions to solve for a root of the
C(fD) function.
In the Newton-Raphson algorithm you should check at each step whether the sequence
has converged to a limit, this can be done by calculating |xn − xn−1| < tol, where tol
is your desired tolerance. You should also include a variable controlling the maximum
number of iterations in case the algorithm does not converge.
Your newton function should include:
Inputs: initial value, tolerance, max iterations
Outputs: the root, number of iterations the algorithm run.
2
2 YOUR TASKS
103 104 105 106 107 108 109
Reynolds number: Re
10-2
10-1
Friction factor fD
Moody chart for laminar/turbulent pipe flow
Laminar
Smooth
e/D=1e-2
e/D=1e-3
e/D=1e-4
e/D=1e-5
e/D=1e-6
Turbulent transition
Requested parameters
Figure 1: Moody diagram for a range of relative pipe roughness factors.
NOTE: Depending on how you solve the problem your newton function will likely require
some extra parameters which may be needed by the colebrook function. You are free to
adjust the inputs to your newton function based on your approach, however you should
describe in your comments what those parameters are.
3. Finally, write a script called moody which calls the Newton-Raphson function to find the
friction coefficients and plots a Moody diagram similar to the one shown in Figure 1.
Moody diagrams visualise the friction factor for laminar and turbulent regimes across
a range of different pipe roughness factors and Reynolds numbers, on a log-log scale.
Typically a specific value of /D is compared against a range of reference values. In
particular, your Moody diagram should show:
the laminar friction factor for 500 ≤ Re ≤ 2500;
the turbulent friction factors given by the Colebrook equation for 2×103 ≤ Re ≤ 108
for the reference values of /D = 0 (i.e. a smooth pipe), 10−6, 10−5, 10−4, 10−3 and10−2.
the laminar-turbulent transition point at Re = 2040.
an optional list of points, shown as markers on the graph, that are read by your
script.
Your script should read a text file (found on ELE) which will contain values of: Pipe
diameter D, Fluid velocity U in m·s
−1
, Dynamic viscosity µ in P a·s, Fluid density kg·m−3
,
and Pipe roughness  in mm, and then highlight in the Moody diagram the locations where
they correspond. Finally it should output in a new text file called pressure loss.txt
the friction factor and the pressure loss per unit length (∆p/L) for the given parameters.
Your program should produce a Matlab figure, but also export it into a .png format.
Please format the figure in a similar way as in the example shown in Figure 1 including
labels, and markers for the desired points (as provided by the text file).
NOTE: In order to check that your programs are working correctly, you can use the
following parameters and compare the friction factor with your program outputs:
3
4 SUBMISSION
Pipe diameter [m]: 1
Fluid velocity [m/s]: 1
Fluid density [kg/mˆ3]: 1000
Fluid viscosity [Pa s]: 0.0010518
Pipe roughness [mm]: 3
Reynolds number is: 9.5075e+05
Calculated friction factor: 2.6273e-02
3 Marking scheme
Your submission will be assessed on the following criteria:
Fully working implementation of the colebrook and colebrook deriv functions.
[10%]
Fully working implementation of the newton method. [30%]
Fully working implementation of the moody script which calls the functions. [30%]
Correct implementation of the text input/output in your script and correctly formatted
graph. [15%]
Discretionary marks for good programming technique, structure, testing and commenting.
[15%]
Details regarding the specific criteria that are used in the above can be found in the module
handbook on ELE. You should attempt all of the above routines; incomplete solutions
will be given partial credit. Note that these routines will all be marked independently,
and you can still receive full credit for complete solutions even if the preceding parts are
not fully implemented.
4 Submission
You should compress all your Matlab files and your Moody diagram in a single .zip file,
and submit using the online Turnitin link on the ELE page.
如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

标签:ECMM171P,friction,should,pipe,fD,factor,your
来源: https://www.cnblogs.com/rightc/p/14057355.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有