Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

Wind turbine-analysis.com logo


A website for discussions on wind turbine basic theory, mathematical analysis, wind tunnel testing, and test model building with emphasize on Darrieus rotor.

Home Intro Analyse Testing Building About

Analyse : Multiple streamtube model, [pg2], [code] | single streamtube | Glauert empirical formula | about Naca airfoils data | finite aspect ratio on airfoil, [code] | dimensionless analysis on Darrieus rotor efficiency

Function to interpolate airfoil data: Code, sample run, & output

Matlab code file “builddatatable.m”

%Function to convert airfoil lift and drag coefficients
%>to tangential and normal coefficients
%>then the function interpolate linearly the Ctang and Cnorm data
%>in between angle of attack and in between Reynolds number
%
%INPUT
%Re       = vector of airfoil data Reynolds number; 
%filelist = vector of airfoil data filename character strings;
%
%OUTPUT
%uniformCtang = tangential coefficient data in table form
%>with 0.1 degree angle of attack increment between column
%>and 10e3 Reynolds number increment between row
%>!large output so suppress screen output with semicolon ';'
%uniformCnorm = normal coefficient data

function [uniformCtang, uniformCnorm] = builddatatable(Re, filelist);

alpha_INCREMENT    = 0.1;
reynolds_INCREMENT = 10e3;

for i = 1:1:length(filelist(:,1))
   %Load each set of lift and drag data
   tabAlphaClCd = load(filelist(i,:));
   
   %Convert each set to tangent and normal data
   PRINT_data_filename = filelist(i,:) %Redundant print screen info
   tabAlphaCtangCnorm = convert2CtangCnorm(tabAlphaClCd) %print screen!
   
   %Interpolate each set of tangent and normal data to uniform alpha
   uniformAlpha = [0 : alpha_INCREMENT : tabAlphaCtangCnorm(end,1)]';
   CtangCnorm = interp1(tabAlphaCtangCnorm(:,1),...
      tabAlphaCtangCnorm(:,2:3), uniformAlpha, 'linear');
   
   %Separate vectors of tangent and normal data into rows in diff tab
   Ctang(i,:) = CtangCnorm(:,1)';
   Cnorm(i,:) = CtangCnorm(:,2)';
end

%Interpolate tangent and normal data TABLE to uniform Reynolds number
uniformRe = [0 : reynolds_INCREMENT : Re(end)];
uniformCtang = interp1(Re, Ctang, uniformRe, 'linear');
uniformCnorm = interp1(Re, Cnorm, uniformRe, 'linear');

%---------------------------------------------------------------------
function tabAlphaCtangCnorm = convert2CtangCnorm(tabAlphaClCd)

alpha = tabAlphaClCd(:,1);
Cl    = tabAlphaClCd(:,2);
Cd    = tabAlphaClCd(:,3);

Cnorm = -Cl.*cos(alpha/180*pi) - Cd.*sin(alpha/180*pi);
Ctang =  Cl.*sin(alpha/180*pi) - Cd.*cos(alpha/180*pi);

tabAlphaCtangCnorm = [alpha Ctang Cnorm];
%%STUB figure; plot(alpha, Ctang); hold on; plot(alpha, Cnorm);

A sample run of “builddatatable.m” in Matlab

» re = [0 1200e3]'

re =

           0
     1200000

» fl = ['A10.NACA12Re0300.data'; 'A10.NACA12Re0300.data']

fl =

A10.NACA12Re0300.data
A10.NACA12Re0300.data

» [ct, cn] = builddatatable(re, fl); %suppress the long screen output!

PRINT_data_filename =

A10.NACA12Re0300.data


tabAlphaCtangCnorm =

         0   -0.0085         0
    2.3644   -0.0024   -0.2001
    5.9115    0.0308   -0.4993
    8.9029    0.0826   -0.7656
   12.4617    0.1148   -0.8516
   12.5648    0.0731   -0.8628
   13.0000    0.0729   -0.8511
   14.0000    0.0722   -0.8290
   15.0000    0.0716   -0.8125
   16.0000    0.0709   -0.8004
   17.0000    0.0702   -0.7920
   18.0000    0.0694   -0.7866
   19.0000    0.0686   -0.7837
   20.0000    0.0678   -0.7830
   21.0000    0.0669   -0.7841
   22.0000    0.0660   -0.7867
   23.0000    0.0650   -0.7907
   24.0000    0.0640   -0.7957
   25.0000    0.0630   -0.8018
   26.0000    0.0620   -0.8087
   27.0000    0.0609   -0.8164
   28.0000    0.0598   -0.8247
   29.0000    0.0587   -0.8335
   30.0000    0.0576   -0.8428
   31.0000    0.0564   -0.8525
   32.0000    0.0552   -0.8626
   33.0000    0.0540   -0.8729
   34.0000    0.0527   -0.8835
   35.0000    0.0515   -0.8943
   36.0000    0.0502   -0.9053
   37.0000    0.0489   -0.9165
   38.0000    0.0477   -0.9277
   39.0000    0.0463   -0.9390
   40.0000    0.0450   -0.9504
   41.0000    0.0437   -0.9618
   42.0000    0.0424   -0.9732
   43.0000    0.0410   -0.9845
   44.0000    0.0397   -0.9959
   45.0000    0.0384   -1.0072
   46.0000    0.0370   -1.0184
   47.0000    0.0357   -1.0295
   48.0000    0.0344   -1.0406
   49.0000    0.0330   -1.0515
   50.0000    0.0317   -1.0623
   51.0000    0.0304   -1.0730
   52.0000    0.0291   -1.0835
   53.0000    0.0278   -1.0939
   54.0000    0.0265   -1.1040
   55.0000    0.0252   -1.1140
   56.0000    0.0240   -1.1238
   57.0000    0.0228   -1.1334
   58.0000    0.0215   -1.1428
   59.0000    0.0204   -1.1520
   60.0000    0.0192   -1.1609
   61.0000    0.0180   -1.1697
   62.0000    0.0169   -1.1781
   63.0000    0.0158   -1.1863
   64.0000    0.0147   -1.1943
   65.0000    0.0137   -1.2019
   66.0000    0.0127   -1.2093
   67.0000    0.0117   -1.2165
   68.0000    0.0108   -1.2233
   69.0000    0.0099   -1.2298
   70.0000    0.0090   -1.2361
   71.0000    0.0081   -1.2420
   72.0000    0.0073   -1.2476
   73.0000    0.0066   -1.2530
   74.0000    0.0058   -1.2579
   75.0000    0.0051   -1.2626
   76.0000    0.0045   -1.2669
   77.0000    0.0039   -1.2709
   78.0000    0.0033   -1.2746
   79.0000    0.0028   -1.2779
   80.0000    0.0023   -1.2808
   81.0000    0.0019   -1.2834
   82.0000    0.0015   -1.2856
   83.0000    0.0011   -1.2875
   84.0000    0.0008   -1.2890
   85.0000    0.0006   -1.2901
   86.0000    0.0004   -1.2908
   87.0000    0.0002   -1.2912
   88.0000    0.0001   -1.2912
   89.0000    0.0000   -1.2908
   90.0000    0.0000   -1.2900


