diff --git a/+af_tools/@Polar/Polar.m b/+af_tools/@Polar/Polar.m index d4c444824d151f2d31eff4803ce2d25ae52ac426..0bb533cc4a81291aaf23776628be66f50066c5d0 100644 --- a/+af_tools/@Polar/Polar.m +++ b/+af_tools/@Polar/Polar.m @@ -1,42 +1,64 @@ classdef Polar - % POLAR Class for polars and their manipulations. - % The POLAR class is used to represent completely one or multiple polar curves related to a - % single airfoil. + % POLAR Airfoil polars and some associated properties. + % The Polar class is used to store an airfoil polars (cl, cd, cm values for different angles + % of attacks, at different Reynolds and Mach numbers). + % It can also contain some interesting extra properties such as the stall point, the zero-lift + % points, the linear lift range. It is also possible to compute the extrapolation of the + % polars over the complete range of angles of attack if needed. % - % The class also implements quick shortcuts for the more generic functions of af_tools, such - % as findcllinearrange, findstall or findzerolift. + % Note: + % - One Polar object correspond to one Airfoil. The properties of the Polar object are + % vectors/matrices whose the columns represent a single polar curve. + % - The method 'loadpolar' can be used instead of the constructor to load a previously saved + % polar object. % ----- % - % Properties: - % - airfoil : Airfoil name - % - reynolds : Rynolds number of each polar curve - % - mach : Mach number of each polar curve - % - nCrit : nCrit number of each polar curve - % - aoa : Angles of attack (one column per Reynolds) - % - cl : Lift coefficient (one row per aoa, one column per Reynolds) - % - cd : Drag coefficient (one row per aoa, one column per Reynolds) - % - cm : Moment coefficient (one row per aoa, one column per Reynolds) + % Polar properties: + % reynolds - Rynolds number of each polar curve, [-] + % mach - Mach number of each polar curve, [-] + % nCrit - nCrit number of each polar curve, [-] + % aoa - Angles of attack (one column per Reynolds), [rad] + % cl - Lift coefficient (one row per aoa, one column per Reynolds), [-] + % cd - Drag coefficient (one row per aoa, one column per Reynolds), [-] + % cm - Moment coefficient (one row per aoa, one column per Reynolds), [-] + % Ext - Struct with the data of the extended polars + % Stall - Struct with the data of the stall point for each curve + % Zero - Struct with the data of the zero-lift point for each curve + % Lin - Struct with the data of the linear range each curve % - % Private properties (set by running the methods below): - % - Ext : Struct with the data of the extended polars - % - Stall : Struct with the data of the stall point for each curve - % - Zero : Struct with the data of the zero-lift point for each curve - % - Lin : Struct with the data of the linear range each curve + % Polar methods: + % Polar - Constructor + % loadpolar - Load a polar from the MAT-file + % extendpolar - Extend polar curves over [-pi, pi] + % findstall - Find stall point + % findzerolift - Find zero-lift point + % findcllinrange - Find lift curve linear range + % analyze - Runs the above three functions + % plotpolars - Plot the polars % - % Methods (consult the help of each method with "help af_tools.Polar.<method>"): - % - loadpolar : Load a polar from the MAT-file - % - extendpolar : Extend polar curves over [-pi, pi] - % - findstall : Find stall point - % - findzerolift : Find zero-lift point - % - findcllinrange : Find lift curve linear range - % - analyse : Runs the above three functions - % - plotpolars : Plot the polars + % Polar constructor: + % Pol = Polar() creates an empty object. % + % Pol = Polar(reynolds, aoa, c_l) creates a polar object with only the lift coefficient data. % - % See also: af_tools.xf2mat. + % Pol = Polar(reynolds, aoa, c_l, c_d, c_m) creates a polar object with only the lift and drag + % coefficients data. + % + % Pol = Polar(reynolds, aoa, c_l, c_d, c_m) creates a polar object with the data for the lift, + % drag and moment coefficient. + % + % Constructor input: + % reynolds : Rynolds number of each polar curve, [-] + % aoa : Angles of attack (one column per Reynolds), [rad] + % cl : Lift coefficient (one row per aoa, one column per Reynolds), [-] + % cd : Drag coefficient (one row per aoa, one column per Reynolds), [-] + % cm : Drag coefficient (one row per aoa, one column per Reynolds), [-] + % + % See also: af_tools.Airfoil, af_tools.xf2mat. % % <a href="https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox">Documentation (online)</a> + % TODO: make this class handle class, verify everything, simplfiy methods % ------------------------------------------- % (c) Copyright 2022 University of Liege % Author: Thomas Lambert <t.lambert@uliege.be> @@ -45,22 +67,22 @@ classdef Polar % Repo: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox % Issues: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/issues % ---------------------------------------------------------------------------------------------- + properties - airfoil (1, :) cell - reynolds (1, :) double {mustBeNonnegative} - mach (1, :) double {mustBeNonnegative} - nCrit (1, :) double {mustBeNonnegative} - aoa (:, :) double {mustBeReal} - cl (:, :) double {mustBeReal} - cd (:, :) double {mustBeReal} - cm (:, :) double {mustBeReal} + reynolds (1, :) double {mustBeNonnegative} % Rynolds number, [-] + mach (1, :) double {mustBeNonnegative} % Mach number, [-] + nCrit (1, :) double {mustBeNonnegative} % nCrit number, [-] + aoa (:, :) double {mustBeReal} % Angles of attack, [rad] + cl (:, :) double {mustBeReal} % Lift coefficient, [-] + cd (:, :) double {mustBeReal} % Drag coefficient, [-] + cm (:, :) double {mustBeReal} % Moment coefficient, [-] end properties (SetAccess = private) - Ext = struct('aoa', [], 'cl', [], 'cd', [], 'cm', []) - Stall = struct('aoa', [], 'cl', [], 'cd', []) - Zero = struct('aoa', [], 'cd', []) - Lin = struct('slope', [], 'aoaRange', [], 'clRange', []) + Ext = struct('aoa', [], 'cl', [], 'cd', [], 'cm', []) % Extended polar data + Stall = struct('aoa', [], 'cl', [], 'cd', []) % Stall point data + Zero = struct('aoa', [], 'cd', []) % Zero-lift point data + Lin = struct('slope', [], 'aoaRange', [], 'clRange', []) % Lift linear range data end % ---------------------------------------------------------------------------------------------- @@ -68,7 +90,11 @@ classdef Polar function self = Polar(reynolds, aoa, c_l, c_d, c_m) % POLAR Constructor for Polar object - % Create a polar object with basic information. + % Instantiate a polar object using basic information. See the main class help for + % details about the constructor inputs. + % + % It is also possible to populate the properties of the object based on a saved polar + % using the Polar.loadpolar method. % % See also: af_tools.Polar.loadpolar @@ -118,7 +144,7 @@ classdef Polar function self = findcllinrange(self) % FINDZEROLIFT Find the linear range of the cl and its slope % - % See also: af_tools.findcllinrange. + % See also: af_tools.findcllinearrange. [self.Lin.clRange, self.Lin.aoaRange, self.Lin.slope] = ... af_tools.findcllinearrange(self); @@ -137,7 +163,7 @@ classdef Polar function self = analyze(self) % ANALYZE Get all useful information from the polar curves at once % - % See also: af_tools.findstall, af_tools.findzerolift, af_tools.findcllinrange. + % See also: af_tools.findstall, af_tools.findzerolift, af_tools.findcllinearrange. self = findstall(self); self = findzerolift(self);