@@ -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 )
190186end
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
537529end
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
635532function save_curr_state (sim:: SingleDomainSimulation )
636533 integrator = sim. integrator
0 commit comments