R8-a harness: RTX_E3FSI_RESTORE_CHECK (re-run the accepted candidate from the snapshot)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-09-25 18:15:42 -05:00
co-authored by Claude Opus 5.5
parent 0f386df871
commit 11fff74c3d
@@ -247,6 +247,7 @@ fn fsi2_on_embedded3() {
let speed = env_f("RTX_E3FSI_SPEED", 3.0); let speed = env_f("RTX_E3FSI_SPEED", 3.0);
let trace = env_f("RTX_E3FSI_TRACE", 0.0) as usize; let trace = env_f("RTX_E3FSI_TRACE", 0.0) as usize;
let csv_path = std::env::var("RTX_E3FSI_CSV").ok(); let csv_path = std::env::var("RTX_E3FSI_CSV").ok();
let restore_check = env_f("RTX_E3FSI_RESTORE_CHECK", 0.0) as usize;
let case = FSI2; let case = FSI2;
let mesh = flag_mesh(35, 2); let mesh = flag_mesh(35, 2);
@@ -521,7 +522,28 @@ fn fsi2_on_embedded3() {
let acceptable = (stall_accept * tol).max(0.1 * increment); let acceptable = (stall_accept * tol).max(0.1 * increment);
let outcome = Subiterated::aitken(max_subit, tol) let outcome = Subiterated::aitken(max_subit, tol)
.unwrap() .unwrap()
.solve(&predicted, pass); .solve(&predicted, &pass);
// `RTX_E3FSI_RESTORE_CHECK=N`: on the first N steps, the accepted
// candidate re-run from the snapshot (the restore's repeatability).
if step < restore_check && outcome.is_ok() {
let (cand, tot_a, out_a) = {
let l = latest.borrow();
let l = l.as_ref().expect("a pass ran");
(l.3.clone(), l.4, extract(&l.0))
};
let out_b = pass(&cand);
let tot_b = latest.borrow().as_ref().expect("re-run").4;
let dout: f64 = out_a
.iter()
.zip(&out_b)
.map(|(a, b)| (a - b).powi(2))
.sum::<f64>()
.sqrt();
println!(
" RESTORE CHECK step {step}: load a ({:+.9e}, {:+.9e}) b ({:+.9e}, {:+.9e}), |Δ structure output| {dout:.3e}",
tot_a[0], tot_a[1], tot_b[0], tot_b[1]
);
}
let (iters, dres) = match outcome { let (iters, dres) = match outcome {
Ok(c) => (c.iterations, c.residual), Ok(c) => (c.iterations, c.residual),
Err( Err(