clear all close all clc a=aa(1:6)'; b=aa(7:12)'; a=[0.00,0.01,0.00,0.00,0.01,0.00]; b=[0.00,0.00,0.00,0.00,0.00,0.00]; foil=[1.00000 .001260 .987365 .003019 .967647 .005711 .947188 .008436 .926179 .011167 .904775 .013881 .883095 .016562 .861225 .019198 .839225 .021784 .817136 .024314 .794988 .026785 .772800 .029195 .750587 .031542 .728359 .033825 .706124 .036041 .683889 .038188 .661658 .040265 .639437 .042268 .617230 .044194 .595041 .046039 .572875 .047799 .550736 .049470 .528630 .051046 .506562 .052521 .484538 .053889 .462567 .055143 .440656 .056275 .418816 .057276 .397062 .058138 .375412 .058851 .353887 .059404 .332519 .059786 .311348 .059988 .290429 .059997 .269832 .059805 .249649 .059404 .229991 .058790 .210992 .057966 .192796 .056940 .175549 .055730 .159376 .054361 .144366 .052861 .130560 .051263 .117950 .049596 .106485 .047887 .096086 .046154 .086659 .044413 .078106 .042673 .070329 .040940 .063240 .039216 .056760 .037501 .050819 .035794 .045356 .034091 .040318 .032390 .035663 .030684 .031351 .028970 .027354 .027240 .023644 .025489 .020203 .023708 .017015 .021891 .014071 .020026 .011365 .018106 .008901 .016117 .006684 .014050 .004734 .011895 .003076 .009646 .001742 .007302 .000771 .004888 .000194 .002449 .000052 .001235 .000000 .000000 .000194 -.002449 .000749 -.004818 .001693 -.007199 .002990 -.009514 .004605 -.011736 .006505 -.013867 .008666 -.015913 .011070 -.017881 .013708 -.019782 .016578 -.021626 .019683 -.023424 .023033 -.025185 .026640 -.026915 .030524 -.028624 .034706 -.030316 .039217 -.031999 .044089 -.033676 .049364 -.035353 .055089 -.037035 .061321 -.038722 .068124 -.040419 .075570 -.042125 .083744 -.043838 .092734 -.045554 .102635 -.047266 .113541 -.048962 .125533 -.050624 .138673 -.052229 .152984 -.053751 .168448 -.055159 .184998 -.056423 .202526 -.057519 .220902 -.058425 .239983 -.059131 .259636 -.059630 .279742 -.059923 .300204 -.060017 .320945 -.059919 .341905 -.059640 .363037 -.059188 .384308 -.058576 .405692 -.057813 .427168 -.056909 .448722 -.055873 .470341 -.054713 .492016 -.053437 .513738 -.052053 .535502 -.050567 .557301 -.048984 .579130 -.047311 .600985 -.045553 .622860 -.043713 .644752 -.041795 .666657 -.039804 .688570 -.037742 .710487 -.035611 .732402 -.033414 .754308 -.031153 .776199 -.028830 .798064 -.026445 .819888 -.024002 .841651 -.021502 .863324 -.018948 .884867 -.016345 .906218 -.013700 .927295 -.011024 .947982 -.008332 .968128 -.005646 .987549 -.002994 1.00000 -.001260]; x=(0:0.01:1); x1=foil(1:71,1);y1=foil(1:71,2); x2=foil(71:141,1);y2=foil(71:141,2); % figure % plot(x1,y1,x2,y2) z=[0.15 0.3 0.45 0.6 0.75 0.9]; pi=3.1415926; f1=x1.^0.25.*(1-x1).*exp(-20*x1); f2=(sin(pi*x1.^(log(0.5)/log(z(2))))).^3; f3=(sin(pi*x1.^(log(0.5)/log(z(3))))).^3; f4=(sin(pi*x1.^(log(0.5)/log(z(4))))).^3; f5=(sin(pi*x1.^(log(0.5)/log(z(5))))).^3; f6=(sin(pi*x1.^(log(0.5)/log(z(6))))).^3; yup=y1+a(1)*f1+a(2)*f2+a(3)*f3+a(4)*f4+a(5)*f5+a(6)*f6; f1=x2.^0.25.*(1-x2).*exp(-20*x2); f2=(sin(pi*x2.^(log(0.5)/log(z(2))))).^3; f3=(sin(pi*x2.^(log(0.5)/log(z(3))))).^3; f4=(sin(pi*x2.^(log(0.5)/log(z(4))))).^3; f5=(sin(pi*x2.^(log(0.5)/log(z(5))))).^3; f6=(sin(pi*x2.^(log(0.5)/log(z(6))))).^3; ydown=y2+b(1)*f1+b(2)*f2+b(3)*f3+b(4)*f4+b(5)*f5+b(6)*f6; % figure % plot(x1,yup,x2,ydown) %plot(x2,f1,x2,f2,x2,f3,x2,f4,x2,f4,x2,f6) FID=fopen('a.txt','w'); for i=1:71; fprintf(FID, 'vertex create coordinates %d %d 0\n',x1(i),yup(i)); end for i=2:71; fprintf(FID, 'vertex create coordinates %d %d 0\n',x2(i),ydown(i)); end fprintf(FID,'edge create nurbs '); for i=1:61; fprintf(FID, '"vertex.%d"\\ \n',i); end fprintf(FID,'interpolate\n'); fprintf(FID,'edge create nurbs '); for i=61:71; fprintf(FID, '"vertex.%d"\\ \n',i); end fprintf(FID,'interpolate\n'); fprintf(FID,'edge create nurbs '); for i=71:81; fprintf(FID, '"vertex.%d"\\ \n',i); end fprintf(FID,'interpolate\n'); fprintf(FID,'edge create nurbs '); for i=81:141; fprintf(FID, '"vertex.%d"\\ \n',i); end fprintf(FID,'interpolate\n'); fprintf(FID,'edge create radius %d startangle 90 endangle 270 center "vertex.71" xyplane arc \n',5); fprintf(FID,'edge create straight "vertex.1" "vertex.141" \n'); fprintf(FID,'edge create translate "vertex.142" "vertex.143" vector %d 0 0 \n',1); fprintf(FID,'edge create translate "vertex.1" "vertex.141" vector %d 0 0 \n',5); fprintf(FID,'edge create translate "vertex.144" "vertex.145" vector %d 0 0 \n',5); fprintf(FID,'edge create straight "vertex.144" "vertex.1" \n'); fprintf(FID,'edge create straight "vertex.141" "vertex.145" \n'); fprintf(FID,'edge create straight "vertex.146" "vertex.147" \n'); fprintf(FID,'edge create straight "vertex.142" "vertex.61" \n'); fprintf(FID,'edge create straight "vertex.81" "vertex.143" \n'); fprintf(FID,'edge create straight "vertex.146" "vertex.148"\n'); fprintf(FID,'edge create straight "vertex.147" "vertex.149"\n'); fprintf(FID,'face create wireframe "edge.16" "edge.5" "edge.17" "edge.2" "edge.3" real \n'); fprintf(FID,'face create wireframe "edge.17" "edge.4" "edge.14" "edge.8" real \n'); fprintf(FID,'face create wireframe "edge.14" "edge.10" "edge.19" "edge.12" real\n'); fprintf(FID,'face create wireframe "edge.9" "edge.10" "edge.6" "edge.15" real\n'); fprintf(FID,'face create wireframe "edge.16" "edge.7" "edge.13" "edge.1" real\n'); fprintf(FID,'face create wireframe "edge.11" "edge.13" "edge.18" "edge.9" real \n'); fprintf(FID,'edge mesh "edge.16" "edge.13" successive ratio1 0.98039216 intervals 150 \n'); fprintf(FID,'edge mesh "edge.17" "edge.14" "edge.19" "edge.18" successive ratio1 1.02 intervals 150 \n'); fprintf(FID,'edge mesh "edge.9" "edge.10" "edge.11" "edge.12" successive ratio1 1.04 intervals 100 \n'); fprintf(FID,'face mesh "face.5" map size %d\n', 0.002); fprintf(FID,'face mesh "face.2" map size %d\n', 0.002); fprintf(FID,'face mesh "face.3" map size %d\n', 0.01); fprintf(FID,'face mesh "face.6" map size %d\n', 0.01); fprintf(FID,'face mesh "face.4" map size %d\n', 0.01); fprintf(FID,'face mesh "face.1" map size %d\n', 0.25); fprintf(FID,'physics create "outlet" btype "PRESSURE_OUTLET" edge "edge.18" "edge.19" "edge.15"\n'); fprintf(FID,'physics create "far" btype "PRESSURE_FAR_FIELD" edge "edge.11" "edge.7" "edge.8" "edge.12" "edge.5"\n'); fprintf(FID,'physics create "wall1" btype "WALL" edge "edge.1" "edge.2" \n'); fprintf(FID,'physics create "wall2" btype "WALL" edge "edge.4" "edge.3"\n'); fprintf(FID,'physics create "wall3" btype "WALL" edge "edge.6" \n'); fprintf(FID,'physics create "flow" ctype "FLUID" face "face.1" "face.2" "face.3" "face.4" "face.5" "face.6"\n'); fprintf(FID,'export fluent5 "blade2.msh" nozval \n'); fclose(FID); %fluent journel b.txt FID=fopen('b.txt','w'); %-------------------------read model fprintf(FID,'file/read-case blade2.msh \n'); fprintf(FID,'grid/reorder/reorder-domain \n'); %-----------materials fprintf(FID,'define/materials/change-create \n'); fprintf(FID,'air\n'); % material-name> air fprintf(FID,'\n'); % material name [air] fprintf(FID,'y\n'); % change Density? [no] y fprintf(FID,'ideal-gas\n'); % new method [constant] ideal-gas fprintf(FID,'n \n'); % change Cp (Specific Heat)? [no] fprintf(FID,'n\n'); % change Thermal Conductivity? [no] fprintf(FID,'n\n'); % change Viscosity? [no] fprintf(FID,'n\n'); % change Molecular Weight? [no] fprintf(FID,'n\n'); % change L-J Characteristic Length? [no] fprintf(FID,'n\n'); % change L-J Energy Parameter? [no] fprintf(FID,'n\n'); % change Thermal Expansion Coefficient? [no] fprintf(FID,'n\n'); % change Degrees of Freedom? [no] fprintf(FID,'n\n'); % change Speed of Sound? [no] fprintf(FID,'define/models/viscous \n'); fprintf(FID,'spalart-allmaras \n'); fprintf(FID,'y \n'); % Enable Spalart-Allmaras turbulence model? [no] y fprintf(FID,'q \n'); %------------------inlet condition fprintf(FID,'define/boundary-conditions \n'); fprintf(FID,' pressure-far-field \n'); fprintf(FID,'far \n'); % zone id/name [far] fprintf(FID,'n \n'); % Use Profile for Gauge Pressure? [no] fprintf(FID,'101325 \n'); % Gauge Pressure (pascal) [0] 101325 fprintf(FID,'n \n'); % Use Profile for Mach Number? [no] fprintf(FID,'0.63 \n'); % Mach Number [0.6] 0.63 fprintf(FID,'n \n'); % Use Profile for Temperature? [no] fprintf(FID,'300 \n'); % Temperature (k) [300] fprintf(FID,'n \n'); % Use Profile for X-Component of Flow Direction? [no] fprintf(FID,'1 \n'); % X-Component of Flow Direction [1] fprintf(FID,'n \n'); % Use Profile for Y-Component of Flow Direction? [no] fprintf(FID,'0 \n'); % Y-Component of Flow Direction [0] fprintf(FID,'y \n'); % Turbulent Specification Method: Modified Turbulent Viscosity [yes] fprintf(FID,'n \n'); % Use Profile for Modified Turbulent Viscosity? [no] fprintf(FID,'0.001 \n'); % Modified Turbulent Viscosity (m2/s) [0.001] fprintf(FID,'q \n'); %---------------outlet condition fprintf(FID,'define/boundary-conditions \n'); fprintf(FID,'pressure-outlet \n'); fprintf(FID,'outlet \n'); % zone id/name [outlet] outlet fprintf(FID,'n \n'); % Use Profile for Gauge Pressure? [no] fprintf(FID,'101325 \n'); % Gauge Pressure (pascal) [0] 101325 fprintf(FID,'n \n'); % Use Profile for Backflow Total Temperature? [no] fprintf(FID,'300 \n'); % Backflow Total Temperature (k) [300] fprintf(FID,'n \n'); % Backflow Direction Specification Method: Direction Vector [no] fprintf(FID,'y \n'); % Backflow Direction Specification Method: Normal to Boundary [yes] fprintf(FID,'y \n'); % Turbulent Specification Method: Modified Turbulent Viscosity [yes] fprintf(FID,'n \n'); % Use Profile for Backflow Modified Turbulent Viscosity? [no] fprintf(FID,'0.001 \n'); % Backflow Modified Turbulent Viscosity (m2/s) [0.001] fprintf(FID,'n \n'); % Specify targeted mass flow rate [no] fprintf(FID,'q \n'); %%%-----------------operating-condition fprintf(FID,'define/operating-conditions \n'); fprintf(FID,'operating-pressure \n'); fprintf(FID,'0 \n'); %operating pressure (pascal) [101325] 0 fprintf(FID,'q \n'); fprintf(FID,'solve/initialize/compute-defaults\n'); fprintf(FID,'pressure-far-field \n'); fprintf(FID,'far \n'); fprintf(FID,'q \n'); fprintf(FID,'solve/initialize \n'); fprintf(FID,'initialize-flow \n'); fprintf(FID,'q \n'); fprintf(FID,'solve/monitors/residual/convergence-criteria \n'); fprintf(FID,'0.00001 \n'); %continuity residual convergence criterion [0.001] 0.00001 fprintf(FID,'0.001 \n'); %x-velocity residual convergence criterion [0.001] 0.001 fprintf(FID,'0.001 \n'); %y-velocity residual convergence criterion [0.001] 0.001 fprintf(FID,'1e-6 \n'); %energy residual convergence criterion [1e-06] 1e-6 fprintf(FID,'1e-3 \n'); %nut residual convergence criterion [0.001] 0.001 fprintf(FID,'q \n'); fprintf(FID,'report/reference-values \n'); fprintf(FID,'pressure \n'); fprintf(FID,'101325 \n'); fprintf(FID,'velocity \n'); fprintf(FID,'218 \n'); fprintf(FID,'q \n'); fprintf(FID,'solve \n'); fprintf(FID,'iterate %i \n', 10000); fprintf(FID,'q \n'); fclose(FID); status = system('del blade*.*'); status = system('C:\Fluent.Inc\ntbin\ntx86\gambit.exe -r2.4.6 -id blade2.dbs -inp a.txt'); status = system('C:\Fluent.Inc\ntbin\win64\fluent.exe 2ddp -t4-i b.txt');