Showing posts with label Goal Seek. Show all posts
Showing posts with label Goal Seek. Show all posts

Double Pipe Heat Exchanger

This Excel spreadsheet helps you design a double pipe heat exchanger (also known as a concentric tube heat exchanger). Double pipe heat exchangers are often used in the chemical, food processing and oil & gas industries. They have a particular advantage when close temperature approaches are needed or in high pressure applications.

The spreadsheet will give you important design parameters, such as the overall heat transfer area, the length required, pressure drops, fluid velocities and much more.  The spreadsheet uses the
  • Gnielinski correlation for the heat transfer coefficient of the shell side and tube side fluids (hh and hc). The Gnielinski correlation is valid for 0.5 ≤ Pr ≤ 2000 and 2300 ≤ Re ≤ 56.It gives the heat transfer coefficient in terms of the friction factor, the Reynolds number and the Prandtl number.
  • Filonenko correlation for the friction factor (valid for smooth pipes in turbulent flow with 104 ≤ Re ≤ 107).
The equations for the heat transfer coefficients, the friction factor, the length of the heat exchanger and the overall heat transfer coefficient are given below

Double Pipe Heat Exchanger Equations

  • Nu is the Nusselt Number
  • Re is the Reynolds Number
  • f is the friction factor
  • Q is the rate of heat transfer (determined from a heat balance)
  • dic is the internal diameter of the inner pipe
  • doc is the external diameter of the inner pipe
  • kp is the thermal conductivity of the pipe material
  • hc is the heat transfer coefficient of the cold fluid (in the inner pipe)
  • hh is the heat transfer coefficient of the hot fluid (in the outer pipe)
  • ΔTLMTD is the log mean temperature difference
The Excel spreadsheet uses variable names in the formulas to help you better understand the equations. Generally, the suffixes h and c represents quantities defined for the hot and cold streams respectively (e.g. hh is the heat transfer coefficient for the hot stream, hc is the heat transfer coefficient for the cold stream)

Named variables

INSTRUCTIONS

Step 1. Enter your parameters. The spreadsheet will calculate initial values of the heat transfer coefficients, the rate of heat transfer across both fluids, and the length of the heat exchanger. Provide an initial guess for the parameter (i.e. mass flowrate) you will change in Step 2.

Specify your parameters

Step 2. Equalize heat transfer across both streams. The rate of heat transfer across the shell side and tube side fluids must be the same. You must use Goal Seek to make the difference between the two rates of heat transfer equal to zero by changing a design parameter (e.g. mass flowrates)

Goal Seek

You have now established important design parameters, such as the fluid velocities, the tube-side and shell-side pressure drops, Prandtl numbers, the length of the heat exchanger and so on. 

Intermediate Calculations and Results

This spreadsheet is completely free. If you have any comments, then please let me know. Download it from the link below, and please bookmark or share this website wherever you feel it appropriate.


Small-Bore Gas Orifice Meter Flow Calculator

This Excel spreadsheet calculates the flowrate from a small-bore gas orifice meter using the ASME MFC-14M-2001 standard. This calculator is valid for pipe diameters of less than 40 mm (other restrictions are given below).



The equations are as follows


  • C is the discharge coefficient. D1 has to be supplied in m
  • D1 and D2 are the diameter of the pipe and orifice respectively (m)
  • A1 and A2 are the cross sectional areas of the pipe and orifice (m2)
  • ΔP is the pressure drop across the orifice (Pa)
  • P1 and Pstd are the upstream pressure and standard pressure
  • T and Tstd are the gas temperature and standard temperature is the 
  • ρ is the gas (kg m-3)
  • μ is the gas viscosity (Pa s)
  • V1 is the liquid velocity in the pipe (m s-1)
  • Re1 is the Reynolds Number in the pipe
  • β is the diameter ratio
  • MW is the molecular weight of the gas (kg mol-1)
  • R is the universal gas constant (8314 J kmol-1 K-1)
  • γ is the specific heat ratio
  • e is the gas expansivity
  • Q is the volumetric flowrate (m3s-1)
  • Qstd is the volumetric flowrate at standard conditions (m3s-1)
