Skip to content

Commit 6f35725

Browse files
committed
add plot CL vs CD
1 parent 2bb5d1d commit 6f35725

File tree

1 file changed

+43
-18
lines changed

1 file changed

+43
-18
lines changed

src/plotting.jl

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -679,31 +679,56 @@ function plot_polars(
679679
axs[2, 1].set_ylabel(L"$C_S$")
680680
axs[2, 1].legend()
681681
end
682-
683682

684-
# # Plot CL vs CD
685-
# plot!(res[4])
686-
# for (i, (polar_data, label)) in enumerate(zip(polar_data_list, label_list))
687-
# style = i ≤ n_solvers ? (:solid, :star, 7) : (:solid, :circle, 5)
688-
# plot!(res[4], polar_data[2], polar_data[3], # Note: CD on x-axis, CL on y-axis
689-
# label=label, linestyle=style[1], marker=style[2], markersize=style[3])
690-
691-
# # Limit ranges if values > 10
692-
# if maximum(polar_data[2]) > 10 || maximum(polar_data[3]) > 10
693-
# ylims!(res[4], (-0.5, 2.0))
694-
# xlims!(res[4], (-0.2, 0.5))
695-
# end
696-
# end
697-
# title!(res[4], L"C_L \textrm{ vs } C_D \textrm{ (over } %$angle_type \textrm{ range)}")
698-
# xlabel!(res[4], L"C_D")
699-
# ylabel!(res[4], L"C_L")
683+
for (i, (polar_data, label)) in enumerate(zip(polar_data_list, label_list))
684+
if i < n_solvers
685+
linestyle = "-"
686+
marker = "*"
687+
markersize = 7
688+
else
689+
linestyle = "-"
690+
marker = "."
691+
markersize = 5
692+
end
693+
if contains(label, "LLT")
694+
label = replace(label, "e5" => raw"\cdot10^5")
695+
label = replace(label, " " => raw"~")
696+
label = replace(label, "LLT" => raw"\mathrm{LLT}{~\,}")
697+
label = raw"$" * label * raw"$"
698+
else
699+
label = replace(label, "e5" => raw"\cdot10^5")
700+
label = replace(label, " " => "~")
701+
label = replace(label, "VSM" => raw"\mathrm{VSM}")
702+
label = raw"$" * label * raw"$"
703+
end
704+
axs[2, 2].plot(
705+
polar_data[2],
706+
polar_data[3],
707+
label=label,
708+
linestyle=linestyle,
709+
marker=marker,
710+
markersize=markersize,
711+
)
712+
# Limit y-range if CL > 10
713+
if maximum(polar_data[2]) > 10 || maximum(polar_data[3]) > 10
714+
axs[2, 2].set_ylim([-0.5, 2])
715+
axs[2, 2].set_xlim([-0.5, 2])
716+
end
717+
println(label)
718+
title = raw"$C_L" * raw"$" * " vs " * raw"$C_D" * raw"$"
719+
axs[2, 2].set_title(title)
720+
axs[2, 2].set_xlabel(L"$C_D$")
721+
axs[2, 2].set_ylabel(L"$C_L$")
722+
axs[2, 2].legend()
723+
end
700724

725+
fig.tight_layout(h_pad=2.5, rect=(0.01,0.01,0.99,0.99))
726+
701727
# # Save and show plot
702728
# if is_save
703729
# save_plot(res, save_path, title, data_type=data_type)
704730
# end
705731

706-
fig.tight_layout(h_pad=2.5, rect=(0.01,0.01,0.99,0.99))
707732
if is_show
708733
show_plot(fig)
709734
end

0 commit comments

Comments
 (0)