📄 pablo.m
字号:
end; elseif get(libHndl,'value') == 1 select = get(currentA,'String'); select = select(1,11:size(select,2)); if ~strcmp(select,'no selection') z = library(nbp/2,select); plot (z(:,1),z(:,2),'k'); grid; axis equal; hold off; title([select],'Fontsize',[14],'Color','k'); else cla; title('No Airfoil Selected !!', ... 'Fontsize',[14],'Color','k'); end; else axratio = get(ellipseratio,'UserData'); z = ellipse(axratio,nbp/2); plot (z(:,1),z(:,2),'k'); grid; axis equal; hold off; title(['Ellipse (Axis Ratio = ',num2str(axratio),')'], ... 'Fontsize',[14],'Color','k'); end; watchoff(figNumber);elseif strcmp(action,'cp'), global firstcp; firstcp = firstcp + 1; back = [0.34 0.67 0.6]; fore = [0.3 0.3 0.3]; figNumber=watchon; hndlList=get(gcf,'UserData'); btnPos=[.04 0.11 .95 .11]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor',[0. 0. 0.], ... 'FontUnits','normalized', ... 'Fontsize',[.5], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',''); btnPos=[.8 0.21 .198 .06]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor',[0. 0. 0.], ... 'FontUnits','normalized', ... 'Fontsize',[.5], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',''); nbpanelsHndl = hndlList(1); alfaHndl = hndlList(2); nacaHndl = hndlList(3); libHndl = hndlList(4); naca1Hndl = hndlList(5); naca2Hndl = hndlList(6); naca34Hndl = hndlList(7); sHndl = hndlList(9); dHndl = hndlList(10); currentA = hndlList(16); ellipseratio = hndlList(18); holdonHndl = hndlList(19); viscousHndl = hndlList(20); reynoldsHndl = hndlList(21); plotblHndl = hndlList(22); nbp=get(nbpanelsHndl,'UserData'); alfa = get(alfaHndl,'UserData'); airfoilselected = 1; if firstcp==1 set(holdonHndl,'value',0); end; hold off; holdon=0; if get(holdonHndl,'value') == 1 hold on; holdon = 1; grid; end; if get(nacaHndl,'value') == 1 eps = get(naca1Hndl,'UserData'); p = get(naca2Hndl,'UserData'); to = get(naca34Hndl,'UserData'); z = naca4([eps;p;to],[nbp/2,1]); elseif get(libHndl,'value') == 1 select = get(currentA,'String'); select = select(1,11:size(select,2)); if ~strcmp(select,'no selection') z = library(nbp/2,select); else airfoilselected = 0; cla; title('No Airfoil Selected !!', ... 'Fontsize',[14],'Color','k'); end; else axratio = get(ellipseratio,'UserData'); z = ellipse(axratio,nbp/2); end; if airfoilselected ==1 if get(sHndl,'value') == 1 clcm = source(z,holdon); elseif get(dHndl,'value') == 1 clcm = doublet(z,alfa,holdon); else clcm = vortex(z,alfa,holdon); end; cl = clcm(1); cm = clcm(2); ue = clcm(3:nbp+3); xcp =clcm(nbp+4); cpmin = clcm(nbp+5); cpmax = clcm(nbp+6); title('Pressure Coefficient','Fontsize',[14], ... 'Color','k'); grid; hold off; if get(viscousHndl,'value') == 1 plotbl = 0; if get(plotblHndl,'value') == 1, plotbl = 1; end; % Research of the stagnation point isp = stagnation_point(ue); ue(isp) = 0; % Boundary layer discretization nup = isp; nlo = nbp+2-isp; chordL = 1; zup = z(isp:-1:1,:)/chordL; % Normalized length zlo = z(isp:nbp+1,:)/chordL; Vzero = 1; ueup = -ue(isp:-1:1)/Vzero; % Normalized velocity uelo = ue(isp:nbp+1)/Vzero; % Computing the boundary layer's theta and H ReL = get(reynoldsHndl,'UserData'); resup = solvebl(ReL,zup,nup,ueup,plotbl,1); figure(figNumber); if resup(4)==0 textStr = ['Upper side : Fully Laminar']; elseif resup(4)==1 textStr = ['Upper side : Transition at ',num2str(resup(5)),' %']; xt = resup(5)/100; yt = findy(z,xt,1)*(cpmax-cpmin); h = text(xt,-yt,'T','FontSize',[14],'HorizontalAlignment','center'); elseif resup(4) ==2 textStr = ['Upper side : Laminar Separation at ',num2str(resup(5)),' %']; xt = resup(5)/100; yt = findy(z,xt,1)*(cpmax-cpmin); h = text(xt,-yt,'LS','FontSize',[14],'HorizontalAlignment','center'); end; btnPos=[.05 0.18 .4 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); if resup(6) ~= 0 textStr = ['Turbulent Separation at ',num2str(resup(6)),' %']; btnPos=[.455 0.18 .295 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); xt = resup(6)/100; yt = findy(z,xt,1)*(cpmax-cpmin); h = text(xt,-yt,'TS','FontSize',[14],'HorizontalAlignment','center'); end; reslo = solvebl(ReL,zlo,nlo,uelo,plotbl,2); figure(figNumber); if reslo(4)==0 textStr = ['Lower side : Fully Laminar']; elseif reslo(4)==1 textStr = ['Lower side : Transition at ',num2str(reslo(5)),' %']; xt = reslo(5)/100; yt = findy(z,xt,2)*(cpmax-cpmin); h = text(xt,-yt,'T','FontSize',[14],'HorizontalAlignment','center'); elseif reslo(4) ==2 textStr = ['Lower side : Laminar Separation at ',num2str(reslo(5)),' %']; xt = reslo(5)/100; yt = findy(z,xt,2)*(cpmax-cpmin); h = text(xt,-yt,'LS','FontSize',[14],'HorizontalAlignment','center'); end; btnPos=[.05 0.14 .4 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); if reslo(6) ~= 0 textStr = ['Turbulent Separation at ',num2str(reslo(6)),' %']; btnPos=[.455 0.14 .295 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); xt = reslo(6)/100; yt = findy(z,xt,2)*(cpmax-cpmin); h = text(xt,-yt,'TS','FontSize',[14],'HorizontalAlignment','center'); end; % Computation of the Drag coefficient cd = sy(resup(1),resup(2),resup(3),reslo(1),reslo(2),reslo(3)); end; %------ Display the coefficients back = [0.34 0.67 0.6]; fore = [0.3 0.3 0.3]; btnPos=[.76 0.16 0.24 .11]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor',[0. 0. 0.], ... 'FontUnits','normalized', ... 'Fontsize',[.5], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',''); textStr = ['Cl = ',num2str(cl)]; btnPos=[.81 0.23 .198 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); textStr = ['Cm = ',num2str(cm)]; btnPos=[.81 0.20 .198 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); textStr = ['Xcp = ',num2str(xcp)]; btnPos=[.81 0.17 .4 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); if get(viscousHndl,'value') == 1 textStr = ['Cd = ',num2str(cd)]; btnPos=[.81 0.14 .198 .03]; coeffHndl=uicontrol( ... 'Style','text', ... 'BackgroundColor',back, ... 'ForegroundColor','k', ... 'HorizontalAlignment','left',... 'FontUnits','normalized', ... 'Fontsize',[.6], ... 'Units','normalized', ... 'Position',btnPos, ... 'String',textStr); end; end; if get(holdonHndl,'value') == 1 set(holdonHndl,'value',0); end; watchoff(figNumber);elseif strcmp(action,'info'), ttlStr=''; hlpStr= ... [' ' 'Panel Methods Theory can be found in: ' 'Katz and Plotkin : Low Speed Aerodynamics, From Wing Theory To Panel Methods.' 'McGraw-Hill Inc., 1991 ' ' ' '* Cst Source : Constant-Strength Source Distribution (Neumann BC) ' '* Cst Doublet : Constant-Strength Doublet Distribution (Dirichlet BC) ' '* Lin.Vortex : Linear-Strength Vortex Distribution (Neumann BC) ' ' ' ' ' 'Integral Boundary Layer Theory can be found in : ' 'Jack Moran : An introduction to Theoretical and Computational Aerodynamics. ' 'John Wiley and sons, 1984 ' ' ' '* Laminar boundary layer : Thwaites ' '* Transition : Michel ' '* Turbulent boundary layer : Head ']; info(ttlStr,hlpStr); end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -