Repository navigation
fix(compositional): stop a rate well's BHP at its limit and on its flowing side (#163, #175) - #178
Conversation
…owing side (#163, #175) A rate-controlled well's BHP update had one fraction-to-boundary bound, 0.99 of the gap to its limit, applied to the whole Newton step, and no bound relative to its completions. #175: a well the linearization kept pushing past its limit crept onto it, each step 1% of the remaining gap, until the gap rounded to zero and the step bound collapsed. The step now stops where the BHP reaches the limit and lands on it exactly; a well already on its limit whose update points past it is held there on BHP control and the direction is solved again. #163: nothing kept a producer's BHP below its completions' connection pressures (an injector's above). Past that edge a completion carries no flow, the rate row's d(rate)/d(bhp) is zero and cannot be eliminated, and a multi-completion well crossflows. The stepped BHP alone is now put 99% of the way from where it was to that edge; the cells keep their step. One-cell rate-producer sweep (comp_newton_rate_producer_sweep, 1944 solves): converged 1659 -> 1927; singular rate rows 163 -> 0; collapsed step bounds 122 -> 0; every remaining failure also failed before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rate in the BHP start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eplay floor to it (#163, #164) The rate-well fix (#163/#175) takes the SPE3 replay down a path with 5 failed attempts in years 1-8 instead of 54, but the path reaches a state at 2937.21875 d (year 9 of cycling) where every attempt fails on the #164 separator stability trial, before the 4109.0625 d where the previous path met it. Justification for lowering RECORDED_REACH_DAYS from 4109.0625 to 2937.21875 d: the new end is the same defect, not a new one. From the frozen 2937.21875 d state, the engine before #163/#175 (7518d04) and after it fail identically: ten attempts, each at its first assembly before any Newton step, all on the producer's separator flash with the same residual (1.93e-28) and K norm (278.76). How far the run gets before #164 is path luck, so the floor follows the path the merged engine takes, and #164 stays the hard wall for both. Both seeds stay: stall_4109.json still reproduces its failure, and stall_2937.json gets its own test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…5 replays (#163, #175) COMPOSITIONAL_WELL_DESIGN.md gains "The BHP update": the limit stops the step exactly and holds a well that stays on it; the connection pressures only clip the stepped BHP. It records the one-cell sweep and the two-completion infeasibility trade-off. SPE3_VALIDATION.md keeps the c41a6b3 record (the only one reaching the 2500 psia crossing #96 needs) and adds the replay on 2b7e6c6: fails at 2937.21875 d on #164, from a state the previous engine fails identically; failed attempts in years 1-8 fall from 54 to 5. SPE5_VALIDATION.md: same shut-in stop and report; its four failed attempts were the #175 creep and are gone; water cut 0.8344891317395606, native and WASM alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e evaluates (#163, #175) The flowing-side clip judged a BHP by `p_cell - head`, but the source term evaluates `p_cell - (bhp + head)`. One ulp short of the edge the clipped `from + 0.99 (edge - from)` rounded back onto it: a 100 bar cell with an 8 bar head, stepped from 92⁻ to 93, landed on exactly 92, where the potential is zero and so is d(rate)/d(bhp). The clip now tests every completion with the source's own expression and steps back one ulp at a time to the first BHP that still flows. Any BHP that flowed before is returned unchanged; the 1,944-case rate-producer sweep is identical (1,927 converged, 17 not). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…109 d (#163, #164) The 2937.21875 d floor is justified only by the separator stability failure the rate-well fix exposed earlier. A default replay that stops before the previous 4109.0625 d reach must now stop on that failure (`well PROD: surface flash failed: ... LiquidLike trial did not converge`); any other early stop fails the test. The seed tests share the same message constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e bounds (#163, #175) "Moves less than 99% of the way to its limit" read as a property of the direction; what decides bit-identity is whether the old 99% well bound or the new completion clip activated on an iteration. Once either did, the step is 1/0.99 longer, held and re-solved, or clipped, and the rest of the solve takes a different Newton path. State that in the module docs and the design doc, and record the SPE5 shut-in water cut (0.8344920492842325 -> 0.8344891317395606) as the deliberate exception to #163's bit-identity acceptance. The design doc also notes that the clip judges flow by the source term's own potential. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sing (#163, #164) The roadmap still gave 4109 d as where SPE3 fails and used the later datum crossing to scope #96. Since #163/#175 the replay stops at 2937.21875 d on #164; the crossing at 3743.8125-3774.25 d comes from the c41a6b3 replay and is labelled as such until #164 lets the current engine get past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review round (Codex findings), all on this branch at P2 — the BHP clip can still zero the rate row (
P2 — require the known failure when SPE3 stops early (
P2 — resolve the bit-identity acceptance (
P3 — ROADMAP line 141 — fixed in Gates on
|
…e, with a bounded search (#163, #175) Two holes in the flowing-side clip, both found in review: - It compared a BHP with the rounded edge `p_cell - head` before asking the source. At 80.01 bar and a -18.9 bar head the edge rounds to 98.91 bar, where the source still draws 1.4e-14 bar, so a flowing stepped BHP was rejected and pulled down. Now `p_cell - (bhp + head)` alone decides whether the stepped BHP is kept and whether the starting BHP can anchor the clip. - It walked one ulp at a time back from the 99% point, and the anchor it fell back to need not flow. With a 2^40 bar cell and a 2^40 - 1 bar head no BHP in an injector's [1, 1 + 2^-14] bar interval injects, and the walk took 2.7e11 steps to return the limit. Now the interval's flowing end is checked first (the limit is returned at once if it does not flow) and the search bisects between the anchor and the 99% point. The potential never increases with the BHP, so the bisection finds the same BHP the walk did. Both have a named test; the 1,944-case rate-producer sweep is unchanged (1,927 converged, 17 not). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unds it covers (#163, #175) The old well bound also damped the step 99% of the way to both ends of the absolute BHP search interval, not only to the control limit: a producer moving from 1999 to 2001 bar was scaled to 0.495 and now takes the cells' full step with only the BHP clamped. List that case with the others that change the Newton path, and stop saying the converged answer moves "within the Newton tolerance": the tolerance bounds each path's scaled residual, and any bound on how far pressure, water cut or other outputs move needs its own evidence. The design doc also describes the clip's bisection and its no-flow return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review round 2 (Codex findings), on this branch at P2: bound the search for a flowing BHP (
P2: preserve an already-flowing BHP. Fixed in the same commit, because both changes rewrite the same function. The source potential
P3: state the limits of the bit-identity claim. Fixed in Gates on
|
Summary
compositional/newton.rs):d(rate)/d(bhp)is exactly zero or the well crossflows. The cells keep their step. (Compositional rate producer: a BHP Newton update above the completion pressures makes the rate row singular (SPE3 failed attempts) #163)docs/COMPOSITIONAL_WELL_DESIGN.md→ The BHP update.Closes #163
Closes #175
How each acceptance item is met:
comp_newton_a_rate_producer_bhp_update_stays_below_its_completion(the issue's one-cell reproduction), plus two two-completion tests (singular-row and crossflow cases picked from a sweep where they fail onmaster).docs/SPE3_VALIDATION.md: years 1–8 go from 54 to 5, and years 1–3 from 6 / 26 / 14 to 0 / 0 / 0.masterwere all the Compositional Newton fails when the step bound collapses at a rate-controlled well's BHP limit #175 creep (a probe printed each Newton failure: step scales 0.0034, 3.4e-5, 3.4e-7…). It now stops on the same day and report for the same reason, with 0 failed attempts and water cut 0.8344891317395606 (−2.9e-6). Recorded indocs/SPE5_VALIDATION.md.comp_newton_a_rate_producer_on_its_bhp_limit_still_steps(LastAccepted; also asserts the re-solve happened) andcomp_newton_a_rate_producer_does_not_creep_onto_its_bhp_limit(default start).SPE3 regression in reach, by owner decision. The new path meets #164 earlier: the replay now fails at 2937.21875 d (year 9) instead of 4109.0625 d. Stepping that frozen state on
7518d043(master) fails identically: ten attempts, each at its first assembly before any Newton step, with the same residual (1.93e-28) and K norm. So it is #164, met sooner by a different path, not a new failure. As decided in the session, the state is frozen asstall_2937.jsonwith its own seed test, and the replay floor moved to 2937.21875 d with that justification in the commit. #164 is now the wall at year 9.Validation
bash scripts/validate-compositional.sh all:compositional gate 'all': OK(comp_newton_27,comp_well_36; fixture, reference and records reproduce; wasm compiles)bash scripts/validate-cross-solver.sh:cross-solver check: OK, inventory check OKbash scripts/benchmarks.sh check:benchmark check: OK, pages in syncpnpm run validate:product: 92 files / 1,145 tests passed, IMPES bucket OKcomp_spe5_case1_stops_at_the_published_shut_in(release,0b7b8b87): 6285.34375 d, report 1239, water cut; 1,239 steps, 0 failed, 6,226 Newton, 909 sSPE5_WASM_REPLAY=1,2b7e6c67): same stop, water cut 0.8344891317395606, bit for bit with native, 1,207 scomp_spe3_full_horizon_replay(release,2b7e6c67; first run on0b7b8b87identical): reaches 2937.21875 d; balance ≤ 3.53e-11; 1,546 scomp_spe3_seed_(both seeds) andcomp_spe5_from_scratch_218_seed_reproduces_signature_b: passcomp_newton_rate_producer_sweep(new, ignored diagnostic): 1,944 one-cell solves; converged 1,659 → 1,927, singular rate rows 163 → 0, collapsed bounds 122 → 0; all 17 remaining failures also failed beforeCOMPOSITIONAL_WELL_DESIGN.md,SPE3_VALIDATION.md,SPE5_VALIDATION.mdNot run, and why:
validate-solver-coverage.sh, because no black-oil or shared engine code is touched (compositional/only). The other ignored #116 SPE5 diagnostics were not run (no gate selects them); one of them, signature B, was spot-checked and passes.Numbers
Yes: solver behaviour and two replay records.
SPE5_VALIDATION.md; the earlier table is kept as recorded.RECORDED_REACH_DAYSfloor moved in2b7e6c67, with justification.benchmarks.sh checkand the compositional records match.Also fixed
41403657starting_well_bhpused amatches!that re-spellsWellControl::is_rate().Follow-up issues
Decisions made on the owner's behalf
CollapsedBoundSite::Well(added by Compositional Newton's collapsed-step-bound error always names cell 0 #172) is removed: a well can no longer collapse the step bound.🤖 Generated with Claude Code