PRINT_data_filename =

A10.NACA12Re0300.data


tabAlphaCtangCnorm =

         0   -0.0085         0
    2.3644   -0.0024   -0.2001
    5.9115    0.0308   -0.4993
    8.9029    0.0826   -0.7656
   12.4617    0.1148   -0.8516
   12.5648    0.0731   -0.8628
   13.0000    0.0729   -0.8511
   14.0000    0.0722   -0.8290
   15.0000    0.0716   -0.8125
   16.0000    0.0709   -0.8004
   17.0000    0.0702   -0.7920
   18.0000    0.0694   -0.7866
   19.0000    0.0686   -0.7837
   20.0000    0.0678   -0.7830
   21.0000    0.0669   -0.7841
   22.0000    0.0660   -0.7867
   23.0000    0.0650   -0.7907
   24.0000    0.0640   -0.7957
   25.0000    0.0630   -0.8018
   26.0000    0.0620   -0.8087
   27.0000    0.0609   -0.8164
   28.0000    0.0598   -0.8247
   29.0000    0.0587   -0.8335
   30.0000    0.0576   -0.8428
   31.0000    0.0564   -0.8525
   32.0000    0.0552   -0.8626
   33.0000    0.0540   -0.8729
   34.0000    0.0527   -0.8835
   35.0000    0.0515   -0.8943
   36.0000    0.0502   -0.9053
   37.0000    0.0489   -0.9165
   38.0000    0.0477   -0.9277
   39.0000    0.0463   -0.9390
   40.0000    0.0450   -0.9504
   41.0000    0.0437   -0.9618
   42.0000    0.0424   -0.9732
   43.0000    0.0410   -0.9845
   44.0000    0.0397   -0.9959
   45.0000    0.0384   -1.0072
   46.0000    0.0370   -1.0184
   47.0000    0.0357   -1.0295
   48.0000    0.0344   -1.0406
   49.0000    0.0330   -1.0515
   50.0000    0.0317   -1.0623
   51.0000    0.0304   -1.0730
   52.0000    0.0291   -1.0835
   53.0000    0.0278   -1.0939
   54.0000    0.0265   -1.1040
   55.0000    0.0252   -1.1140
   56.0000    0.0240   -1.1238
   57.0000    0.0228   -1.1334
   58.0000    0.0215   -1.1428
   59.0000    0.0204   -1.1520
   60.0000    0.0192   -1.1609
   61.0000    0.0180   -1.1697
   62.0000    0.0169   -1.1781
   63.0000    0.0158   -1.1863
   64.0000    0.0147   -1.1943
   65.0000    0.0137   -1.2019
   66.0000    0.0127   -1.2093
   67.0000    0.0117   -1.2165
   68.0000    0.0108   -1.2233
   69.0000    0.0099   -1.2298
   70.0000    0.0090   -1.2361
   71.0000    0.0081   -1.2420
   72.0000    0.0073   -1.2476
   73.0000    0.0066   -1.2530
   74.0000    0.0058   -1.2579
   75.0000    0.0051   -1.2626
   76.0000    0.0045   -1.2669
   77.0000    0.0039   -1.2709
   78.0000    0.0033   -1.2746
   79.0000    0.0028   -1.2779
   80.0000    0.0023   -1.2808
   81.0000    0.0019   -1.2834
   82.0000    0.0015   -1.2856
   83.0000    0.0011   -1.2875
   84.0000    0.0008   -1.2890
   85.0000    0.0006   -1.2901
   86.0000    0.0004   -1.2908
   87.0000    0.0002   -1.2912
   88.0000    0.0001   -1.2912
   89.0000    0.0000   -1.2908
   90.0000    0.0000   -1.2900

» save('Ctang.A10.NACA12.table', 'ct', '-ascii');
» save('Cnorm.A10.NACA12.table', 'cn', '-ascii');
» plot([0:0.1:90]', ct(1,:)')
» plot([0:0.1:90]', cn(1,:)')
» 

Plotted graph of the interpolated airfoil data at certain Re number


Home About

Last updated at November 6, 2002
Comments are welcomed