# awk script # # the begin command is executed BEFORE anything else is done BEGIN {FS=" "; "date" | getline date; print date } # {N=N+1} {if(N==1) {printf "Input file [ %12s ]\n",FILENAME ; print "#----------------------Input---------------------#"}} {if($1=="Tflow") {tinlet=$2;print$0}} {if($1=="Pflow") {pinlet=$2;print$0}} {if($1=="Turb") {turb=$2;print$0}} {if($1=="Length") {lgth=$2;print$0}} {if($1=="Velocity") {velo=$2;print$0}} {if($1=="Rgas") {rgas=$2;print$0}} {if($1=="kgas") {kgas=$2;print$0}} {if($1=="Cpgas") {cpgas=$2*1000.;print$0}} {if($1=="mugas") {mugas=$2;print$0}} # END { # input dimension are mm's {gasdens=pinlet/rgas/(tinlet+273.15)} {prndlt=cpgas*mugas/kgas} {prndltscr=prndlt^.33} # (note: Length is input in mm's) {renl=gasdens*velo*(lgth/1000.)/mugas} {scratch1=sqrt(132500.*turb^2)-1} {scratch2=39.2*turb^2} {recrit=500000.} {if(turb>0.000) {recrit=(scratch1/scratch2)^2}} {A=.037*recrit^.8-.664*sqrt(recrit)} {havg=(.037*(renl^.8)-A)*(prndlt^.333)*kgas*1000./lgth} {xcrit=1000.*recrit*mugas/gasdens/velo} {if(xcrit>lgth) {havg=.664*sqrt(renl)*(prndlt^.333)*kgas*1000./lgth}} # h's include the leading edge effect: {scratch1=gasdens*velo/1000./mugas} {lamscratch=.332*(prndlt^.333)*kgas} {turbscratch=.0296*(prndlt^.333)*kgas} {x[1]=lgth/20.;renx[1]=scratch1*x[1]} # x[jk] is array of distance {for(jk=2;jk<=20;jk++) {x[jk]=x[jk-1]+lgth/20.;renx[jk]=scratch1*x[jk]}} # {for(jk=1;jk<=20;jk++) {hlam[jk]=lamscratch*sqrt(renx[jk])*1000./x[jk]}} {for(jk=1;jk<=20;jk++) {hturb[jk]=turbscratch*(renx[jk]^.8)*1000./x[jk]}} {for(jk=1;jk<=20;jk++) {h[jk]=hturb[jk]; if(renx[jk]hmax) {hmax=h[jk]}}} {for(jk=1;jk<=20;jk++) {hratio[jk]=int(20*h[jk]/hmax)}} {for(jk=1;jk<=20;jk++) {km=0;scratch=""; while(km<=hratio[jk]) {scratch=scratch "#";km=km+1}; hstars[jk]=scratch}} # {print "#----------------------Output--------------------#"} {printf("%-12s %12.3f\n","Gas Density", gasdens)} {printf("%-12s %12.3f\n","Prandlt No.",prndlt)} {printf("%-12s %12.0f\n","Reyn(L)",renl)} {printf("%-12s %12.1f\n","Re(crit)",recrit)} {printf("%-12s %12.1f\n","Xcrit(mm)",xcrit)} {printf("%-12s %12.1f\n","Avg. h",havg)} # {print" "} {print"tlbt(mm) is the thermal boundary layer thickness in mm's"} {print"Turbulent BL thickness > laminar BL thickness, however"} {print"HTC(turbulent) is still >> HTC(laminar)"} {print" "} {printf("%8s %10s %8s %8s %8s %8s \n","X(mm)","Ren(x)","tblt(mm)","Hlam","Hturb","H(x)")} {for(jk=1;jk<=20;jk++) {printf("%8.2f %10.0f %8.2f %8.0f %8.0f %8.0f %s\n", x[jk],renx[jk],tblt[jk],hlam[jk],hturb[jk],h[jk],hstars[jk])}} {print "#.......................End of File..............#"} }