rtx-cfd/rtx-fsi: overset A-P0 GATED + M1 precision probe — curvilinear collocated PISO: relative-reduction pressure stop (the absolute stop floored |du/dt| at 2e-4 on 64²), line-implicit-n sign fix, adjustPhi; gates: Cartesian reduction 1.37–1.40x the staggered error at orders 0.83/0.90; skewed stretched periodic annulus Stokes orders 2.30/2.06 (explicit and line-implicit), upwind 1.08/0.80; Poiseuille exact to 1e-9 on Cartesian and affine-sheared periodic channels (both diffusion variants), varying-skew channel order 2.02 (v 1.9), cell mass 1e-14; divergence ≤ 1e-11 relative every step; snapshot/restore bit-identical. M1: poisson.rs multigrid hierarchy generic over MgScalar (f32/f64), f64 CG keeps its own fine level; MgPrecision on MultigridParameters/EmbeddedParameters/PisoParameters, set_poisson_precision, harness RTX_FSI2_POISSON_F32 (march + noise probe, printed marker); f64 arm bit-identical in vivo (FSI2 default line-for-line with 08-31), f32 arm holds the noise floor and stall pins and the FSI2 band; poisson_equivalence f32 arm
Performance Benchmarks / Run Benchmarks (push) Canceled after 0s
CI / Format Check (push) Canceled after 0s
Documentation / Build API Documentation (push) Canceled after 0s
Documentation / Build User Guide (push) Canceled after 0s
CI / Clippy Check (push) Canceled after 0s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Build CPU-Only (Explicit) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
Performance Benchmarks / Run Benchmarks (push) Canceled after 0s
CI / Format Check (push) Canceled after 0s
Documentation / Build API Documentation (push) Canceled after 0s
Documentation / Build User Guide (push) Canceled after 0s
CI / Clippy Check (push) Canceled after 0s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Build CPU-Only (Explicit) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01X2GmJXeQ2njUecEKiJZ1G2
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
52da75a3a9
commit
c63d79c300
@@ -30,8 +30,8 @@
|
||||
|
||||
use rtx_cfd::solvers::incompressible::{
|
||||
AleBoundaries, BoundaryConditions, EmbeddedBody, EmbeddedParameters, EmbeddedPisoSolver,
|
||||
FaceKind, FlowField, IncompressibleSolver, PisoParameters, PisoSolver, PoissonSolverKind,
|
||||
SideBoundary,
|
||||
FaceKind, FlowField, IncompressibleSolver, MgPrecision, PisoParameters, PisoSolver,
|
||||
PoissonSolverKind, SideBoundary,
|
||||
};
|
||||
use rtx_cfd::{CfdConfig, CfdResult};
|
||||
use std::f64::consts::PI;
|
||||
@@ -128,6 +128,7 @@ async fn piso_mms(n: usize, kind: PoissonSolverKind) -> CfdResult<SteadyMeasurem
|
||||
time_step: dt,
|
||||
tolerance: 1e-8,
|
||||
poisson_solver: kind,
|
||||
poisson_precision: rtx_cfd::solvers::incompressible::MgPrecision::F64,
|
||||
},
|
||||
)?;
|
||||
solver.set_momentum_source(source);
|
||||
@@ -291,6 +292,7 @@ async fn taylor_green(n: usize, kind: PoissonSolverKind) -> CfdResult<TaylorGree
|
||||
time_step: dt,
|
||||
tolerance: 1e-9,
|
||||
poisson_solver: kind,
|
||||
poisson_precision: rtx_cfd::solvers::incompressible::MgPrecision::F64,
|
||||
},
|
||||
)?;
|
||||
|
||||
@@ -418,6 +420,16 @@ fn mms_initial_field(n: usize) -> CfdResult<FlowField> {
|
||||
/// `tests/embedded_mms.rs::measure`, velocity error and divergence only,
|
||||
/// with the inner solver selectable.
|
||||
async fn embedded_mms(n: usize, kind: PoissonSolverKind) -> CfdResult<SteadyMeasurement> {
|
||||
embedded_mms_with(n, kind, MgPrecision::F64).await
|
||||
}
|
||||
|
||||
/// `embedded_mms` with the multigrid V-cycle precision selectable (the M1
|
||||
/// precision probe of `overset_metal_campaign.md` §3.2).
|
||||
async fn embedded_mms_with(
|
||||
n: usize,
|
||||
kind: PoissonSolverKind,
|
||||
precision: MgPrecision,
|
||||
) -> CfdResult<SteadyMeasurement> {
|
||||
let dx = 1.0 / n as f64;
|
||||
let dt = mms_time_step(n);
|
||||
let mut solver = EmbeddedPisoSolver::new(
|
||||
@@ -426,6 +438,7 @@ async fn embedded_mms(n: usize, kind: PoissonSolverKind) -> CfdResult<SteadyMeas
|
||||
corrector_steps: 2,
|
||||
tolerance: 1e-8,
|
||||
poisson_solver: kind,
|
||||
poisson_precision: precision,
|
||||
..EmbeddedParameters::default()
|
||||
},
|
||||
)?;
|
||||
@@ -526,6 +539,44 @@ async fn embedded_circle_steady_state_is_solver_independent() -> CfdResult<()> {
|
||||
/// solver assembles exactly the fixed-grid PISO's `PoissonProblem` (all
|
||||
/// cells active, anchor `(1, 1)`, no outlet), so the fields must still agree
|
||||
/// to the bit.
|
||||
/// M1 precision probe (`overset_metal_campaign.md` §3.2 M1, §5.2): with
|
||||
/// the V-cycle in single precision inside the f64 conjugate gradient, the
|
||||
/// embedded-circle steady state must be the same field to the projection
|
||||
/// stop — the f64 CG owns the true residual, so the preconditioner's
|
||||
/// precision may cost iterations, never accuracy. The measured gap is
|
||||
/// printed; the assert is at the tolerance scale, not at f32 eps.
|
||||
#[tokio::test]
|
||||
async fn embedded_circle_steady_state_survives_an_f32_vcycle() -> CfdResult<()> {
|
||||
let n = 32;
|
||||
let f64_arm = embedded_mms_with(n, PoissonSolverKind::Multigrid, MgPrecision::F64).await?;
|
||||
let f32_arm = embedded_mms_with(n, PoissonSolverKind::Multigrid, MgPrecision::F32).await?;
|
||||
println!(
|
||||
"f32 V-cycle vs f64: L2 error {:.6e} vs {:.6e} (rel {:.2e}), max div {:.2e} vs {:.2e}, \
|
||||
steps {} vs {}, wall {:.2} s vs {:.2} s",
|
||||
f32_arm.l2_velocity,
|
||||
f64_arm.l2_velocity,
|
||||
rel(f32_arm.l2_velocity, f64_arm.l2_velocity),
|
||||
f32_arm.max_div,
|
||||
f64_arm.max_div,
|
||||
f32_arm.steps,
|
||||
f64_arm.steps,
|
||||
f32_arm.seconds,
|
||||
f64_arm.seconds
|
||||
);
|
||||
assert!(
|
||||
rel(f32_arm.l2_velocity, f64_arm.l2_velocity) < 1e-5,
|
||||
"f32 V-cycle changed the steady error: {:.6e} vs {:.6e}",
|
||||
f32_arm.l2_velocity,
|
||||
f64_arm.l2_velocity
|
||||
);
|
||||
assert!(
|
||||
f32_arm.max_div < 1e-5,
|
||||
"divergence with the f32 V-cycle {:.3e}",
|
||||
f32_arm.max_div
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn without_a_body_the_embedded_solver_is_piso_to_the_bit_with_multigrid() -> CfdResult<()> {
|
||||
let n = 16;
|
||||
@@ -537,6 +588,7 @@ async fn without_a_body_the_embedded_solver_is_piso_to_the_bit_with_multigrid()
|
||||
time_step: dt,
|
||||
tolerance: 1e-8,
|
||||
poisson_solver: PoissonSolverKind::Multigrid,
|
||||
poisson_precision: rtx_cfd::solvers::incompressible::MgPrecision::F64,
|
||||
},
|
||||
)?;
|
||||
piso.set_momentum_source(source);
|
||||
@@ -547,6 +599,7 @@ async fn without_a_body_the_embedded_solver_is_piso_to_the_bit_with_multigrid()
|
||||
corrector_steps: 2,
|
||||
tolerance: 1e-8,
|
||||
poisson_solver: PoissonSolverKind::Multigrid,
|
||||
poisson_precision: rtx_cfd::solvers::incompressible::MgPrecision::F64,
|
||||
..EmbeddedParameters::default()
|
||||
},
|
||||
)?;
|
||||
@@ -611,6 +664,7 @@ async fn channel_with_circle(kind: PoissonSolverKind) -> CfdResult<(FlowField, u
|
||||
top: SideBoundary::Velocity,
|
||||
},
|
||||
poisson_solver: kind,
|
||||
poisson_precision: rtx_cfd::solvers::incompressible::MgPrecision::F64,
|
||||
..EmbeddedParameters::default()
|
||||
},
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user