ME 322 MATLAB Tools

This page provides links to MATLAB mfiles for use with ME 322. The mfiles are organized into two Toolboxes.

Pipe flow toolbox
Design single pipe systems and match a single pipe system to a pump.

Isentropic flow toolbox
Compute stagnation and sonic reference states for compressible flow of ideal gases.

## Toolbox for Pipe Flow Analysis

The mfiles may be downloaded as a single zip archive or as individuals files from the following list.

m-file name   Description
contractionLoss.m   computes the minor loss coefficient for a sudden contraction.
demoFlowRate.m demonstrates how to solve a flow rate problem.
demoPumpCurve.m   demonstrates how to construct a polynomial curve fit to tabulated pump curve data.
demoSysBalance.m   demonstrates how to find the balance point for a pipe system and a pump, where the pump curve is defined as a polynomial.
demoSystemCurve.m   demonstrates how to generate a system curve.
entranceLength.m   plots the entrance length correlations, Le/D = fcn(Re), for laminar and turbulent flow.
makePumpCurve.m   uses least squares method to find a polynomial curve fit to tabulated pump curve data.
moody.m   evaluates the friction factor by solving the Colebrook equation (Moody Chart).
pipeFlowSolve.m   uses root-finding to solve a flow rate problem.
pipeHeadBal.m   evaluates the imbalance in the energy equation for a pipe run. The energy equation is put in the form f(Q) = 0 for use with root-finding algorithms. pipeHeadBal returns the value of f(Q) for a given Q. When the correct Q is supplied as input, pipeHeadBal will return f(Q)=0. pipeHeadBal is used by pipeFlowSolve.
pipeLoss.m   computes viscous and minor losses for a pipe run.

## Toolbox for Isentropic Compressible Flow

The mfiles may be downloaded as a single zip archive or as individuals files from the following list. A short PDF file explaining how to use these mfiles is also available.

m-file name   Description
aasmaResidual.m   computes residual of relationship between A/A* and Ma. Used by the built-in fzero root-finding routine in the solution for computing A/A* as a function of Ma.
isenAAs.m   computes area ratio A/A* as a function of Ma and k.
isenMaaas.m   computes Ma as function of area ratio A/A* and k. The appropriate branch --- subsonic or supersonic --- is chosen with an optional input parameter.
isenMapp0.m   computes Ma as function of pressure ratio p/p0 and k.
isenMarr0.m   computes Ma as function of density ratio r/r0 and k.
isenMaTT0.m   computes Ma as function of temperature ratio T/T0 and k.
isenpp0.m   computes pressure ratio p/p0 as function of Ma and k.
isenrr0.m   computes density ratio r/r0 as function of Ma and k.
isenTT0.m   computes temperature ratio T/T0 as function of Ma and k.
MYO_11_38.m   End of chapter exercise number 11.38 from Fundamentals of Fluid Mechanics by Munson, Young and Okiishi, 3rd edition, 1998, Wiley, p. 774.
testIsenProps.m   exercises all of the stagnation property routines by performing calculations in both directions, e.g. T/T0 = f(Ma,k) and Ma = g(T/T0,k).
white_E9_3.m   Exercise 9.3 from Fluid Mechanics by F.M. White, 4th edition, 1999, McGraw-Hill, pp. 582-583.

```ME 322 Home Page    Gerry's Other Classes    Gerry's Home Page
```