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
4c2bae32
Unverified
Commit
4c2bae32
authored
1 year ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
refact(Polar): early return when interp between same polars
parent
fbf8ebf7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
+af_tools/@Polar/Polar.m
+1
-1
1 addition, 1 deletion
+af_tools/@Polar/Polar.m
+af_tools/@Polar/interppolar.m
+26
-6
26 additions, 6 deletions
+af_tools/@Polar/interppolar.m
with
27 additions
and
7 deletions
+af_tools/@Polar/Polar.m
+
1
−
1
View file @
4c2bae32
...
...
@@ -181,7 +181,7 @@ classdef Polar < handle
self
=
polypolar
(
polyCl
,
polyCd
)
% Create polar using polynomial coefficients
% Create a polar by interpolating between two different polar objects
self
=
interppolar
(
Polar1
,
Polar2
,
position
)
self
=
interppolar
(
Polar1
,
Polar2
,
weightPolar2
)
end
end
This diff is collapsed.
Click to expand it.
+af_tools/@Polar/interppolar.m
+
26
−
6
View file @
4c2bae32
function
self
=
interppolar
(
Polar1
,
Polar2
,
weightPolar2
)
% INTERPPOLAR Create a new polar object by interpolation of two other polars.
% This static method can be used in place of a normal constructor.
% This static method can be used in place of a normal constructor
for the Polar class
.
% This method can be used when the user wants to interpolate the polars bewteen two known
% airfoils. Consider that the airfoil at x=0 is a NACA 0012, and the one at x=1 is a CLARY-Y.
% Rather than assuming that all segments in [0,1] are NACA 0012 and all segments after 1 are
...
...
@@ -8,7 +8,7 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
% the two bounds. If we are at 0.1, the newly created Polar object, will then be 90% of NACA
% 0012 and 10% of CLARK-Y.
% Note:
% The two input Polars should have the same range of
AOA,
Reynolds, Mach, and nCrit.
% The two input Polars should have the same range of Reynolds, Mach, and nCrit.
% -----
%
% Usage:
...
...
@@ -27,7 +27,7 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
% Example:
% MixedPolar = af_tools.interppolar(PolarNACA0012, PolarClarkY, 0.6); Creates an interpolated
% Polar object MixedPolar that results from the interpolation of PolarNACA0012
% and PolarClarkY, as
u
sming that the MixedPolar is made of 60% ClarkY and 40%
% and PolarClarkY, ass
u
ming that the MixedPolar is made of 60% ClarkY and 40%
% NACA0012.
%
% See also: af_tools.Polar.
...
...
@@ -45,7 +45,7 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
% ----------------------------------------------------------------------------------------------
% --- Defaults and constants
DEBUG
=
tru
e
;
DEBUG
=
fals
e
;
% --- Input checks
% Check if both Polars are Polars objects and weightPolar2 is in [0,1]
...
...
@@ -54,8 +54,7 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
validateattributes
(
weightPolar2
,
{
'double'
},
{
'scalar'
,
'nonnegative'
,
'<='
,
1
},
...
mfilename
(),
'weightPolar2'
,
3
);
% Check that both Polars have the same AOA, Reynolds, Mach and nCrit
equalfieldscheck
(
Polar1
,
Polar2
,
'aoa'
);
% Check that both Polars have the Reynolds, Mach and nCrit
equalfieldscheck
(
Polar1
,
Polar2
,
'reynolds'
);
equalfieldscheck
(
Polar1
,
Polar2
,
'mach'
);
equalfieldscheck
(
Polar1
,
Polar2
,
'nCrit'
);
...
...
@@ -64,6 +63,25 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
self
=
af_tools
.
Polar
;
if
Polar1
==
Polar2
self
.
properties
=
self
.
properties
;
self
.
airfoil
=
self
.
airfoil
;
self
.
reynolds
=
self
.
reynolds
;
self
.
mach
=
self
.
mach
;
self
.
nCrit
=
self
.
nCrit
;
self
.
aoa
=
self
.
aoa
;
self
.
cl
=
self
.
cl
;
self
.
cd
=
self
.
cd
;
self
.
cm
=
self
.
cm
;
self
.
Ext
=
self
.
Ext
;
self
.
Stall
=
self
.
Stall
;
self
.
Zero
=
self
.
Zero
;
self
.
Lin
=
self
.
Lin
;
self
.
extrapMethod
=
self
.
extrapMethod
;
return
end
wPol2
=
weightPolar2
;
wPol1
=
1
-
wPol2
;
nPolars
=
numel
(
Polar1
.
reynolds
);
...
...
@@ -118,8 +136,10 @@ function self = interppolar(Polar1, Polar2, weightPolar2)
plot
(
Polar1
.
aoa
(:,
j
),
Polar1
.
cl
(:,
j
));
plot
(
Polar2
.
aoa
(:,
j
),
Polar2
.
cl
(:,
j
));
plot
(
self
.
aoa
(:,
j
),
self
.
cl
(:,
j
));
hold
off
;
legend
(
Polar1
.
airfoil
{
1
},
Polar2
.
airfoil
{
1
},
self
.
airfoil
{
1
},
'Location'
,
'NorthWest'
);
grid
on
;
pause
;
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