Skip to content

Commit bd0e7cb

Browse files
committed
Use correct angle type
1 parent bd0fc80 commit bd0e7cb

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

ext/VortexStepMethodControlPlotsExt.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ function generate_polar_data(
595595
rey=reynolds_number[1])
596596
end
597597

598-
function _extract_literature_polar_data(raw_data, path)
598+
function _extract_literature_polar_data(raw_data, path;
599+
angle_type="angle_of_attack")
599600
table, header = if raw_data isa Tuple
600601
# readdlm(...; header=true) returns (data, header)
601602
raw_table, raw_header = raw_data
@@ -605,9 +606,15 @@ function _extract_literature_polar_data(raw_data, path)
605606
raw_data[2:end, :], lowercase.(strip.(string.(raw_data[1, :])))
606607
end
607608

608-
# Find column indices (case-insensitive, allow common variants)
609-
alpha_idx = findfirst(
610-
x -> occursin("alpha", x) || x == "aoa", header)
609+
# Find angle column based on angle_type
610+
alpha_idx = if angle_type == "side_slip"
611+
findfirst(
612+
x -> occursin("beta", x) ||
613+
occursin("side_slip", x), header)
614+
else
615+
findfirst(
616+
x -> occursin("alpha", x) || x == "aoa", header)
617+
end
611618
cl_idx = findfirst(x -> occursin("cl", x), header)
612619
cd_idx = findfirst(x -> occursin("cd", x), header)
613620
cs_idx = findfirst(x -> occursin("cs", x), header)
@@ -722,7 +729,8 @@ function VortexStepMethod.plot_polars(
722729
if !isempty(literature_path_list)
723730
for path in literature_path_list
724731
raw_data = readdlm(path, ',')
725-
lit = _extract_literature_polar_data(raw_data, path)
732+
lit = _extract_literature_polar_data(
733+
raw_data, path; angle_type)
726734
push!(polar_data_list, lit.polar_data)
727735
push!(cm_data_list, (cmx=lit.cmx, cmy=lit.cmy,
728736
cmz=lit.cmz))

0 commit comments

Comments
 (0)