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
896d30ef
Verified
Commit
896d30ef
authored
2 years ago
by
Thomas Lambert
Browse files
Options
Downloads
Patches
Plain Diff
fix(extpol): incorrect cd_ext when multiple polars
parent
4d49475f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#7094
passed
2 years ago
Stage: static analysis
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
+af_tools/extendpolar.m
+5
-4
5 additions, 4 deletions
+af_tools/extendpolar.m
tests/test_extendpolar.m
+26
-1
26 additions, 1 deletion
tests/test_extendpolar.m
with
31 additions
and
5 deletions
+af_tools/extendpolar.m
+
5
−
4
View file @
896d30ef
...
...
@@ -214,7 +214,7 @@ function [alpha_ext, c_l_ext, c_d_ext] = viterna(limit, alpha, c_l, c_d)
% 1. Extend Cl/Cd to ]limit, 90]
alpha_1
=
(
alpha_l
+
alpha_step
:
alpha_step
:
pi
/
2
)
'
;
[
c
l
1
,
c
d
1
]
=
viternaeq
(
VitCoeffs
,
alpha_1
,
1
);
[
c
_l_
1
,
c
_d_
1
]
=
viternaeq
(
VitCoeffs
,
alpha_1
,
1
);
% 2. Extend to ]90, 180-limit]
alpha_2
=
(
pi
/
2
+
alpha_step
:
alpha_step
:
pi
-
alpha_l
)
'
;
...
...
@@ -251,12 +251,13 @@ function [alpha_ext, c_l_ext, c_d_ext] = viterna(limit, alpha, c_l, c_d)
% Concatenate everything to get the full extended polars
alpha_ext
(:,
i
)
=
[
alpha_6
;
alpha_5
;
alpha_4
;
trimmedAlpha
;
alpha_1
;
alpha_2
;
alpha_3
];
c_l_ext
(:,
i
)
=
[
c_l_6
;
c_l_5
;
c_l_4
;
trimmedCl
;
c
l
1
;
c_l_2
;
c_l_3
];
c_d_ext
(:,
i
)
=
[
c_d_6
;
c_d_5
;
c_d_4
;
trimmedCd
;
c
d
1
;
c_d_2
;
c_d_3
];
c_l_ext
(:,
i
)
=
[
c_l_6
;
c_l_5
;
c_l_4
;
trimmedCl
;
c
_l_
1
;
c_l_2
;
c_l_3
];
c_d_ext
(:,
i
)
=
[
c_d_6
;
c_d_5
;
c_d_4
;
trimmedCd
;
c
_d_
1
;
c_d_2
;
c_d_3
];
% Trim negatives cd to cdmin
c_d_min
=
min
(
trimmedCd
);
c_d_ext
(
c_d_ext
<=
c_d_min
,
i
)
=
c_d_min
;
c_d_ext
(
c_d_ext
(:,
i
)
<=
c_d_min
,
i
)
=
c_d_min
;
end
end
...
...
This diff is collapsed.
Click to expand it.
tests/test_extendpolar.m
+
26
−
1
View file @
896d30ef
...
...
@@ -199,7 +199,7 @@ end
%% Test if function returns expected outputs
function
test_correctAlphaSize
(
testCase
)
function
test_correctAlphaSize
SinglePolar
(
testCase
)
% Verify if the output alpha has the correct size
% Should not re-expand polar that already covers the full range
...
...
@@ -216,4 +216,29 @@ function test_correctAlphaSize(testCase)
verifyEqual
(
testCase
,
clExt2
,
clExt
);
verifyEqual
(
testCase
,
cdExt2
,
cdExt
);
verifyEqual
(
testCase
,
size
(
clExt2
),
size
(
alphaExt
));
verifyEqual
(
testCase
,
size
(
cdExt2
),
size
(
alphaExt
));
end
function
test_correctAlphaSizeDoublePolar
(
testCase
)
% Verify if the output alpha has the correct size
% Should not re-expand polar that already covers the full range
Polar
=
dummydoublepolar
();
stepAlpha
=
min
(
diff
(
Polar
.
alpha
));
fullRange
=
(
-
pi
:
stepAlpha
:
pi
)
'
;
[
alphaExt
,
clExt
,
cdExt
]
=
af_tools
.
extendpolar
(
Polar
);
[
alphaExt2
,
clExt2
,
cdExt2
]
=
af_tools
.
extendpolar
(
alphaExt
,
clExt
,
cdExt
);
verifyEqual
(
testCase
,
alphaExt
(:,
1
),
fullRange
,
'AbsTol'
,
1e-9
);
verifyEqual
(
testCase
,
alphaExt2
,
alphaExt
);
verifyEqual
(
testCase
,
clExt2
,
clExt
);
verifyEqual
(
testCase
,
cdExt2
,
cdExt
);
verifyEqual
(
testCase
,
size
(
clExt2
),
size
(
alphaExt
));
verifyEqual
(
testCase
,
size
(
cdExt2
),
size
(
alphaExt
));
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