Snapshot WIP: solver HP epic progress, BPHX/HX physics, BMAD skill refresh.
Some checks failed
CI / check (push) Has been cancelled
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>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
use approx::assert_relative_eq;
|
||||
use entropyk_solver::{
|
||||
system::{DEFAULT_MASS_FLOW_SEED_KG_S, MIN_SOLVER_PRESSURE_PA},
|
||||
CircuitConvergence, ConvergedState, ConvergenceCriteria, ConvergenceReport, ConvergenceStatus,
|
||||
FallbackSolver, NewtonConfig, PicardConfig, Solver, System,
|
||||
};
|
||||
@@ -241,6 +242,7 @@ fn test_single_circuit_global_convergence() {
|
||||
use entropyk_components::port::ConnectedPort;
|
||||
use entropyk_components::{Component, ComponentError, JacobianBuilder, ResidualVector, StateSlice};
|
||||
|
||||
/// CM1.3 self-loop mock: 3 equations constraining (ṁ, P, h) on a single edge.
|
||||
struct MockConvergingComponent;
|
||||
|
||||
impl Component for MockConvergingComponent {
|
||||
@@ -249,10 +251,12 @@ impl Component for MockConvergingComponent {
|
||||
state: &StateSlice,
|
||||
residuals: &mut ResidualVector,
|
||||
) -> Result<(), ComponentError> {
|
||||
// CM1.2: per-edge layout is (ṁ, P, h); index 0 is ṁ (pinned by the
|
||||
// mass-flow closure), so this mock constrains P (index 1) and h (index 2).
|
||||
residuals[0] = state[1] - 5.0;
|
||||
residuals[1] = state[2] - 10.0;
|
||||
// Pin P at the solver pressure floor (reachable under Newton clipping),
|
||||
// h at a matching abstract target, and ṁ at the canonical seed so the
|
||||
// single-edge self-loop is square (3 unknowns = 3 equations).
|
||||
residuals[0] = state[1] - MIN_SOLVER_PRESSURE_PA;
|
||||
residuals[1] = state[2] - MIN_SOLVER_PRESSURE_PA;
|
||||
residuals[2] = state[0] - DEFAULT_MASS_FLOW_SEED_KG_S;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -263,11 +267,12 @@ impl Component for MockConvergingComponent {
|
||||
) -> Result<(), ComponentError> {
|
||||
jacobian.add_entry(0, 1, 1.0);
|
||||
jacobian.add_entry(1, 2, 1.0);
|
||||
jacobian.add_entry(2, 0, 1.0);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn n_equations(&self) -> usize {
|
||||
2
|
||||
3
|
||||
}
|
||||
fn get_ports(&self) -> &[ConnectedPort] {
|
||||
&[]
|
||||
@@ -278,8 +283,7 @@ impl Component for MockConvergingComponent {
|
||||
fn test_newton_with_criteria_single_circuit() {
|
||||
let mut sys = System::new();
|
||||
let node1 = sys.add_component(Box::new(MockConvergingComponent));
|
||||
let node2 = sys.add_component(Box::new(MockConvergingComponent));
|
||||
sys.add_edge(node1, node2).unwrap();
|
||||
sys.add_edge(node1, node1).unwrap();
|
||||
sys.finalize().unwrap();
|
||||
|
||||
let criteria = ConvergenceCriteria {
|
||||
|
||||
Reference in New Issue
Block a user