Skip to content

Commit c9d0686

Browse files
committed
Fix allocations
1 parent d203cd1 commit c9d0686

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/solver.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ function gamma_loop!(
445445
cl_array = cache[8][gamma]
446446
damp = cache[9][cl_array]
447447
v_normal_array = cache[10][cl_array]
448-
v_tangential_array = cache[11][v_normal_array]
448+
v_tangential_array = cache[11][cl_array]
449449

450450
AIC_x, AIC_y, AIC_z = body_aero.AIC[1, :, :], body_aero.AIC[2, :, :], body_aero.AIC[3, :, :]
451451

@@ -501,11 +501,11 @@ function gamma_loop!(
501501
end
502502

503503
if solver.solver_type == LOOP
504-
function f_loop!(gamma_new, gamma)
504+
function f_loop!(gamma_new, gamma, damp)
505505
calc_gamma_new!(gamma_new, gamma)
506506
# Update gamma with relaxation and damping
507-
gamma_new .= (1 - relaxation_factor) .* gamma .+
508-
relaxation_factor .* gamma_new .+ damp
507+
@. gamma_new = (1 - relaxation_factor) * gamma +
508+
relaxation_factor * gamma_new + damp
509509

510510
# Apply damping if needed
511511
if solver.is_with_artificial_damping
@@ -515,12 +515,13 @@ function gamma_loop!(
515515
damp .= 0.0
516516
is_damping_applied = false
517517
end
518+
nothing
518519
end
519520
iters = 0
520521
for i in 1:solver.max_iterations
521522
iters += 1
522523

523-
f_loop!(solver.lr.gamma_new, gamma)
524+
f_loop!(solver.lr.gamma_new, gamma, damp)
524525

525526
# Check convergence
526527
abs_gamma_new .= abs.(solver.lr.gamma_new)

0 commit comments

Comments
 (0)