From 3eb40f98cedda91a7ea018ad2e18372b16105036 Mon Sep 17 00:00:00 2001 From: Omar Sobh Date: Thu, 17 Sep 2026 23:19:07 -0500 Subject: [PATCH] embedded3: the flag driver logs the reconstructed wall route per sample and in the final read Co-Authored-By: Claude Fable 5.1 --- .../rtx-cfd/tests/embedded3_flag_wake.rs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/crates/specialized/rtx-cfd/tests/embedded3_flag_wake.rs b/crates/specialized/rtx-cfd/tests/embedded3_flag_wake.rs index 2e6b43d..55740da 100644 --- a/crates/specialized/rtx-cfd/tests/embedded3_flag_wake.rs +++ b/crates/specialized/rtx-cfd/tests/embedded3_flag_wake.rs @@ -202,7 +202,7 @@ fn flag_wake_on_the_device() { let mut f = std::fs::File::create(p).expect("csv"); writeln!( f, - "t,tip,drag_span,lift_span,drag_total,lift_total,residual,cg,fresh" + "t,tip,drag_span,lift_span,drag_total,lift_total,residual,cg,fresh,drag_rec,lift_rec" ) .unwrap(); f @@ -214,6 +214,7 @@ fn flag_wake_on_the_device() { let mid = nz / 2; let slab = (mid - 2, mid + 2); let start = std::time::Instant::now(); + let mut drag_rec_sum = 0.0; let (mut drag_sum, mut lift_min, mut lift_max, mut samples) = (0.0, f64::INFINITY, f64::NEG_INFINITY, 0usize); let mut worst_residual = 0.0_f64; @@ -234,15 +235,25 @@ fn flag_wake_on_the_device() { let fs = mask .cut_wall_force_per_span(body, &field, RHO * NU, t, slab) .expect("wall"); + // The reconstructed wall route on the same slab, per span. + let fr = mask + .cut_wall_force_reconstructed(body, &field, RHO * NU, t, Some(slab)) + .map(|v| { + let lz = (slab.1 - slab.0) as f64 * h; + [v[0] / lz, v[1] / lz, v[2] / lz] + }) + .expect("reconstructed"); let ft = mask .cut_wall_force(body, &field, RHO * NU, t) .expect("wall"); let tip = deflection(1.0, t).0; if sample { println!( - " t {t:7.4} (tip {tip:+.4}): drag/span {:.1} lift/span {:+.1} N/m; total {:.3} {:+.3} N; residual {:.1e} CG {} fresh {}; [{:.0} s]", + " t {t:7.4} (tip {tip:+.4}): drag/span {:.1} lift/span {:+.1} N/m (reconstructed {:.1} {:+.1}); total {:.3} {:+.3} N; residual {:.1e} CG {} fresh {}; [{:.0} s]", fs[0], fs[1], + fr[0], + fr[1], ft[0], ft[1], r.final_residual, @@ -253,19 +264,22 @@ fn flag_wake_on_the_device() { if let Some(f) = csv.as_mut() { writeln!( f, - "{t:.5},{tip:.5},{:.4},{:.4},{:.5},{:.5},{:.3e},{},{}", + "{t:.5},{tip:.5},{:.4},{:.4},{:.5},{:.5},{:.3e},{},{},{:.4},{:.4}", fs[0], fs[1], ft[0], ft[1], r.final_residual, r.poisson_iterations, - r.fresh_cells + r.fresh_cells, + fr[0], + fr[1] ) .unwrap(); } if t >= last_period_start { drag_sum += fs[0]; + drag_rec_sum += fr[0]; lift_min = lift_min.min(fs[1]); lift_max = lift_max.max(fs[1]); samples += 1; @@ -281,8 +295,9 @@ fn flag_wake_on_the_device() { } } let drag_mean = drag_sum / samples.max(1) as f64; + let drag_rec = drag_rec_sum / samples.max(1) as f64; println!( - " FINAL ny {ny}: last period drag/span mean {drag_mean:.1} N/m (2D FSI2 224.6), lift/span {lift_min:+.1} … {lift_max:+.1} (2D ±215 flat tip, ±256 semicircle); worst residual {worst_residual:.1e}; {} phases written; {:.0} s", + " FINAL ny {ny}: last period drag/span mean {drag_mean:.1} N/m (reconstructed {drag_rec:.1}; 2D FSI2 224.6, the 2D reference of this kinematics 208.3), lift/span {lift_min:+.1} … {lift_max:+.1} (2D ±215 flat tip, ±256 semicircle); worst residual {worst_residual:.1e}; {} phases written; {:.0} s", next_phase, start.elapsed().as_secs_f64() );