/**************************************************************** * FUNCTION hotsim.c - evaluates the heater performance * * FILENAME: hotsim.c * * PROGRAMMERS: Izzi Urieli (FORTRAN) * * Eric Malroy (translation to "C") * * DATE: 120194/080996 * * LAST MODIFICATION: 08/23/96 Eric Malroy * * INCLUDE: ,,"define.h","adiabatic.h" * * "simple.h" * * GLOBAL VARIABLES: * * omega - frequency (rad/sec) * * ah - heater internal free flow area * * th - hot sink operation temperature (K) * * dh - heater hydraulic diameter (m) * * PROTOTYPE: * * void hotsim(double [][], double, double *) * * PRE: omega, ah, th, dh * * POST: *tgh * ****************************************************************/ #include #include #include "define.h" #include "adiabatic.h" #include "simple.h" void hotsim(double var[][COL], /* variable matrix */ double twh, /* heater wall temp (K) */ double *pt_tgh) /* heater average gas temp. */ { /**** variables ****/ double gah[COL]; /* mass flow through heater (kg/s) */ double gh; /* mass flux through heater (kg/(m**2*s) */ double re[COL]; /* Reynolds number */ double sum_re; double re_avg; /* average Reynolds number over the cycle */ double re_max; /* max Reynolds number over the cycle */ double ht; /* heat transfer coefficient (W/(m**2*K)) */ double fr; /* Reynolds friction factor */ double mu; /* dynamic viscosity (kg/(m*s)) */ double kgas; /* gas thermal conductivity (W/(m**2*K)) */ double tgh; /* heater average gas temperature */ int i; /* index for "for" loop */ /**** Reynolds number over the cycle ****/ for(i=0;i<37;i++) { gah[i] = (var[GARH][i] + var[GAHE][i])*omega/2.0; gh = gah[i]/ah; reynum(th,gh,dh,&mu,&kgas,&re[i]); } /**** average and maximum Reynolds number ****/ sum_re = 0; re_max = re[0]; for(i=0;i<36;i++) { sum_re = sum_re + re[i]; if(re[i] > re_max) re_max = re[i]; } re_avg = sum_re/36.0; /**** heat transfer coefficient (W/(m**2*K)) & heater gas temp tgh(K) ****/ pipfr(dh,mu,re_avg,&ht,&fr); tgh = twh - var[QH][36]*freq/(ht*awgh); *pt_tgh = tgh; printf("\n heater Simple analysis:"); printf("\n average Reynolds number, %.3f", re_avg); printf("\n maximum Reynolds number, %.3f", re_max); printf("\n heat transfer coefficient (W/(m^2*k)), %.3f", ht); printf("\n Wall temp (K), %.2f", twh); printf("Gas temp (K), %.2f\n", tgh); fprintf(printfile,"\n heater Simple analysis:"); fprintf(printfile,"\n average Reynolds number, %.3f", re_avg); fprintf(printfile,"\n maximum Reynolds number, %.3f", re_max); fprintf(printfile,"\n heat transfer coefficient (W/(m^2*k)), %.3f", ht); fprintf(printfile,"\nWall temp (K), %.2f", twh); fprintf(printfile,"Gas temp (K), %.2f\n", tgh); }