Skip to content

Commit 450bf02

Browse files
committed
Add cl over cd kwarg
1 parent ee2344b commit 450bf02

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

ext/VortexStepMethodControlPlotsExt.jl

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ Plot polar data comparing different solvers and configurations.
611611
- `is_save`: Whether to save plots (default: true)
612612
- `is_show`: Whether to display plots (default: true)
613613
- `use_tex`: if the external `pdflatex` command shall be used (default: false)
614+
- `cl_over_cd`: Plot CL/CD vs angle instead of CL vs CD (default: true)
614615
"""
615616
function VortexStepMethod.plot_polars(
616617
solver_list,
@@ -627,7 +628,8 @@ function VortexStepMethod.plot_polars(
627628
save_path=nothing,
628629
is_save=true,
629630
is_show=true,
630-
use_tex=false
631+
use_tex=false,
632+
cl_over_cd=true,
631633
)
632634
# Validate inputs
633635
total_cases = length(body_aero_list) + length(literature_path_list)
@@ -821,23 +823,34 @@ function VortexStepMethod.plot_polars(
821823
label = replace(label, "VSM" => raw"\mathrm{VSM}")
822824
label = raw"$" * label * raw"$"
823825
end
824-
axs[2, 2].plot(
825-
polar_data[3],
826-
polar_data[2],
827-
label=label,
828-
linestyle=linestyle,
829-
marker=marker,
830-
markersize=markersize,
831-
)
832-
# Limit y-range if CL > 10
833-
if maximum(polar_data[2]) > 10 || maximum(polar_data[3]) > 10
834-
axs[2, 2].set_ylim([-0.5, 2])
835-
axs[2, 2].set_xlim([-0.5, 2])
826+
if cl_over_cd
827+
cl_cd = polar_data[2] ./ polar_data[3]
828+
axs[2, 2].plot(
829+
polar_data[1], cl_cd,
830+
label=label, linestyle=linestyle,
831+
marker=marker, markersize=markersize)
832+
title = raw"$C_\mathrm{L}/C_\mathrm{D}$" *
833+
" vs $angle_type [°]"
834+
axs[2, 2].set_title(title)
835+
axs[2, 2].set_xlabel("$angle_type [°]")
836+
axs[2, 2].set_ylabel(
837+
L"$C_\mathrm{L}/C_\mathrm{D}$")
838+
else
839+
axs[2, 2].plot(
840+
polar_data[3], polar_data[2],
841+
label=label, linestyle=linestyle,
842+
marker=marker, markersize=markersize)
843+
if maximum(polar_data[2]) > 10 ||
844+
maximum(polar_data[3]) > 10
845+
axs[2, 2].set_ylim([-0.5, 2])
846+
axs[2, 2].set_xlim([-0.5, 2])
847+
end
848+
title = raw"$C_\mathrm{L}$" * " vs " *
849+
raw"$C_\mathrm{D}$"
850+
axs[2, 2].set_title(title)
851+
axs[2, 2].set_xlabel(L"$C_\mathrm{D}$")
852+
axs[2, 2].set_ylabel(L"$C_\mathrm{L}$")
836853
end
837-
title = raw"$C_\mathrm{L}" * raw"$" * " vs " * raw"$C_\mathrm{D}" * raw"$"
838-
axs[2, 2].set_title(title)
839-
axs[2, 2].set_xlabel(L"$C_\mathrm{D}$")
840-
axs[2, 2].set_ylabel(L"$C_\mathrm{L}$")
841854
axs[2, 2].legend()
842855
end
843856

@@ -957,7 +970,8 @@ function VortexStepMethod.plot_combined_analysis(
957970
view_elevation=15,
958971
view_azimuth=-120,
959972
use_tex=false,
960-
literature_path_list=String[]
973+
literature_path_list=String[],
974+
cl_over_cd=true,
961975
)
962976
# Normalize inputs to arrays for consistent handling
963977
solvers = solver isa Vector ? solver : [solver]
@@ -1011,7 +1025,8 @@ function VortexStepMethod.plot_combined_analysis(
10111025
save_path=save_path,
10121026
is_save=is_save,
10131027
is_show=is_show,
1014-
use_tex=use_tex
1028+
use_tex=use_tex,
1029+
cl_over_cd=cl_over_cd
10151030
)
10161031
end
10171032

0 commit comments

Comments
 (0)