1 /**************************************************************** 2 * FUNCTION heatex.c - specify heat exchanger geometric * 3 * parameters of the Stirling cycle machine. * 4 * FILENAME: heatex.c * 5 * PROGRAMMERS: Izzi Urieli (FORTRAN) * 6 * Eric Malroy (translation to "C") * 7 * DATE: 941201/951218 * 8 * LAST MODIFICATION: 01/10/2000 by I Urieli * 9 * INCLUDE: , , "define.h" * 10 * GLOBAL VARIABLES: - none * 11 * PROTOTYPE: void heatex(void); * 12 * PRE: none * 13 * POST: the heat exchanger modules have been invoked. * 14 ****************************************************************/ 15 #include 16 #include 17 #include "define.h" 18 19 void cooler(void); /* cooler, adjacent to compression space */ 20 void regen(void); /* regenerator, between cooler and heater */ 21 void heater(void); /* heater, adjacent to expansion space */ 22 void pipes(double *, double *, double *, double *, double *); 23 /* pipes: homogeneous smooth pipes configuration */ 24 void annulus(double *, double *, double *, double *, double *); 25 /* annulus: smooth annulus configuration */ 26 void slots(double *, double *, double *, double *, double *); 27 /* slots configuration */ 28 29 void heatex() 30 { 31 cooler(); 32 regen(); 33 heater(); 34 } 35 36 /**************************************************************** 37 * FUNCTION cooler - specifies the cooler geometric parameters * 38 * of the Stirling cycle machine. * 39 * FILENAME: heatex.c * 40 * PROGRAMMER: Izzi Urieli (FORTRAN) * 41 * Eric Malroy (translation to "C") * 42 * DATE: 941201/951218 * 43 * LAST MODIFICATION: 01/10/2000 by I Urieli * 44 * INCLUDE: , , "define.h" * 45 * GLOBAL VARIABLES: * 46 * FILE *infile - pointer to the input data file * 47 * FILE *outfile - pointer to the output data file * 48 * FILE *printfile - pointer to the print output file * 49 * vk: cooler void volume (cu.m) * 50 * ak: cooler internal free flow area (sq.m) * 51 * awgk: cooler internal wetted area (sq.m) * 52 * dk: cooler hydraulic diameter (m) * 53 * lk: cooler effective length (m) * 54 * PROTOTYPE: void cooler(void); * 55 * PRE: infile, outfile, printfile * 56 * POST: cooler global variables have been specified * 57 ****************************************************************/ 58 59 void cooler(void) 60 { 61 char myKol; 62 63 fprintf(printfile,"\n cooler:\n"); 64 fgetc(infile); /* remove "return" char from input buffer */ 65 do { 66 printf("\n enter cooler configuration\n"); 67 printf(" p, for smooth pipes\n"); 68 printf("a, for smooth annulus\n"); 69 printf(" s, for slots\n"); 70 fflush(stdin); 71 myKol = fgetc(infile); 72 if (myKol == 'p') { 73 fprintf(outfile, "%c\n", myKol); 74 pipes(&vk,&ak,&awgk,&dk,&lk); 75 } 76 else if (myKol == 'a') { 77 fprintf(outfile, "%c\n", myKol); 78 annulus(&vk,&ak,&awgk,&dk,&lk); 79 } 80 else if(myKol=='s') { 81 fprintf(outfile, "%c\n", myKol); 82 slots(&vk,&ak,&awgk,&dk,&lk); 83 } 84 else { 85 printf("cooler config %c undefined\n",myKol); 86 myKol = 'u'; 87 } 88 } 89 while(myKol=='u'); 90 } 91 92 /**************************************************************** 93 * FUNCTION heater - specifies the heater geometric parameters * 94 * of the Stirling cycle machine. * 95 * FILENAME: heatex.c * 96 * PROGRAMMER: Izzi Urieli (FORTRAN) * 97 * Eric Malroy (translation to "C") * 98 * DATE: 941201/951218 * 99 * LAST MODIFICATION: 08/16/96 by I Urieli * 100 * INCLUDE: , , "define.h" * 101 * GLOBAL VARIABLES: * 102 * FILE *infile - pointer to the input data file * 103 * FILE *outfile - pointer to the output data file * 104 * FILE *printfile - pointer to the print output file * 105 * vh: heater void volume (cu.m) * 106 * ah: heater internal free flow area (sq.m) * 107 * awgh: heater internal wetted area (sq.m) * 108 * dh: heater hydraulic diameter (m) * 109 * lh: heater effective length (m) * 110 * PROTOTYPE: void heater(void); * 111 * PRE: infile, outfile, printfile * 112 * POST: heater global variables have been specified * 113 ****************************************************************/ 114 void heater(void) 115 { 116 char myHot; 117 118 fprintf(printfile,"\n heater:\n"); 119 fgetc(infile); /* remove "return" char from input buffer */ 120 do { 121 printf("\n enter heater configuration\n"); 122 printf("p, for smooth pipes\n"); 123 printf("a, for smooth annulus\n"); 124 printf("s, for slots\n"); 125 fflush(stdin); 126 myHot = fgetc(infile); 127 if (myHot == 'p') { 128 fprintf(outfile, "%c\n", myHot); 129 pipes(&vh,&ah,&awgh,&dh,&lh); 130 } 131 else if (myHot == 'a') { 132 fprintf(outfile, "%c\n", myHot); 133 annulus(&vh,&ah,&awgh,&dh,&lh); 134 } 135 else if(myHot == 's') { 136 fprintf(outfile, "%c\n", myHot); 137 slots(&vh,&ah,&awgh,&dh,&lh); 138 } 139 else { 140 printf("heater config %c undefined\n",myHot); 141 myHot = 'u'; 142 } 143 } 144 while(myHot == 'u'); 145 } 146 147 /**************************************************************** 148 * FUNCTION pipes - specifies the geometric parameters of * 149 * homogeneous smooth pipes heat exchanger. * 150 * FILENAME: heatex.c * 151 * PROGRAMMER: Izzi Urieli (FORTRAN) * 152 * Eric Malroy (translation to "C") * 153 * DATE: 941201/951218 * 154 * LAST MODIFICATION: 08/15/96 by I Urieli * 155 * INCLUDE: , , "define.h" * 156 * GLOBAL VARIABLES: * 157 * FILE *infile - pointer to the input data file * 158 * FILE *outfile - pointer to the output data file * 159 * FILE *printfile - pointer to the print output file * 160 * PROTOTYPE: * 161 * void * 162 * pipes(double *, double *, double *, double *, double *); * 163 * PRE: infile, outfile, printfile * 164 * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * 165 ****************************************************************/ 166 void pipes(double *ptr_v, /* void volume (cu.m) */ 167 double *ptr_a, /* free flow area (sq.m) */ 168 double *ptr_awg, /* wetted area (sq.m) */ 169 double *ptr_d, /* hydraulic diameter (m) */ 170 double *ptr_ell) /* effective length (m) */ 171 { 172 int n; /* n: number of pipes in bundle */ 173 double v; /* Void volume (cu.m) */ 174 double a; /* free flow area (sq.m) */ 175 double awg; /* wetted area (sq.m) */ 176 double d; /* hydraulic diameter (m) */ 177 double ell; /* effective length (m) */ 178 179 printf(" homogeneous bundle of smooth pipes\n"); 180 printf(" enter inside diam(m), length(m), num. pipes\n"); 181 fscanf(infile, "%lf %lf %d", &d,&ell,&n); 182 fprintf(outfile," %f %f %d\n", d,ell,n); 183 fprintf(printfile, " homogeneous bundle of smooth pipes\n"); 184 fprintf(printfile, " inside diam(m), length(m), num. pipes:\n"); 185 fprintf(printfile, " %f %f %d\n", d,ell,n); 186 187 /* geometric parameters:*/ 188 a = PI*(float)(n)*d*d/4.0; 189 v = a*ell; 190 awg = (float)(n)*PI*d*ell; 191 printf(" void volume(cc) %10.2f\n", v*1.0e6); 192 fprintf(printfile," void volume(cc) %10.2f\n", v*1.0e6); 193 *ptr_v = v; 194 *ptr_a = a; 195 *ptr_awg = awg; 196 *ptr_d = d; 197 *ptr_ell = ell; 198 } 199 200 /**************************************************************** 201 * FUNCTION annulus - specifies the geometric parameters of * 202 * annular heat exchanger. * 203 * FILENAME: heatex.c * 204 * PROGRAMMER: Izzi Urieli (FORTRAN) * 205 * Eric Malroy (translation to "C") * 206 * DATE: 941201/951218 * 207 * LAST MODIFICATION: 08/15/96 by I Urieli * 208 * INCLUDE: , , "define.h" * 209 * GLOBAL VARIABLES: * 210 * FILE *infile - pointer to the input data file * 211 * FILE *outfile - pointer to the output data file * 212 * FILE *printfile - pointer to the print output file * 213 * PROTOTYPE: * 214 * void * 215 * annulus(double *, double *, double *, double *, double *);* 216 * PRE: infile, outfile, printfile * 217 * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * 218 ****************************************************************/ 219 void annulus(double *ptr_v, /* void volume (cu.m) */ 220 double *ptr_a, /* free flow area (sq.m) */ 221 double *ptr_awg, /* wetted area (sq.m) */ 222 double *ptr_d, /* hydraulic diameter (m) */ 223 double *ptr_ell) /* effective length (m) */ 224 { 225 double dout, di; /* dout,di: outside,inside diameter of annular gap*/ 226 double v; /* void volume (cu.m) */ 227 double a; /* free flow area (sq.m) */ 228 double awg; /* wetted area (sq.m) */ 229 double d; /* hydraulic diameter (m) */ 230 double ell; /* effective length (m) */ 231 232 printf(" annular gap heat exchanger\n"); 233 printf(" enter outer,inner annular gap diam(m)\n"); 234 fscanf(infile, "%lf%lf", &dout,&di); 235 fprintf(outfile, " %f %f", dout,di); 236 printf(" enter heat exchanger length(m)\n"); 237 fscanf(infile,"%lf", &ell); 238 fprintf(outfile, " %f\n", ell); 239 fprintf(printfile, " annular gap heat exchanger\n"); 240 fprintf(printfile, " outer, inner annular gap diam(m):\n"); 241 fprintf(printfile, " %f %f\n", dout,di); 242 fprintf(printfile, " heat exchanger length(m)\n"); 243 fprintf(printfile," %f\n",ell); 244 245 /* geometric parameters:*/ 246 a = PI*(dout*dout - di*di)/4.0; 247 v = a*ell; 248 awg = PI*(di + dout)*(ell); 249 d = dout - di; 250 printf(" Void vol(cc) %10.2f\n", v*1.0e6); 251 printf(" Hydraulic diam(mm),%10.2f\n", d*1.0e3); 252 fprintf(printfile," Void vol(cc), %10.2f\n", v*1.0e6); 253 fprintf(printfile," Hydraulic diam(mm), %10.2f\n", d*1.0e3); 254 *ptr_v = v; 255 *ptr_a = a; 256 *ptr_awg = awg; 257 *ptr_d = d; 258 *ptr_ell = ell; 259 } 260 261 /**************************************************************** 262 * FUNCTION slots - specifies the slots geometric parameters * 263 * FILEMNAME: heatex.c * 264 * PROGRAMMER: Eric Malroy * 265 * DATE: 05-04-96 * 266 * LAST MODIFICATION: 08/16/96 by I Urieli * 267 * INCLUDE: , , "define.h" * 268 * GLOBAL VARIABLES: * 269 * FILE *infile - pointer to the input data file * 270 * FILE *outfile - pointer to the output data file * 271 * File *printfile - pointer to the print output data file * 272 * PROTOTYPE: * 273 * void * 274 * slots(double *, double *, double *, double *, double *); * 275 * PRE: infile, outfile, printfile * 276 * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * 277 * *************************************************************/ 278 void slots(double *ptr_v, /* void volume (cu.m) */ 279 double *ptr_a, /* free flow area (sq.m) */ 280 double *ptr_awg, /* wetted area (sq.m) */ 281 double *ptr_d, /* hydraulic diameter (m) */ 282 double *ptr_ell) /* effective length (m) */ 283 { 284 double w; /* width of slot */ 285 double h; /* height of slot (m) */ 286 int n; /* number of slots */ 287 double v; /* void volume (cu.m) */ 288 double a; /* free flow area (sq.m) */ 289 double awg; /* wetted area (sq.m) */ 290 double d; /* hydraulic diameter (m) */ 291 double ell; /* effective length (m) */ 292 293 printf(" slots heat exchanger\n"); 294 printf(" enter width, height of slot (m)\n"); 295 fscanf(infile,"%lf%lf", &w, &h); 296 fprintf(outfile," %f %f\n", w, h); 297 printf(" enter heat exchanger length (m)\n"); 298 fscanf(infile,"%lf", &ell); 299 fprintf(outfile, "%f\n", ell); 300 printf(" enter number of slots\n"); 301 fscanf(infile,"%d", &n); 302 fprintf(outfile,"%d\n", n); 303 fprintf(printfile," slot heat exchanger\n"); 304 fprintf(printfile," width and height of slot (m):\n"); 305 fprintf(printfile," %f %f\n", w, h); 306 fprintf(printfile," heat exchanger length (m) & number of slots\n"); 307 fprintf(printfile," %f %d\n", ell, n); 308 309 v = (float)(n)*w*h*ell; 310 a = (float)(n)*w*h; 311 awg = (float)(n)*2.0*(w+h)*ell; 312 d = 4.0*v/awg; 313 printf(" Void volume %10.2f(cc)\n", v*1.0e6); 314 printf(" Hydraulic diam %10.2f(mm)\n", d*1.0e3); 315 fprintf(printfile, " Void volume %10.2f(cc)\n", v*1.0e6); 316 fprintf(printfile, " Hydraulic diameter %10.2f(mm)\n", d*1.0e3); 317 *ptr_v = v; 318 *ptr_a = a; 319 *ptr_awg = awg; 320 *ptr_d = d; 321 *ptr_ell = ell; 322 } condor{t.gentry}16: