Page 535 - Design and Operation of Heat Exchangers and their Networks
P. 535

518   Appendix


          Crossflow.m (MatLab code)

          % dt_h/dx = t_c - t_h = - dt_c/dy, t_h(0,y) = 1, t_c(x,0) = 0
          % t_h_m = exp(-x-y)∗sum < j = 1,inf >{y∗∗(j-1)/j!∗sum < k = 0,j-1 >{x∗∗k/k!}}
          % x = NTU_h, y = R_h∗NTU_h
          function [t_h_m] = crossflow_t_h_m (x, y)
              if (x == 0)
                  t_h_m = 1;
              elseif (y == 0)
                  t_h_m = exp(- x);
              else
                 CAS_EXP_350 = 1.0070908870280796E152;
                 n  = 1;
                 sx = 1;
                 sy = 1;
                 ay = 1;
                 ex =-x-y;
                 while (abs(sx) > abs(sy) ∗ 1E-8)
                     n=n+1;
                     ay = ay ∗ y/n;
                     if (abs(ay) > CAS_EXP_350)
                          ay = ay / CAS_EXP_350;
                          sy = sy / CAS_EXP_350;
                          ex = ex + 350;
                     end
                     ax = ay;
                     sx = ay ∗ n;
                     for k=1 :1:n-1
                          ax = ax ∗ x/k;
                          if (abs(ax) > CAS_EXP_350)
                               ax = ax / CAS_EXP_350;
                               sx = sx / CAS_EXP_350;
                               ay = ay / CAS_EXP_350;
                               sy = sy / CAS_EXP_350;
                               ex = ex + 350;
                          end
                          sx = sx + ax ∗ (n - k);
                     end
                     sy = sy + sx;
   530   531   532   533   534   535   536   537   538   539   540