Skip to content

Commit daa7f6d

Browse files
committed
Now 340 allocations
1 parent 8c5ebbd commit daa7f6d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/body_aerodynamics.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ function calculate_stall_angle_list(panels::Vector{Panel};
412412
return stall_angles
413413
end
414414

415-
const cache_body = [LazyBufferCache(), LazyBufferCache(), LazyBufferCache(), LazyBufferCache()]
415+
const cache_body = [LazyBufferCache(), LazyBufferCache(), LazyBufferCache(), LazyBufferCache(),
416+
LazyBufferCache()]
416417

417418
"""
418419
update_effective_angle_of_attack_if_VSM(body_aero::BodyAerodynamics, gamma::Vector{Float64},
@@ -449,12 +450,13 @@ function update_effective_angle_of_attack!(alpha_corrected,
449450
induced_velocity[:, 3] .= AIC_z * gamma
450451

451452
# In-place relative velocity calculation
452-
relative_velocity = va_array .+ induced_velocity
453+
relative_velocity = cache_body[2][va_array]
454+
relative_velocity .= va_array .+ induced_velocity
453455

454456
# Preallocate and compute dot products manually
455457
n = size(relative_velocity, 1)
456-
v_normal = cache_body[2][relative_velocity]
457-
v_tangential = cache_body[3][relative_velocity]
458+
v_normal = cache_body[3][relative_velocity]
459+
v_tangential = cache_body[4][relative_velocity]
458460

459461
@inbounds for i in 1:n
460462
vn = 0.0

0 commit comments

Comments
 (0)