/**************************************************************** * FUNCTION heatex.c - specify heat exchanger geometric * * parameters of the Stirling cycle machine. * * FILENAME: heatex.c * * PROGRAMMERS: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 941201/951218 * * LAST MODIFICATION: 01/10/2000 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: - none * * PROTOTYPE: void heatex(void); * * PRE: none * * POST: the heat exchanger modules have been invoked. * ****************************************************************/ #include #include #include "define.h" void cooler(void); /* cooler, adjacent to compression space */ void regen(void); /* regenerator, between cooler and heater */ void heater(void); /* heater, adjacent to expansion space */ void pipes(double *, double *, double *, double *, double *); /* pipes: homogeneous smooth pipes configuration */ void annulus(double *, double *, double *, double *, double *); /* annulus: smooth annulus configuration */ void slots(double *, double *, double *, double *, double *); /* slots configuration */ void heatex() { cooler(); regen(); heater(); } /**************************************************************** * FUNCTION cooler - specifies the cooler geometric parameters * * of the Stirling cycle machine. * * FILENAME: heatex.c * * PROGRAMMER: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 941201/951218 * * LAST MODIFICATION: 01/10/2000 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * FILE *printfile - pointer to the print output file * * vk: cooler void volume (cu.m) * * ak: cooler internal free flow area (sq.m) * * awgk: cooler internal wetted area (sq.m) * * dk: cooler hydraulic diameter (m) * * lk: cooler effective length (m) * * PROTOTYPE: void cooler(void); * * PRE: infile, outfile, printfile * * POST: cooler global variables have been specified * ****************************************************************/ void cooler(void) { char myKol; fprintf(printfile,"\n cooler:\n"); fgetc(infile); /* remove "return" char from input buffer */ do { printf("\n enter cooler configuration\n"); printf(" p, for smooth pipes\n"); printf("a, for smooth annulus\n"); printf(" s, for slots\n"); fflush(stdin); myKol = fgetc(infile); if (myKol == 'p') { fprintf(outfile, "%c\n", myKol); pipes(&vk,&ak,&awgk,&dk,&lk); } else if (myKol == 'a') { fprintf(outfile, "%c\n", myKol); annulus(&vk,&ak,&awgk,&dk,&lk); } else if(myKol=='s') { fprintf(outfile, "%c\n", myKol); slots(&vk,&ak,&awgk,&dk,&lk); } else { printf("cooler config %c undefined\n",myKol); myKol = 'u'; } } while(myKol=='u'); } /**************************************************************** * FUNCTION heater - specifies the heater geometric parameters * * of the Stirling cycle machine. * * FILENAME: heatex.c * * PROGRAMMER: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 941201/951218 * * LAST MODIFICATION: 08/16/96 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * FILE *printfile - pointer to the print output file * * vh: heater void volume (cu.m) * * ah: heater internal free flow area (sq.m) * * awgh: heater internal wetted area (sq.m) * * dh: heater hydraulic diameter (m) * * lh: heater effective length (m) * * PROTOTYPE: void heater(void); * * PRE: infile, outfile, printfile * * POST: heater global variables have been specified * ****************************************************************/ void heater(void) { char myHot; fprintf(printfile,"\n heater:\n"); fgetc(infile); /* remove "return" char from input buffer */ do { printf("\n enter heater configuration\n"); printf("p, for smooth pipes\n"); printf("a, for smooth annulus\n"); printf("s, for slots\n"); fflush(stdin); myHot = fgetc(infile); if (myHot == 'p') { fprintf(outfile, "%c\n", myHot); pipes(&vh,&ah,&awgh,&dh,&lh); } else if (myHot == 'a') { fprintf(outfile, "%c\n", myHot); annulus(&vh,&ah,&awgh,&dh,&lh); } else if(myHot == 's') { fprintf(outfile, "%c\n", myHot); slots(&vh,&ah,&awgh,&dh,&lh); } else { printf("heater config %c undefined\n",myHot); myHot = 'u'; } } while(myHot == 'u'); } /**************************************************************** * FUNCTION pipes - specifies the geometric parameters of * * homogeneous smooth pipes heat exchanger. * * FILENAME: heatex.c * * PROGRAMMER: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 941201/951218 * * LAST MODIFICATION: 08/15/96 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * FILE *printfile - pointer to the print output file * * PROTOTYPE: * * void * * pipes(double *, double *, double *, double *, double *); * * PRE: infile, outfile, printfile * * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * ****************************************************************/ void pipes(double *ptr_v, /* void volume (cu.m) */ double *ptr_a, /* free flow area (sq.m) */ double *ptr_awg, /* wetted area (sq.m) */ double *ptr_d, /* hydraulic diameter (m) */ double *ptr_ell) /* effective length (m) */ { int n; /* n: number of pipes in bundle */ double v; /* Void volume (cu.m) */ double a; /* free flow area (sq.m) */ double awg; /* wetted area (sq.m) */ double d; /* hydraulic diameter (m) */ double ell; /* effective length (m) */ printf(" homogeneous bundle of smooth pipes\n"); printf(" enter inside diam(m), length(m), num. pipes\n"); fscanf(infile, "%lf %lf %d", &d,&ell,&n); fprintf(outfile," %f %f %d\n", d,ell,n); fprintf(printfile, " homogeneous bundle of smooth pipes\n"); fprintf(printfile, " inside diam(m), length(m), num. pipes:\n"); fprintf(printfile, " %f %f %d\n", d,ell,n); /* geometric parameters:*/ a = PI*(float)(n)*d*d/4.0; v = a*ell; awg = (float)(n)*PI*d*ell; printf(" void volume(cc) %10.2f\n", v*1.0e6); fprintf(printfile," void volume(cc) %10.2f\n", v*1.0e6); *ptr_v = v; *ptr_a = a; *ptr_awg = awg; *ptr_d = d; *ptr_ell = ell; } /**************************************************************** * FUNCTION annulus - specifies the geometric parameters of * * annular heat exchanger. * * FILENAME: heatex.c * * PROGRAMMER: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 941201/951218 * * LAST MODIFICATION: 08/15/96 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * FILE *printfile - pointer to the print output file * * PROTOTYPE: * * void * * annulus(double *, double *, double *, double *, double *);* * PRE: infile, outfile, printfile * * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * ****************************************************************/ void annulus(double *ptr_v, /* void volume (cu.m) */ double *ptr_a, /* free flow area (sq.m) */ double *ptr_awg, /* wetted area (sq.m) */ double *ptr_d, /* hydraulic diameter (m) */ double *ptr_ell) /* effective length (m) */ { double dout, di; /* dout,di: outside,inside diameter of annular gap*/ double v; /* void volume (cu.m) */ double a; /* free flow area (sq.m) */ double awg; /* wetted area (sq.m) */ double d; /* hydraulic diameter (m) */ double ell; /* effective length (m) */ printf(" annular gap heat exchanger\n"); printf(" enter outer,inner annular gap diam(m)\n"); fscanf(infile, "%lf%lf", &dout,&di); fprintf(outfile, " %f %f", dout,di); printf(" enter heat exchanger length(m)\n"); fscanf(infile,"%lf", &ell); fprintf(outfile, " %f\n", ell); fprintf(printfile, " annular gap heat exchanger\n"); fprintf(printfile, " outer, inner annular gap diam(m):\n"); fprintf(printfile, " %f %f\n", dout,di); fprintf(printfile, " heat exchanger length(m)\n"); fprintf(printfile," %f\n",ell); /* geometric parameters:*/ a = PI*(dout*dout - di*di)/4.0; v = a*ell; awg = PI*(di + dout)*(ell); d = dout - di; printf(" Void vol(cc) %10.2f\n", v*1.0e6); printf(" Hydraulic diam(mm),%10.2f\n", d*1.0e3); fprintf(printfile," Void vol(cc), %10.2f\n", v*1.0e6); fprintf(printfile," Hydraulic diam(mm), %10.2f\n", d*1.0e3); *ptr_v = v; *ptr_a = a; *ptr_awg = awg; *ptr_d = d; *ptr_ell = ell; } /**************************************************************** * FUNCTION slots - specifies the slots geometric parameters * * FILEMNAME: heatex.c * * PROGRAMMER: Eric Malroy * * DATE: 05-04-96 * * LAST MODIFICATION: 08/16/96 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * File *printfile - pointer to the print output data file * * PROTOTYPE: * * void * * slots(double *, double *, double *, double *, double *); * * PRE: infile, outfile, printfile * * POST: *ptr_v, *ptr_a, *ptr_awg, *ptr_d, *ptr_ell * * *************************************************************/ void slots(double *ptr_v, /* void volume (cu.m) */ double *ptr_a, /* free flow area (sq.m) */ double *ptr_awg, /* wetted area (sq.m) */ double *ptr_d, /* hydraulic diameter (m) */ double *ptr_ell) /* effective length (m) */ { double w; /* width of slot */ double h; /* height of slot (m) */ int n; /* number of slots */ double v; /* void volume (cu.m) */ double a; /* free flow area (sq.m) */ double awg; /* wetted area (sq.m) */ double d; /* hydraulic diameter (m) */ double ell; /* effective length (m) */ printf(" slots heat exchanger\n"); printf(" enter width, height of slot (m)\n"); fscanf(infile,"%lf%lf", &w, &h); fprintf(outfile," %f %f\n", w, h); printf(" enter heat exchanger length (m)\n"); fscanf(infile,"%lf", &ell); fprintf(outfile, "%f\n", ell); printf(" enter number of slots\n"); fscanf(infile,"%d", &n); fprintf(outfile,"%d\n", n); fprintf(printfile," slot heat exchanger\n"); fprintf(printfile," width and height of slot (m):\n"); fprintf(printfile," %f %f\n", w, h); fprintf(printfile," heat exchanger length (m) & number of slots\n"); fprintf(printfile," %f %d\n", ell, n); v = (float)(n)*w*h*ell; a = (float)(n)*w*h; awg = (float)(n)*2.0*(w+h)*ell; d = 4.0*v/awg; printf(" Void volume %10.2f(cc)\n", v*1.0e6); printf(" Hydraulic diam %10.2f(mm)\n", d*1.0e3); fprintf(printfile, " Void volume %10.2f(cc)\n", v*1.0e6); fprintf(printfile, " Hydraulic diameter %10.2f(mm)\n", d*1.0e3); *ptr_v = v; *ptr_a = a; *ptr_awg = awg; *ptr_d = d; *ptr_ell = ell; }