Some checks failed
CI / check (push) Has been cancelled
Capture uncommitted solver robustness work (regularization, domain errors, linear solver lifecycle, tube DP/MSH), web workbench updates, and synced BMAD skills across IDE agent folders before starting BPHX pressure-drop. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
//! Phase-0 benchmark: dense LU solve on an assembled Jacobian.
|
|
//!
|
|
//! The Jacobian is taken from the deterministic mock refrigeration cycle so the
|
|
//! benchmark is independent of the heavy CoolProp backend and measures only the
|
|
//! linear algebra path used by the Newton solver (Ruiz equilibration + LU).
|
|
|
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
|
|
|
mod common;
|
|
|
|
fn bench_lu_solve(c: &mut Criterion) {
|
|
let (system, state) = common::build_mock_system();
|
|
let jacobian = common::assemble_jacobian(&system, &state);
|
|
|
|
// Residual vector at the analytical solution is non-zero for the mock
|
|
// components because they read from fixed ports, not from the state slice.
|
|
// We therefore benchmark the LU solve with a representative RHS.
|
|
let residuals: Vec<f64> = (0..jacobian.nrows())
|
|
.map(|i| state[i].sin() * 1e-3)
|
|
.collect();
|
|
|
|
c.bench_function("lu_solve_mock_9x9", |b| {
|
|
b.iter(|| {
|
|
black_box(jacobian.solve(&residuals));
|
|
});
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, bench_lu_solve);
|
|
criterion_main!(benches);
|