Such as a great information on how work on XFOIL and MATLAB.
i bookmark this page for future reference: thanks
Hi azredwing,
I have Ubuntu, and I installed from ubuntu software center Xfoil 6.97, and Matlab 2011a. I want to use xfoil from matlab and get the results of boundary layer and separation in matlab. I saw your code mxfoil, and I copied all the files that you mentioned. I create finally another file to call mpxfoil with the following data:
[alfa, CL, CD, CDp, CM, Top_Xtr, Bot_Xtr] = mpxfoil('0012', 500000, 0.2,0.2,[], [], [],[])
And I get the following error:
Can't locate IPC/Run.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl .) at xfw.pl line 23.
BEGIN failed--compilation aborted at xfw.pl line 23.
Warning: File '/tmp/tp27f0469a_6a2f_48c5_b4fe_03d67e3a3fff' not
found.
> In mpxfoil at 137
And after that I get all the values for alfa, Cl, ..., NaN, so could you help me with some advice about how to solve this issue, and if you can recommend me how to modify the perl wrapper that you build it, so I can get the momentum thickness, separation point, displacement thickness in matlab.
Thanks a lot in advance,
Hi everyone,
I carrefully read the whole thread. I'm also very interesting in this xfoil/matlab sync for windows. I did all the (neatly explained) adjustement explained in the 8 pages and i eventually get the EXACT same error as you guys:
If any unix jedi could help go through, i'd be glad.Code:Can't locate IPC/Run.pm in @INC (@INC contains: /usr/lib/perl5/5.10/i686-cygwin /usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at xfw.pl line 23. BEGIN failed--compilation aborted at xfw.pl line 23. Warning: File 'C:\Users\Ben\AppData\Local\Temp\tp4e2c1cc2_9088_4019_8db7_c05635ce4c3e' not found. > In mpxfoil at 137 In test at 13
Cheers
Ok i installed correctly IPC and IO:ty in the right path through the bash cygwin.
Now i have this error popping out:
It just does not find xfoil somewhere, but i don't know why does it expect it in those weird paths.Code:XFOIL error: Command 'xfoil' not found in /cygdrive/c/Program Files/MATLAB/R2011a/bin/win64, /cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live, /cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live, /cygdrive/c/Windows/system32, /cygdrive/c/Windows, /cygdrive/c/Windows/System32/Wbem, /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0, /cygdrive/c/Program Files (x86)/Windows Live/Shared, /cygdrive/c/Program Files/Trend Micro/AMSP, /cygdrive/c/Program Files/Intel/WiFi/bin, /cygdrive/c/Program Files/Common Files/Intel/WirelessCommon, /cygdrive/c/Xfoil/bin, /usr/bin at xfw.pl line 81 Warning: File 'C:\Users\Ben\AppData\Local\Temp\tpdef74a6f_d4e0_4d7e_bd19_5f0ab7d9e344' not found.
I used Matlab to control Ansys Fluent through journal scripts. You can execute shell comand inside Matlab by usingwhere xxx is the shell comand you want to execute.Code:unix(xxx)
For example you can tryCode:unix('echo hello world')
I realized that my xfoil was not actually installed..
I'm ashamed.
I started now, it's long because i miss a lot a packages like x11. But i think i'll make it.
Maybe then i can directly control Xfoil through system or dos or unix commands i don't know. I'll tell you
Hi guys -
I'm glad you all are using my work. Unfortunately I don't really have the time to support it anymore, so this is an official "this code is now unsupported" message.. MPXF did the job for me when I was working in fluids, but I've switched my focus to control theory so I almost never use XFoil anymore. Not to mention I've only done rudamentary tests for compatibility with Windows and none with Mac, so I really have no idea how compatibility will go with those.
If anyone wants to maintain this, though, PM me. I'll open up the SourceForge or move the project to GitHub if requested.
Hi azredwing,
Thank you for your work and good luck with those Riccati equations.
I have written a Matlab .m function that runs Xfoil on windows without any perl/unix but only the dos command. It uses xfoil 6.96 windows executable. Here is the function code:
Note that if Xfoil does not converge, I return Cl=Cd=0.Code:function[Cl, Cd]=get_coeff(Re,maxit,alfa) Re=int2str(Re); maxit=int2str(maxit); alfa=int2str(alfa); fopen('coeffs.txt','wt');fclose('all'); fid = fopen('in.txt','wt'); fprintf(fid,'%s','PLOP');fprintf(fid,'\n'); fprintf(fid,'%s','G');fprintf(fid,'\n'); fprintf(fid,'\n'); fprintf(fid,'%s','load NACA0012');fprintf(fid,'\n'); %% load directly my NACA0012 coordinates file. fprintf(fid,'%s','oper');fprintf(fid,'\n'); fprintf(fid,'%s',['visc ' Re]);fprintf(fid,'\n'); fprintf(fid,'%s',['iter ' maxit]);fprintf(fid,'\n'); fprintf(fid,'%s','pacc');fprintf(fid,'\n'); fprintf(fid,'%s','coeffs.txt');fprintf(fid,'\n'); fprintf(fid,'%s','y');fprintf(fid,'\n'); fprintf(fid,'\n'); fprintf(fid,'%s',['alfa ' alfa]);fprintf(fid,'\n'); fprintf(fid,'%s','pacc');fprintf(fid,'\n'); fprintf(fid,'\n'); fprintf(fid,'%s','quit'); fclose(fid); dos('xfoil.exe < in.txt'); fid=fopen('coeffs.txt','r'); B=fscanf(fid,'%e'); if isempty(B) Cl=0; Cd=0; else B=B'; Cl=B(1,2); Cd=B(1,3); end end
That's my current issue. I don't understand why it does not converge when i use matlab whereas used manually it does converge for the same set of Re, alpha, maxit.
I didn't include the Mach number but will soon. You can also add the range of alpha argument if you need.
The in.txt command text file used is such:
It still not very good and it's not ubuntu reliant anymore so just in case some windows people needs it.Code:PLOP G load NACA0012 oper visc 248765 iter 100 pacc coeffs.txt y alfa 24 pacc quit
Cheers
Last edited by jeanvaljean53; March 15th, 2012 at 10:49 AM.
Hi there,
I found the solution of jeanvaljean53 very interesting. I added a minor correction in order to make it work properly (here under linux):
function[Cl, Cd]=get_coeff(Re,maxit,alfa)
Re=int2str(Re);
maxit=int2str(maxit);
alfa=int2str(alfa);
fopen('coeff.txt','wt');
fid = fopen('in.txt','wt');
fprintf(fid,'%s','PLOP');fprintf(fid,'\n');
fprintf(fid,'%s','G');fprintf(fid,'\n');
fprintf(fid,'\n');
fprintf(fid,'%s','NACA0012');fprintf(fid,'\n');
fprintf(fid,'%s','oper');fprintf(fid,'\n');
fprintf(fid,'%s',['visc ' Re]);fprintf(fid,'\n');
fprintf(fid,'%s',['iter ' maxit]);fprintf(fid,'\n');
fprintf(fid,'%s','pacc');fprintf(fid,'\n');
fprintf(fid,'\n');
fprintf(fid,'\n');
fprintf(fid,'%s',['alfa ' alfa]);fprintf(fid,'\n');
fprintf(fid,'%s','pwrt 1');fprintf(fid,'\n');
fprintf(fid,'%s','coeff.txt');fprintf(fid,'\n');
fprintf(fid,'%s','y');fprintf(fid,'\n');
fprintf(fid,'%s','pacc');fprintf(fid,'\n');
fprintf(fid,'\n');
fprintf(fid,'%s','quit');fprintf(fid,'\n');
fclose(fid);
system('xfoil < in.txt');
B=dlmread('coeff.txt','',12,0);
Cl=B(1,2);
Cd=B(1,3);
end
Hope it helps,
regards,
Andreas
Last edited by andross4001; September 27th, 2012 at 08:27 PM.
Bookmarks