/**************************************************************** * FUNCTION gas - specifies the working gas properties * * FILENAME: gas.c * * PROGRAMMER: izzi urieli * * DATE: 95/12/02 * * LAST MODIFICATION: 96/08/16 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 * * double rgas - gas constant (Joules/kg.K) * * double cp - specific heat at const pressure (J/kg.K) * * double cv - specific heat at const volume (J/kg.K) * * double gama - ratio (cp / cv) * * double mu0 - dynamic viscosity at ref temp t0 (kg.m/s) * * double t0 - reference temperature (273 K) * * double t_suth - Sutherland constant for dynamic viscosity * * double prandtl - Prandtl number (0.71) * * PROTOTYPE: void gas(void); * * PRE: global variables infile, outfile and printfile have * * been specified * * POST: global variables rgas, cp, cv, gama, mu0, t0, t_suth, * * and Prandtl have been specified * ****************************************************************/ #include #include #include "define.h" void gas() { char mygas[3]; fgetc(infile); /* remove "return" char from input buffer */ do { printf("enter gas type: h2 (hydrogen), he (helium),ai (air): "); fflush(stdin); fgets(mygas, 3, infile); if (strcmp(mygas, "h2") == 0) { fprintf(outfile, "\n%s\n", mygas); printf(" gastype is hydrogen\n"); fprintf(printfile, "\n gastype is hydrogen\n"); gama = 1.4; rgas = 4157.2; mu0 = 8.35e-6; t_suth = 84.4; } else if (strcmp(mygas, "he") == 0) { fprintf(outfile, "\n%s\n", mygas); printf("\n gastype is helium\n"); fprintf(printfile, " gastype is helium\n"); gama = 1.67; rgas = 2078.6; mu0 = 18.85e-6; t_suth = 80.0; } else if (strcmp(mygas, "ai") == 0) { fprintf(outfile, "\n%s\n", mygas); printf(" gastype is air\n"); fprintf(printfile, "\n gastype is air\n"); gama = 1.4; rgas = 287.0; mu0 = 17.08e-6; t_suth = 112.0; } else { printf(" gastype %s is undefined\n", mygas); strcpy(mygas, "un"); } } while (strcmp(mygas, "un") == 0); cv = rgas / (gama - 1.0); cp = gama * cv; t0 = 273.0; prandtl = 0.71; }