The spreadsheet uses the ideal gas law to calculate the gas density (you just have to supply the molecular weight, pressure and temperature of the gas).

Note these restrictions to the validity of the equations
  • Corner Taps: 0.1 < β < 0.8 and 12 mm < D< 40 mm
  • Flange Taps: 0.15 < β < 0.7 and 25 mm < D< 40 mm
  • D2 > 6 mm
  • Re >1000
Additionally, the discharge coefficients are only valid for the tap configurations illustrated below (as specified by the ASME MFC-14M-2001 standard).


You can choose either Corner or Flange taps with a drop-down menu in the spreadsheet, and Excel automatically uses the correct correlation for the discharge coefficient.

These equations (like nearly all orifice flow meter calculations) require an iterative solution. This is easily done with Excel's Goal Seek.  All you have to do is click a button.

Goal Seek uses an initial guess value for the Reynolds Number to calculate the discharge coefficients, and uses this to calculate the flowrate. The calculated flowrate is then used to calculate the Reynolds Number.  Goal Seek then automatically adjusts the guess and calculated values of the Reynolds number until they are the same.


Calculate Least Cost Pipe Diameter and Flow Velocity with Excel

Generally, engineers choose pipe diameters and flow velocities which minimize the total cost of the pipeline over the whole pipeline lifecyle.  The total cost is the sum of the capital costs and operational costs. 

This Excel spreadsheet calculates the least total cost pipe diameter and flow velocity for a pipe, given the desired construction material, flowrate, viscosity and density.


It uses the Generaux Equation and the empirical cost parameters as given the in the January 2010 article in Chemical Engineering "Updating the Rules for Pipe Sizing".  The Generaux Equation is an empirical correlation that takes into account the
  • annual depreciation and maintenance for the pipe
  • annual depreciation of the associated pumping equipment
  • installed cost of the pipe
  • fractional efficiency of pump
  • installation and fitting costs
  • energy cost to power the pump motor
  • friction in the pipe fittings
  • installation cost of the pump
  • cost of the pipe
  • number of operating days per year
  • taxes and other expenses
  • fluid density, viscosity and the desired flowrate
The calculation is iterative and uses Excel's Goal Seek Functionality.  

The spreadsheet enables you to choose from empircal cost parameters for 1998 and 2008, for a range of materials. Generally, least-cost flow velocities have decreased over time because energy costs have increased.

Instructions
  1. Specify the construction material (choose either Carbon Steel, Stainless Steel, Alumimum or Brass), fluid density and fluid viscosity
  2.  Click the Optimize button to initial Excel's Goal Seek function

Balancing a Pump Curve against a System Curve

Introduction
This article will demonstrate how you can balance a pump curve against a system curve to calculate liquid velocity with Excel.

First, we'll develop the equations that determine the liquid velocity in a simple pump and pipe system.  Then we'll discuss how these equations be solved using Excel's Goal Seek feature. Finally, we'll show Visual Basic code that can be used to automate Goal Seek so that any parameter change will automatically calculate the new liquid velocity.

The spreadsheet can be downloaded here, but read the rest of this article if you'd like to understand the theory.

Pump and Pipe System
Consider a centrifugal pump receiving liquid from a reservoir and forcing liquid through a pipe to a reservoir.


First consider the pump.  Its flowrate-head curve is can be described by a polynomial derived from empirical data, where a, b and c are best-fit coefficients, and Q is the volumetric flowrate

Equation 1
But the volumetric flowrate is

Equation 2
where A is the cross-sectional area of the pipe and V is the liquid velocity through the pipe.  Substituting Equation 2 into Equation 1 to eliminate Q gives

Equation 3
This equation now describes the head produced by the pump as a function of the liquid velocity through the pipe.

Now consider the pipe.  Frictional head loss through the pipe can be described by the Bernoulli equation and written as

