Skip to content

Commit 45f51b5

Browse files
committed
Nonlinear solveru sing claero (this time for real)
1 parent 04c120c commit 45f51b5

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/liftingline/liftingline.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,7 @@ function _plot_polars(airfoils, airfoils_extrapolated, airfoils_blended;
18331833

18341834
if isnothing(slice)
18351835
axs[1].plot(airfoil.alpha, airfoil.cl, stl; label=L"$2y/b = $"*"$(ypos)", color=clr, fmt...)
1836-
axs[1].plot([airfoil.alpha0], [calc_cl(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
1836+
axs[1].plot([airfoil.alpha0], [calc_claero(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
18371837
axs[2].plot(airfoil.alpha, airfoil.cd, stl; label=L"$2y/b = $"*"$(ypos)", color=clr, fmt...)
18381838
axs[3].plot(airfoil.alpha, airfoil.cm, stl; label=L"$2y/b = $"*"$(ypos)", color=clr, fmt...)
18391839
end
@@ -1848,18 +1848,18 @@ function _plot_polars(airfoils, airfoils_extrapolated, airfoils_blended;
18481848

18491849
if isnothing(slice)
18501850
axs[1].plot(airfoil.alpha, airfoil.cl, stl; color=clr, fmt...)
1851-
axs[1].plot([airfoil.alpha0], [calc_cl(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
1851+
axs[1].plot([airfoil.alpha0], [calc_claero(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
18521852
axs[2].plot(airfoil.alpha, airfoil.cd, stl; color=clr, fmt...)
18531853
axs[3].plot(airfoil.alpha, airfoil.cm, stl; color=clr, fmt...)
18541854
else
18551855
plot_slice(airfoil, slice_alphas, slice; fig, axs, stl, color=clr, fmt...)
1856-
axs[1].plot([airfoil.alpha0], [calc_cl(airfoil, airfoil.alpha0, slice...)], "*"; color=clr, fmt...)
1856+
axs[1].plot([airfoil.alpha0], [calc_claero(airfoil, airfoil.alpha0, slice...)], "*"; color=clr, fmt...)
18571857
end
18581858

18591859
end
18601860

18611861
ax = axs[1]
1862-
ax.set_ylabel(L"Lift $c_\ell$")
1862+
ax.set_ylabel(L"Lift $c_{\ell_\mathrm{aero}}$")
18631863

18641864
ax = axs[2]
18651865
ax.set_ylabel(L"Drag $c_d$")
@@ -1902,12 +1902,12 @@ function _plot_polars(airfoils, airfoils_extrapolated, airfoils_blended;
19021902

19031903
if isnothing(slice)
19041904
axs[1].plot(airfoil.alpha, airfoil.cl, stl; label=lbl, color=clr, fmt...)
1905-
axs[1].plot([airfoil.alpha0], [calc_cl(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
1905+
axs[1].plot([airfoil.alpha0], [calc_claero(airfoil, airfoil.alpha0)], "*"; color=clr, fmt...)
19061906
axs[2].plot(airfoil.alpha, airfoil.cd, stl; label=lbl, color=clr, fmt...)
19071907
axs[3].plot(airfoil.alpha, airfoil.cm, stl; label=lbl, color=clr, fmt...)
19081908
else
19091909
plot_slice(airfoil, slice_alphas, slice; fig, axs, stl, label=lbl, color=clr, fmt...)
1910-
axs[1].plot([airfoil.alpha0], [calc_cl(airfoil, airfoil.alpha0, slice...)], "*"; color=clr, fmt...)
1910+
axs[1].plot([airfoil.alpha0], [calc_claero(airfoil, airfoil.alpha0, slice...)], "*"; color=clr, fmt...)
19111911
end
19121912

19131913
end
@@ -1916,7 +1916,7 @@ function _plot_polars(airfoils, airfoils_extrapolated, airfoils_blended;
19161916
end
19171917

19181918
ax = axs[1]
1919-
ax.set_ylabel(L"Lift $c_\ell$")
1919+
ax.set_ylabel(L"Lift $c_{\ell_\mathrm{aero}}$")
19201920

19211921
ax = axs[2]
19221922
ax.set_ylabel(L"Drag $c_d$")

src/liftingline/optimization.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ function run_liftingline(;
147147
abstol = 1e-13,
148148
maxiters = 800,
149149
),
150+
aoas_initial_guess = alpha, # Solver initial guess
151+
solver_verbose = true, # Whether to show solver verbose in unsuccessfull runs
150152

151153
align_joints_with_Uinfs = false, # Whether to align joint bound vortices with the freestream
152154

@@ -274,7 +276,7 @@ function run_liftingline(;
274276
# Run solver
275277
result, solver_cache = solve(ll, Uinfs;
276278
debug=plot_convergence, # `true` returns the residual rms
277-
aoas_initial_guess=alpha,
279+
aoas_initial_guess,
278280
align_joints_with_Uinfs,
279281
solver, solver_optargs,
280282
solver_cache=cache["solver_cache"][NumType]
@@ -283,7 +285,7 @@ function run_liftingline(;
283285
# Check solver success
284286
success = SimpleNonlinearSolve.SciMLBase.successful_retcode(result)
285287

286-
if !success
288+
if !success && solver_verbose
287289
@warn "Lifting line solver did not converge!"
288290
@show success
289291
@show solver_cache[:fcalls]

src/liftingline/stripwise.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ end
113113
calc_cm(self, args...; optargs...)
114114
)
115115

116-
calc_claero(self::FunctionalAirfoil, args...; optargs...) = calc_cl(self, args...; optargs...)
116+
calc_claero(self::FunctionalAirfoil, args...; optargs...) = self.fun_claero(args...; optargs...)
117117

118118
calc_cl(self::FunctionalAirfoil, args...; optargs...) = self.fun_cl(args...; optargs...)
119119
calc_cd(self::FunctionalAirfoil, args...; optargs...) = self.fun_cd(args...; optargs...)
@@ -156,9 +156,9 @@ function plot_slice(self::FunctionalAirfoil{N}, alphas, slice;
156156
fig.suptitle("Element polar at slice [" * join(("x$(i)" for i in 1:length(slice)), ", ") * "] = [" * join(("$x" for x in slice), ", ")*"]")
157157

158158
ax = axs[1]
159-
ax.plot(alphas, [calc_cl(self, a, slice...) for a in alphas], stl; optargs...)
159+
ax.plot(alphas, [calc_claero(self, a, slice...) for a in alphas], stl; optargs...)
160160

161-
ax.set_ylabel(L"c_\ell")
161+
ax.set_ylabel(L"c_{\ell_\mathrm{aero}}")
162162

163163
ax = axs[2]
164164
ax.plot(alphas, [calc_cd(self, a, slice...) for a in alphas], stl; optargs...)

0 commit comments

Comments
 (0)