FEATool Multiphysics
v1.17.2
Finite Element Analysis Toolbox
|
EX_POTENTIAL_FLOW1 Potential flow around a NACA wing profile.
[ FEA, OUT ] = EX_POTENTIAL_FLOW1( VARARGIN ) Example to calculate potential flow around a NACA airfoil with the stream-function formulation. Using fminbnd to establish the stream-function value on the body so as to enforce the Kutta condition and minimize the velocity at the trailing edge.
Accepts the following property/value pairs.
Input Value/{Default} Description ----------------------------------------------------------------------------------- series string {0012} NACA 4-series wing profile descriptor alfa scalar {6} Angle of attack sfun string {sflag1} Shape function for stream-function iplot scalar 0/{1} Plot solution (=1) . Output Value/(Size) Description ----------------------------------------------------------------------------------- fea struct Problem definition struct out struct Output struct
cOptDef = { 'series', '0012'; 'alfa', 6; 'sfun', 'sflag1'; 'iplot', 1; 'tol', 0.05; 'fid', 1 }; [got,opt] = parseopt(cOptDef,varargin{:}); fid = opt.fid; series = opt.series; alfa = opt.alfa; sfun = opt.sfun; func = @(psi) velocity_at_trailing_edge( psi, series, alfa, sfun ); args = {}; if( ~isempty(opt.fid) ) args = { optimset('Display','iter','TolX',1e-3) }; end [psi_min,U_min] = fminbnd( func, -10, 10, args{:} ); % [psi_min,U_min] = fminsearch( func, 0, args{:} ); fea = l_setup_fea( psi_min, series, alfa, sfun ); fea.sol.u = solvestat( fea, 'fid', [] ); err = l_postprocessing( opt.iplot, fea, series, alfa ); out.err = err; out.pass = err < opt.tol; if( ~nargout ) clear fea out end %