← all records

Physics Driver refactor

pitch-7c3d41 · in warm_bubble

  • No No-gos section. The pitch template asks for one — it is what keeps the appetite honest.

Problem

The two-layer refactor (#1436) already gives the physics driver what it needed: the components couple in parallel, the driver reads the model state once per step so every process computes from the same frozen input, and a tendency accumulator applies everything once at the end, which simplifies the halo exchange.

One thing remains. Each process's diagnostic output still lives in a buffer the component allocates privately, and the driver's diagnostics store is only an alias into them.

What we want: one buffer per diagnostic field, created and owned by the physics layer and passed to the component, so the component writes its results directly into it.

Appetite

One cycle, two weeks of it. The base refactor is implemented and validated -- the v08 driver datatest passes in assert mode with measured tolerances and muphys-equivalence is proven -- so the budget goes to the diagnostics-ownership extension, the review, and landing the stack #1359 <- #1436 <- #1360.

Solution

A DiagnosticsStore in the PhysicsState layer creates and owns one buffer per diagnostic (non-tendency) output. It takes each buffer's shape from the output's FieldMetaData, so the missing dims metadata is added to all fourteen diagnostic outputs. When the driver is constructed the store hands these buffers to the component, and the component writes into them. A component run on its own still creates its own.

Rabbit holes

Do not touch tendency ownership: the tend_* buffers stay per-component, because the accumulators sum across processes and recycling needs each process's last tendency.

Do not grow the common Component protocol here.

No-gos

Progress

  • Two-layer design agreed -- parallel coupling, no copies -- and implemented as #1436, based on main
  • tmx integrated on top as #1360; the v08 datatest passes in assert mode, tolerances measured and tightened against prescribed surface fluxes
  • Diagnostics ownership: dims metadata, DiagnosticsStore, bind_output_buffers
  • PR descriptions refreshed, then review and merge of #1359 <- #1436 <- #1360