Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
matlab_airfoil_toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
matlab_airfoil_toolbox
Commits
a5bb97ba
Verified
Commit
a5bb97ba
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
add(polar): add polar class
parent
e043099f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
+af_tools/@Polar/Polar.m
+129
-0
129 additions, 0 deletions
+af_tools/@Polar/Polar.m
+af_tools/@Polar/loadpolar.m
+48
-0
48 additions, 0 deletions
+af_tools/@Polar/loadpolar.m
with
177 additions
and
0 deletions
+af_tools/@Polar/Polar.m
0 → 100644
+
129
−
0
View file @
a5bb97ba
classdef
Polar
% POLAR Class for polars and their manipulations.
% This POLAR class is used to represent completely one or multiple polars related to an
% airfoil. It defines the following properties
% - reynolds
% - mach
% - angles of attack
% - lift, drag and moment coefficients
%
% It also defines a few methods that can be used to manipulate easily a polar such as:
% - extend the values over all angles of attack from -180 to 180 deg,
% - find the zero lift angle and cd_0
% - find the stall angle
% - find the lift curve linear slope
% - ...
%
% <a href="https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox">Documentation (README)</a>
% <a href="https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/issues">Report an issue</a>
% -----
%
% Usage:
% Pol = POLAR initiates an empty polar object.
%
% Pol = AIRFOIL(reynolds, aoa, c_l) initiates a polar object with only the lift coefficient
% curves corresponding to the Reynolds numbers 'reynolds'. The Reynolds number can be a vector
% if multiple curves (multiple columns for aoa and c_l).
%
% Pol = AIRFOIL(reynolds, aoa, c_l, c_d) initiates a polar object with only the lift and drag
% coefficient curves for the coresponding Reynolds.
%
% Pol = AIRFOIL(reynolds, aoa, c_l, c_d, c_m) initiates a polar object with the curves for the
% three coefficients (lift, drag and moment) for the coresponding Reynolds.
%
% Inputs:
% reynolds : Reynolds number of each data set (vector)
% aoa : Angles of attack for the polar (one column per reynolds), IN RADIANS
% c_l : Lift coefficient (one column per reynolds, one row per angle of attack)
% c_d : Drag coefficient (one column per reynolds, one row per angle of attack)
% c_m : Moment coefficient (one column per reynolds, one row per angle of attack)
%
% Example:
% Pol = POLAR
% Pol = POLAR(1e6,aoa, c_l)
% Pol = POLAR(1e6,aoa, c_l, c_d)
% Pol = POLAR(1e6,aoa, c_l, c_d, c_m)
%
% See also: XF2MAT, EXTENDPOLAR.
%
% -----
% (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
% ----------------------------------------------------------------------------------------------
properties
airfoil
reynolds
mach
nCrit
aoa
cl
cd
cm
Ext
=
struct
(
'aoa'
,
[],
'cl'
,
[],
'cd'
,
[],
'cm'
,
[])
Stall
=
struct
(
'aoa'
,
[],
'cl'
,
[],
'cd'
,
[])
Zero
=
struct
(
'aoa'
,
[],
'cd'
,
[])
Lin
=
struct
(
'slope'
,
[],
'aoaRange'
,
[],
'clRange'
,
[])
origin
end
methods
function
obj
=
Polar
(
reynolds
,
aoa
,
c_l
,
c_d
,
c_m
)
% POLAR Construct an instance of this class.
% Initiates the Polar object based on the various inputs.
if
nargin
>
0
narginchk
(
3
,
5
);
obj
.
reynolds
=
reynolds
;
obj
.
aoa
=
aoa
;
obj
.
cl
=
c_l
;
if
nargin
>=
4
obj
.
cd
=
c_d
;
if
nargin
>=
5
obj
.
cm
=
c_m
;
end
end
end
end
function
obj
=
extendpolar
(
obj
)
% EXTENDPOLAR Extends the polar data over the full range of AOA ([-180, 180] deg).
[
obj
.
Ext
.
aoa
,
obj
.
Ext
.
cl
,
obj
.
Ext
.
cd
]
=
af_tools
.
extendpolar
(
obj
);
end
function
obj
=
findstall
(
obj
)
% FINDSTALL Find the stall point of the polars
[
obj
.
Stall
.
aoa
,
obj
.
Stall
.
cl
,
obj
.
Stall
.
cd
]
=
af_tools
.
findstall
(
obj
);
end
function
obj
=
findzerolift
(
obj
)
% FINDZEROLIFT Find the zero-lift angle and associated cd
[
obj
.
Zero
.
aoa
,
obj
.
Zero
.
cd
]
=
af_tools
.
findzerolift
(
obj
);
end
function
obj
=
findlinrange
(
obj
)
% FINDZEROLIFT Find the linear range of the cl and its slope
[
obj
.
Lin
.
clRange
,
obj
.
Lin
.
aoaRange
,
obj
.
Lin
.
slope
]
=
af_tools
.
findcllinearrange
(
obj
);
end
function
obj
=
analyse
(
obj
)
% ANALYSE Analyse all polars to retreive the useful informations
obj
=
findstall
(
obj
);
obj
=
findzerolift
(
obj
);
obj
=
findlinrange
(
obj
);
end
end
methods
(
Static
)
% Load polar from file
obj
=
loadpolar
(
polarFile
)
end
end
This diff is collapsed.
Click to expand it.
+af_tools/@Polar/loadpolar.m
0 → 100644
+
48
−
0
View file @
a5bb97ba
function
obj
=
loadpolar
(
polarFile
)
% LOADPOLAR Load a polar object from a file
% This static method can replace a normal constructor.
% When this function 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.
% -----
%
% Usage:
% NewPolar.LOADPOLAR(polarFile) load the polar object stored in polarFile into the NewPolar.
%
% Inputs:
% polarFile : MAT-File containing a polar object.
%
% Output:
% NewPolar : Copy of the polar object contained in polarFile.
%
% Example:
% NewPolar = af_tools.Polar.loadpolar('oldpolar.mat');
%
% See also: 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
% ----------------------------------------------------------------------------------------------
tmp
=
load
(
polarFile
);
polarName
=
fieldnames
(
tmp
);
if
isempty
(
polarName
)
error
(
'POLAR:loadpolar:emptyPolarFile'
,
...
[
'The Polar file specified as input does not contain anything!\n'
...
'See <help af_tools.Polar.loadpolar> for details about this method.'
]);
elseif
length
(
polarName
)
>
1
error
(
'POLAR:loadpolar:tooManyVarInPolarFile'
,
...
[
'The Polar file specified as input should only contain '
...
'one polar object and nothing else.\n'
...
'Found %d different variables instead!\n'
...
'See <help af_tools.Polar.loadpolar> for details about this method.'
],
...
length
(
polarName
));
else
obj
=
tmp
.
(
polarName
{
1
});
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment