Skip to content

Commit 6418327

Browse files
committed
Remove AA code. Doesn't help. Needs more work.
1 parent 90a2ba7 commit 6418327

File tree

9 files changed

+0
-199
lines changed

9 files changed

+0
-199
lines changed

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-anderson10.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-anderson3.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-anderson5.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-predictor-anderson10.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-predictor-anderson3.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/nonoverlap/dynamic-same-step/cuboids-robin-robin/cuboids-predictor-anderson5.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/simulation.jl

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ function SolidMultiDomainTimeController(params::Parameters)
138138
predictor_velo = [Vector{Float64}() for _ in 1:num_domains]
139139
predictor_acce = [Vector{Float64}() for _ in 1:num_domains]
140140
prev_stop_disp = [Vector{Float64}() for _ in 1:num_domains]
141-
anderson_window = get(params, "anderson window", 0)
142-
anderson_x_hist = [Vector{Vector{Float64}}() for _ in 1:num_domains]
143141

144142
return SolidMultiDomainTimeController(
145143
minimum_iterations,
@@ -184,8 +182,6 @@ function SolidMultiDomainTimeController(params::Parameters)
184182
predictor_velo,
185183
predictor_acce,
186184
prev_stop_disp,
187-
anderson_window,
188-
anderson_x_hist,
189185
)
190186
end
191187

@@ -496,7 +492,6 @@ function schwarz(sim::MultiDomainSimulation)
496492
save_stop_state(sim)
497493
save_schwarz_state(sim)
498494
reset_histories(sim)
499-
reset_anderson_history!(sim)
500495
swap_swappable_bcs(sim)
501496
if sim.controller.use_interface_predictor
502497
compute_interface_predictor!(sim)
@@ -529,108 +524,10 @@ function schwarz(sim::MultiDomainSimulation)
529524
end
530525
iteration_number += 1
531526
save_schwarz_state(sim)
532-
if sim.controller.anderson_window > 0
533-
anderson_accelerate!(sim)
534-
end
535527
restore_stop_state(sim)
536528
end
537529
end
538530

539-
function reset_anderson_history!(sim::MultiDomainSimulation)
540-
controller = sim.controller
541-
if controller.anderson_window == 0
542-
return nothing
543-
end
544-
for i in 1:sim.num_domains
545-
empty!(controller.anderson_x_hist[i])
546-
end
547-
return nothing
548-
end
549-
550-
function anderson_accelerate!(sim::MultiDomainSimulation)
551-
controller = sim.controller
552-
m = controller.anderson_window
553-
num_domains = sim.num_domains
554-
for i in 1:num_domains
555-
subsim = sim.subsims[i]
556-
ndofs = length(subsim.integrator.displacement)
557-
# Build current iterate; rotate if inclined support
558-
if subsim.model.inclined_support == true
559-
T = subsim.model.global_transform'
560-
u = T * subsim.integrator.displacement
561-
v = T * subsim.integrator.velocity
562-
a = T * subsim.integrator.acceleration
563-
else
564-
u = copy(subsim.integrator.displacement)
565-
v = copy(subsim.integrator.velocity)
566-
a = copy(subsim.integrator.acceleration)
567-
end
568-
x_k = vcat(u, v, a)
569-
# Anderson prediction is injected into disp_hist[i] so that domains solved
570-
# before domain i in the sequential subcycle read the predicted coupling BC.
571-
# Domain 1 (i==1) is processed first, so its history is cleared by
572-
# reset_history before other domains can benefit — skip injection.
573-
if i == 1
574-
continue
575-
end
576-
# Burn-in: the first few Schwarz iterations exhibit a non-geometric transient
577-
# (both domains "see" each other for the first time), making Anderson
578-
# extrapolation unreliable. Skip until iteration 4 (after the transient).
579-
if controller.iteration_number <= 3
580-
continue
581-
end
582-
# Append to rolling buffer, keep at most m+1 entries
583-
x_hist = controller.anderson_x_hist[i]
584-
push!(x_hist, x_k)
585-
if length(x_hist) > m + 1
586-
popfirst!(x_hist)
587-
end
588-
mk = length(x_hist) - 1 # number of residuals available
589-
# Need at least 2 residuals (3 iterates) to form the ΔF system
590-
if mk < 2
591-
continue
592-
end
593-
# Build ΔF and ΔX: differences of consecutive residuals / iterates
594-
ΔF = Matrix{Float64}(undef, 3 * ndofs, mk - 1)
595-
ΔX = Matrix{Float64}(undef, 3 * ndofs, mk - 1)
596-
for j in 1:(mk - 1)
597-
f_j = x_hist[j + 1] - x_hist[j]
598-
f_jp1 = x_hist[j + 2] - x_hist[j + 1]
599-
ΔF[:, j] = f_jp1 - f_j
600-
ΔX[:, j] = x_hist[j + 2] - x_hist[j + 1]
601-
end
602-
f_cur = x_hist[end] - x_hist[end - 1]
603-
# Solve min_c ||ΔF*c + f_cur||^2 (Walker-Ni type-I Anderson)
604-
c = -(ΔF \ f_cur)
605-
x_new = x_k + ΔX * c
606-
u_new = x_new[1:ndofs]
607-
v_new = x_new[(ndofs + 1):(2 * ndofs)]
608-
a_new = x_new[(2 * ndofs + 1):(3 * ndofs)]
609-
# Rotate back to global frame if inclined support
610-
if subsim.model.inclined_support == true
611-
u_new = subsim.model.global_transform * u_new
612-
v_new = subsim.model.global_transform * v_new
613-
a_new = subsim.model.global_transform * a_new
614-
end
615-
# Overwrite domain i's coupling history with the Anderson prediction.
616-
# Domain i's time_hist[i] is non-empty (set by the previous save_history_snapshot),
617-
# so apply_bc for other domains will use interp(time_hist[i], disp_hist[i], t)
618-
# = u_new instead of the raw Schwarz output.
619-
disp_h = controller.disp_hist[i]
620-
velo_h = controller.velo_hist[i]
621-
acce_h = controller.acce_hist[i]
622-
if !isempty(disp_h)
623-
disp_h[end] = u_new
624-
velo_h[end] = v_new
625-
acce_h[end] = a_new
626-
end
627-
# Clear history after injection so the big-jump iterate (the Anderson prediction)
628-
# does not contaminate subsequent Anderson fits. The next m iterations will rebuild
629-
# a clean history from near-converged iterates before the next injection.
630-
empty!(x_hist)
631-
end
632-
return nothing
633-
end
634531

635532
function save_curr_state(sim::SingleDomainSimulation)
636533
integrator = sim.integrator

src/simulation_types.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ mutable struct SolidMultiDomainTimeController <: MultiDomainTimeController
6060
predictor_velo::Vector{Vector{Float64}}
6161
predictor_acce::Vector{Vector{Float64}}
6262
prev_stop_disp::Vector{Vector{Float64}}
63-
anderson_window::Int64
64-
anderson_x_hist::Vector{Vector{Vector{Float64}}}
6563
end
6664

6765
mutable struct SolidSingleDomainTimeController <: SingleTimeController

test/schwarz-nonoverlap-dynamic-cuboid-robin-robin.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,3 @@ end
6161
@test iters_pred < iters_base
6262
end
6363

64-
@testset "Schwarz Nonoverlap Dynamic Cuboid Hex8 Robin-Robin Anderson Acceleration" begin
65-
sim_base = run_rr_dynamic("cuboids.yaml")
66-
sim_aa = run_rr_dynamic("cuboids.yaml", Dict("anderson window" => 3))
67-
m1 = sim_aa.subsims[1].model
68-
m2 = sim_aa.subsims[2].model
69-
u1z = m1.current[3, :] .- m1.reference[3, :]
70-
u2z = m2.current[3, :] .- m2.reference[3, :]
71-
72-
# Anderson must not degrade physical accuracy
73-
@test maximum(u1z) minimum(u2z) rtol = 1.0e-03
74-
75-
# Applied BC accuracy preserved
76-
@test maximum(u2z) 6.156e-03 rtol = 1.0e-02
77-
78-
# Total iterations within 15% of baseline (Anderson should not significantly worsen)
79-
iters_base = sum(sim_base.controller.schwarz_iters[1:5])
80-
iters_aa = sum(sim_aa.controller.schwarz_iters[1:5])
81-
@test iters_aa round(Int, 1.15 * iters_base)
82-
end

0 commit comments

Comments
 (0)