Equation 4
We'll call Equation 4 the System Curve. f is the friction factor, given by the Haaland Equation.  

Equation 5
 where Re is the Reynolds Number.

Equation 6
The Haaland equation is only valid in turbulent flow, i.e. if the Reynolds Number is over 2500. 

For our pump and pipe system, the pump head is equal to the head loss in the pipe.  Hence
Equation 7
We can now use Excel to find the liquid velocity that satisfies Equation 7 (effectively determining the intersection between the pump curve and the system curve).

Excel Implementation
The Excel spreadsheet uses this cell coloring convention.


Step 1.  First define the parameters and calculate the cross-sectional area of the pipe.

Step 2. Now define the coefficients of the pump curve


Step 3. Set up the calculations required by Goal Seek


Step 4. Go to Data > What-If Analysis > Goal Seek.  Make the changes such that we find the liquid velocity that makes difference between pump curve and the system curve equal to zero.


You should now have the correct value of the liquid velocity.


Ensure that the Reynolds number is greater than 2500 so that our assumption of turbulent flow (and hence the use of the Haaland equation) is verified.

Visual Basic Macro to Automate Goal Seek
If you're really keen, you can use Visual Basic to automate Goal Seek.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
    On Error Resume Next
    bSuccess = Range("C23").GoalSeek(0, Range("c18"))
    On Error GoTo 0
    If Not bSuccess Then
        MsgBox "Goal Seek Failed"
    End If
End Sub

Whenever any value in the worksheet is changed, the Worksheet_Change() event is initiated .  The VB code then asks GoalSeek() to find the liquid velocity ("C18") that makes the difference between the pump and system curve ("C23") equal to zero.



Solving the Colebrook-White Equation with Excel

The Colebrook-White describes the relationship between the Reynolds Number Re, the pipe relative roughness e, and the friction factor f in turbulent pipe flow.


Usually, we fix a value for Re and e, and compute f.  However, this equation cannot be solved explicitly, so numerical iteration is needed.

There's several ways we can do this in Excel.  I'll outline the two most convenient methods.  If you just want the spreadsheet, scroll to the bottom of this post and download the spreadsheet.

Spreadsheet Setup
This is a screengrab of the spreadsheet included with this post.


Note that the parameters to be entered by the user are highlighted green. I've also assigned cell names to each parameter, so the pipe roughness is e, the pipe diameter is D, and so on.

Method 1 - Using VBA and Goal Seek
This VBA macro fires up Goal Seek whenever there is any change in the worksheet (due to the Worksheet_Change() event).

Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
    On Error Resume Next
    bSuccess = Range("fCheck").GoalSeek(0, Range("f"))
    On Error GoTo 0
    If Not bSuccess Then
        MsgBox "Goal Seek Failed for Cell ""X""!"
    End If
End Sub

The code finds the value of f that will make fCheck equal 0.

Method 2 - Worksheet Iteration
You'll need to enable worksheet iteration so that Excel can correctly resolve a circular reference.  In Excel 2010 go to File>Options>Formulas, and check Enable Iterative Calculations.  You might also want to increase the number of iterations to 500, and reduce the maximum change to 0.0001).

The trick here is to rearrange the Colebrook-White equation so you have nothing but the friction factor f on the left hand side of the equation (it can appear on the right-hand side together with the other terms in the equation).


This is the formula I've typed into Cell B17 of the spreadsheet - it's just the rearragned Colebrook-White Equation, but with one minor change.

=1/(-2*LOG(e/(D*3.7) + 2.51/(Re*SQRT(B17+1E-300))))^2

When Excel starts iterating, it initializes B17 with a value of zero.  However, this will a divide-by-zero error.  To resolve this, I've added a very small number (1E-300) to B17.  This doesn't significantly change the accuracy of the computer friction factor.

Both Method 1 and 2 give roughly the same value of f.  I prefer Method 1 (purely because enabling spreadsheet iteration means you will not necessarily be informed of any unintended circular references).