Page 8 of 8 FirstFirst ... 678
Results 71 to 80 of 80

Thread: XFOIL with MATLAB

  1. #71
    Join Date
    Apr 2008
    Beans
    135

    Re: XFOIL with MATLAB

    Quote Originally Posted by bmuyl View Post
    azredwing,
    I have now xfw.pl found by mpxfoil.m
    and I have added xfoil path to matlab so that xfw.pl finds it.
    That is working as mpxfoil opens an xfoil window ( would be great to avoid that, by the way..)

    But I get the following message:

    >> mpxfoil('6312', 3000000, 0, 500, 0)
    XFOIL error: process ended prematurely at xfw.pl line 98

    Warning: File '/tmp/tpdf8119d4_c602_49f1_8ba4_10b757937def' not found.
    > In mpxfoil at 147

    ans =

    NaN


    Line 98, is the following one:

    $h->pump;




    Any clue ?
    Thanks

    Benjamin

    Whoa - I never saw this post. Sorry I didn't help out sooner! I feel bad.

    Looks like you're trying to use an alfa_start of 500 deg?? I can't blame XFOIL for crashing out (which it looks like happened).

  2. #72
    Join Date
    Jun 2011
    Beans
    1

    Re: XFOIL with MATLAB

    Such as a great information on how work on XFOIL and MATLAB.

    i bookmark this page for future reference: thanks

  3. #73
    Join Date
    Jan 2012
    Beans
    1

    Re: XFOIL with MATLAB

    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,

  4. #74
    Join Date
    Mar 2012
    Beans
    4

    Re: XFOIL with MATLAB

    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:

    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
    If any unix jedi could help go through, i'd be glad.
    Cheers

  5. #75
    Join Date
    Mar 2012
    Beans
    4

    Re: XFOIL with MATLAB

    Ok i installed correctly IPC and IO:ty in the right path through the bash cygwin.
    Now i have this error popping out:
    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.
    It just does not find xfoil somewhere, but i don't know why does it expect it in those weird paths.

  6. #76
    Join Date
    Feb 2012
    Beans
    27

    Re: XFOIL with MATLAB

    I used Matlab to control Ansys Fluent through journal scripts. You can execute shell comand inside Matlab by using
    Code:
    unix(xxx)
    where xxx is the shell comand you want to execute.
    For example you can try
    Code:
    unix('echo hello world')

  7. #77
    Join Date
    Mar 2012
    Beans
    4

    Re: XFOIL with MATLAB

    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

  8. #78
    Join Date
    Apr 2008
    Beans
    135

    Re: XFOIL with MATLAB

    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.

  9. #79
    Join Date
    Mar 2012
    Beans
    4

    Re: XFOIL with MATLAB

    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:
    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
    Note that if Xfoil does not converge, I return Cl=Cd=0.
    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:
    Code:
    PLOP
    G
    
    load NACA0012
    oper
    visc 248765
    iter 100
    pacc
    coeffs.txt
    y
    
    alfa 24
    pacc
    
    quit
    It still not very good and it's not ubuntu reliant anymore so just in case some windows people needs it.
    Cheers
    Last edited by jeanvaljean53; March 15th, 2012 at 10:49 AM.

  10. #80
    Join Date
    Sep 2012
    Beans
    1

    Re: XFOIL with MATLAB

    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.

Page 8 of 8 FirstFirst ... 678

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •