Skip to content
Snippets Groups Projects
Verified Commit 42da5edd authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

add(polar): polypolar method

parent 214cd796
No related branches found
No related tags found
No related merge requests found
Pipeline #7337 passed
......@@ -153,4 +153,10 @@ classdef Polar
methods (Static)
self = loadpolar(polarFile) % Load polar from file
end
% ----------------------------------------------------------------------------------------------
methods (Static)
self = polypolar(polyCl, polyCd) % Create polar using polynomial coefficients
end
end
function obj = loadpolar(polarFile)
% LOADPOLAR Load a polar object from a file
% This static method can be used in place of a normal constructor.
% When this function is used, the Polar object saved in the MAT-File will be imported. By
% When this method is used, the Polar object saved in the MAT-File will be imported. By
% assigning the output to something, it effectively duplicates the polar from the MAT-file.
% -----
%
......
function Obj = polypolar(polyCl, polyCd)
% POLYPOLAR Create a polar object using polynomial coefficients for cl and cd
% This static method can be used in place of a normal constructor.
% This will create a Polar object based on the polynomial coefficients given as input.
% The polar created will cover the full range of angles of attack ([-pi, pi] rad), with a step
% of 0.5 deg between two points.
% -----
%
% Usage:
% Polar.polypolar(polyCl,polyCd) returns a polar object with values equal to the coefficients.
%
% Inputs:
% polyCl : polynomial coefficients for cl (see polyval function for formatting), [1/deg]
% polyCd : polynomial coefficients for cd (see polyval function for formatting), [1/deg]
%
% Output:
% Obj: Polar object polynomial values for aoa, cl and cd an default values otherwise.
%
% Example:
% NewPolar = af_tools.Polar.polypolar([0.001, 2*pi, 0], [0.1, 0, 0.002]);
%
% See also: af_tools.Polar.
%
% -----
% (c) Copyright 2022 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% Apache 2.0 License
% https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox
% ----------------------------------------------------------------------------------------------
% Defaults and constants
DEF.AOA_STEP = 0.5;
DEF.AIRFOIL = {'Polynomial'};
DEF.REYNOLDS = 1e6;
DEF.MACH = 0;
% ---------------------------------------
% Construct empty object first
Obj = af_tools.Polar();
% Get lift and drag values
aoa_deg = (-180:DEF.AOA_STEP:180)';
Obj.aoa = deg2rad(aoa_deg);
Obj.cl = polyval(polyCl, aoa_deg);
Obj.cd = polyval(polyCd, aoa_deg);
% Set other properties to default values
Obj.airfoil = DEF.AIRFOIL;
Obj.reynolds = DEF.REYNOLDS;
Obj.mach = DEF.MACH;
end
......@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- **Polar**: add polypolar method
### Changed
### Deprecated
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment