Skip to content

Commit b756a1b

Browse files
committed
Comment out unnecessary memory allocation
1 parent 71f16bc commit b756a1b

File tree

5 files changed

+53
-29
lines changed

5 files changed

+53
-29
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
2222
Dierckx = "0.5"
2323
GeometricTools = "2.2"
2424
ImplicitAD = "0.3"
25-
Krylov = "0.9"
25+
Krylov = "0.10"
2626
Requires = "1"
2727
julia = "1.6"
2828

examples/sweptwing_aoasweep.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,15 @@ CLs = sign.(dot.(Ls, Lhats)) .* norm.(Ls) / nondim
188188
CDs = sign.(dot.(Ds, Dhats)) .* norm.(Ds) / nondim
189189

190190
# VSPAERO CL and CD
191-
data_vsp = CSV.read(vsp_file, DataFrame; skipto=397, limit=419-397+1)
191+
# data_vsp = CSV.read(vsp_file, DataFrame; skipto=397, limit=419-397+1)
192+
data_vsp = CSV.read(vsp_file, DataFrame; skipto=495, limit=536-495+1)
192193
alphas_vsp = [val for val in data_vsp[1, 2:end]]
193194
CDi_vsp = [val for val in data_vsp[3, 2:end]]
194195
CDtot_vsp = [val for val in data_vsp[6, 2:end]]
195-
CL_vsp = [val for val in data_vsp[11, 2:end]]
196-
CMy_vsp = [val for val in data_vsp[16, 2:end]]
196+
# CL_vsp = [val for val in data_vsp[11, 2:end]]
197+
CL_vsp = [val for val in data_vsp[20, 2:end]]
198+
# CMy_vsp = [val for val in data_vsp[16, 2:end]]
199+
CMy_vsp = [val for val in data_vsp[29, 2:end]]
197200

198201
fig5 = plt.figure(figsize=[7*2, 5*1*0.75]*2/3)
199202
axs = fig5.subplots(1, 2)

examples/sweptwing_postprocessing.jl

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ function plot_Cps(body::Union{pnl.NonLiftingBody, pnl.AbstractLiftingBody}, cont
6363
# Plot VSPAERO
6464
if plot_vsp && AOA == 4.2
6565

66-
rowstart = spanpos==0.041 ? 1139 :
67-
spanpos==0.163 ? 1169 :
68-
spanpos==0.245 ? 1184 :
69-
spanpos==0.510 ? 1199 :
66+
rowstart = spanpos==0.041 ? 1139 + (1578 - 1139) :
67+
spanpos==0.163 ? 1169 + (1578 - 1139) :
68+
spanpos==0.245 ? 1184 + (1578 - 1139) :
69+
spanpos==0.510 ? 1199 + (1578 - 1139) :
7070
nothing
7171

7272
if !isnothing(rowstart)
@@ -258,19 +258,32 @@ function plot_loading(body::Union{pnl.NonLiftingBody, pnl.AbstractLiftingBody},
258258
# Plot VSPAERO
259259
if plot_vsp
260260

261-
rowstart = AOA==2.1 ? 482 :
262-
AOA==4.2 ? 544 :
263-
AOA==6.3 ? 606 :
264-
AOA==8.4 ? 668 :
261+
# rowstart = AOA==2.1 ? 482 :
262+
# AOA==4.2 ? 544 :
263+
# AOA==6.3 ? 606 :
264+
# AOA==8.4 ? 668 :
265+
rowstart = AOA==2.1 ? 644 :
266+
AOA==4.2 ? 751 :
267+
AOA==6.3 ? 858 :
268+
AOA==8.4 ? 965 :
265269
nothing
266270

267271
if !isnothing(rowstart)
268272

269-
data_vsp = CSV.read(vsp_file, DataFrame; skipto=rowstart+20, limit=24)
273+
data_vsp = CSV.read(vsp_file, DataFrame; skipto=rowstart+28, limit=77)
270274

271-
ypos_vsp = [val for val in data_vsp[1, 2:end]]
272-
cl_vsp = [val for val in data_vsp[9, 2:end]]
273-
cd_vsp = [val for val in data_vsp[7, 2:end]]
275+
println(rowstart)
276+
# display(data_vsp)
277+
278+
println(data_vsp[21, 1])
279+
println(data_vsp[29, 1])
280+
println(data_vsp[23, 1])
281+
282+
ypos_vsp = 2*[val for val in data_vsp[21, 2:end]] / 2.48920
283+
ypos_vsp .+= 1
284+
ypos_vsp ./= 2
285+
cl_vsp = [val for val in data_vsp[29, 2:end]]
286+
cd_vsp = [val for val in data_vsp[23, 2:end]]
274287

275288
ypos_vsp .-= 0.5
276289
ypos_vsp .*= 2.0

src/FLOWPanel_liftingbody.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,8 @@ function _G_U_RHS_leastsquares!(self::AbstractBody,
368368

369369
@assert size(G, 1)==n && size(G, 2)==n ""*
370370
"Invalid $(size(G, 1))x$(size(G, 2)) matrix G; expected $(n)x$(n)"
371-
@assert size(Gred, 1)==n && size(Gred, 2)==n-npres ""*
372-
"Invalid $(size(Gred, 1))x$(size(Gred, 2)) matrix Gred; expected $(n)x$(n-npres)"
373-
@assert size(tGred, 1)==n-npres && size(tGred, 2)==n ""*
374-
"Invalid $(size(tGred, 1))x$(size(tGred, 2)) matrix tGred; expected $(n-npres)x$(n)"
375-
@assert size(Gls, 1)==n-npres && size(Gls, 2)==n-npres ""*
376-
"Invalid $(size(Gls, 1))x$(size(Gls, 2)) matrix Gls; expected $(n-npres)x$(n-npres)"
377371

378372
@assert length(RHS)==n "Invalid RHS length $(length(RHS)); expected $(n)"
379-
@assert length(RHSls)==n-npres "Invalid RHSls length $(length(RHSls)); expected $(n-npres)"
380373

381374
# Sort prescribed elements by index
382375
sort!(elprescribe, by = x -> x[1])
@@ -392,6 +385,14 @@ function _G_U_RHS_leastsquares!(self::AbstractBody,
392385
return Gls, RHSls
393386
end
394387

388+
@assert size(Gls, 1)==n-npres && size(Gls, 2)==n-npres ""*
389+
"Invalid $(size(Gls, 1))x$(size(Gls, 2)) matrix Gls; expected $(n-npres)x$(n-npres)"
390+
@assert length(RHSls)==n-npres "Invalid RHSls length $(length(RHSls)); expected $(n-npres)"
391+
@assert size(Gred, 1)==n && size(Gred, 2)==n-npres ""*
392+
"Invalid $(size(Gred, 1))x$(size(Gred, 2)) matrix Gred; expected $(n)x$(n-npres)"
393+
@assert size(tGred, 1)==n-npres && size(tGred, 2)==n ""*
394+
"Invalid $(size(tGred, 1))x$(size(tGred, 2)) matrix tGred; expected $(n-npres)x$(n)"
395+
395396
# Move influence of prescribed vortex ring elements to right-hand side
396397
for (eli, elval) in elprescribe
397398
for i in 1:length(RHS)

src/FLOWPanel_multibody.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,21 @@ function allocate_solver(self::Union{MultiBody{VortexRing, 2}, RigidWakeBody{Vor
404404
npres = length(_elprescribe)
405405

406406
Gamma = zeros(T, n)
407-
Gammals = zeros(T, n-npres)
407+
# Gammals = zeros(T, n-npres)
408408
G = zeros(T, n, n)
409-
Gred = zeros(T, n, n-npres)
410-
tGred = zeros(T, n-npres, n)
411-
gpuGred = zeros(T, n, n-npres)
412-
Gls = zeros(T, n-npres, n-npres)
409+
# Gred = zeros(T, n, n-npres)
410+
# tGred = zeros(T, n-npres, n)
411+
# gpuGred = zeros(T, n, n-npres)
412+
# Gls = zeros(T, n-npres, n-npres)
413413
RHS = zeros(T, n)
414-
RHSls = zeros(T, n-npres)
414+
# RHSls = zeros(T, n-npres)
415+
416+
Gammals = nothing
417+
Gred = nothing
418+
tGred = nothing
419+
gpuGred = nothing
420+
Gls = nothing
421+
RHSls = nothing
415422

416423
return (; Gamma, Gammals, G, Gred, tGred, gpuGred, Gls, RHS, RHSls)
417424
end

0 commit comments

Comments
 (0)