# awk script # impingement HTC's per Metzger, etc, with some simplifications # D.Leo, written Nov.11.2007 # # the begin command is executed BEFORE anything else is done BEGIN {FS=" "; "date" | getline date; print date } # # Read Data from the input file # based on the first entry ($1) of each input line, set variable = second entry on the line ($2). # then print the entire line ($0) for verification. {N=N+1} {if(N==1) {printf "Input file [ %12s ]\n",FILENAME ; print "#----------------------Input---------------------#"}} {if($1=="mdot") {mdot=$2;print$0}} {if($1=="Diameter") {D=$2;print$0}} {if($1=="Cd") {Cd=$2;print$0}} {if($1=="k(fluid)") {k=$2;print$0}} {if($1=="mu(fluid)") {mu=$2;print$0}} {if($1=="density") {dens=$2;print$0}} {if($1=="Pr(fluid)") {Pr=$2;print$0}} {if($1=="X/D") {XoverD=$2;print$0}} {if($1=="Y/D") {YoverD=$2;print$0}} {if($1=="Z/D") {ZoverD=$2;print$0}} {if($1=="NumbR") {NumbR=$2;print$0}} # # # Start the calculations ..... END { {Dm=D/1000.} {Rejet=4.*mdot/3.14159/Dm/mu} {Vjet=Rejet*mu/dens/Dm} {term1=XoverD^(-.554)} {term2=YoverD^(-.423)} {term3=ZoverD^(.068)} {term4=Rejet^(.727)} {term5=Pr^(.333)} {Nu1=.363*term1*term2*term3*term4*term5} # {for(row=1;row<=NumbR;row++) {GcGj[row]=.7854*(row-1)/ZoverD/(YoverD-1);Nu[row]=Nu1*(1.-GcGj[row]^.66);Himp[row]=Nu[row]*k/Dm}} # # Start printing the output .... # {print "#----------------------Output--------------------#"} {printf("%-12s %12.1f\n","Re(jet)", Rejet)} {printf("%-12s %12.1f\n","Vel(jet)", Vjet)} # {print "Row Gc/Gj Nu H(imp)"} # {for(row=1;row<=NumbR;row++) {printf("%-6.0f %-8.3f %-10.1f %-10.1f\n",row,GcGj[row],Nu[row],Himp[row])}} # # {print "#.......................End of File..............#"} }