{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 7.11 Flat heating Coils - Water"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Water at 80 degrees Celsius flows through a flat heating coil at a rate of 60 L/min. There are 7 180 degree bends in it. The coil is 8 m long, with 0.5 m of straight length on the inlet and exit. The r/D of the bends is 4. The pipe is schedule 40, 25 mm pipe."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pressure drop = 61330.665674 pascal\n"
     ]
    }
   ],
   "source": [
    "from math import *\n",
    "from fluids.units import *\n",
    "from thermo.units import Chemical\n",
    "\n",
    "water = Chemical('water', P=2*u.bar, T=80*u.degC) # P assumed\n",
    "rho = water.rho\n",
    "mu = water.mu\n",
    "\n",
    "Q = 60*u.L/u.min\n",
    "L = (1*8 + 0.5*2)*u.m\n",
    "\n",
    "NPS, D_pipe, Do_pipe, t = nearest_pipe(Di=25*u.mm)\n",
    "v = Q/(pi/4*D_pipe**2)\n",
    "Re = Reynolds(rho=rho, mu=mu, D=D_pipe, V=v)\n",
    "fd = friction_factor(Re=Re, eD=0.0018*u.inch/D_pipe)\n",
    "\n",
    "K_elbow = bend_rounded(Di=D_pipe, angle=180*u.degrees, fd=fd, bend_diameters=5)\n",
    "K_friction = K_from_f(fd=fd, L=L, D=D_pipe)\n",
    "\n",
    "K_tot = 7*K_elbow + K_friction\n",
    "dP = dP_from_K(K=K_tot, rho=rho, V=v)\n",
    "print('Pressure drop = %s' %dP.to(u.Pa))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The value presented in the solution is 19609 Pa. They chose a constant friction factor of 0.024 in this calculation. If this were used, the result compares much better. Their friction factor can be obtained at a roughness of 0.05 mm."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pressure drop = 18539.7300274 pascal\n"
     ]
    }
   ],
   "source": [
    "fd = 0.024\n",
    "K_elbow = bend_rounded(Di=D_pipe, angle=180*u.degrees, fd=fd, bend_diameters=5)\n",
    "K_friction = K_from_f(fd=fd, L=L, D=D_pipe)\n",
    "\n",
    "K_tot = 7*K_elbow + K_friction\n",
    "dP = dP_from_K(K=K_tot, rho=rho, V=v)\n",
    "print('Pressure drop = %s' %dP.to(u.Pa))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
