Symptom
A run chained across restarts is not the same run as the unrestarted one, even with #1887 applied. The difference is small but systematic and does not decay.
Cause
For geometries whose working centroid is moved to the measured centre of mass (4, 5, 11, 12), centroid_offset is measured by voxelising the body — see s_compute_centroid_offset, which sums cell centres where ib_markers is set. On a restart that measurement is repeated with the body at its restart attitude, not the attitude it had at t = 0.
Voxelisation is attitude-dependent, so the offset comes out slightly different, and the prescribed kinematics — which rotate about the hinge and place the centroid relative to it using centroid_offset — then run about a slightly different point than the run being continued.
Fix
Write the offsets the run is actually using alongside the checkpoint and restore them instead of re-measuring. We write one line per global patch (gid ox oy oz) to restart_data/ib_offset_<step>.dat at each save and restore them on restart; when the file is absent the current behaviour stands, so old checkpoints keep working.
Companion to #1887, which fixed the other half of restart continuity (the stale device num_gps). With both, a mid-beat restart of a flapping wing matches the unrestarted run to 1e-13 at +105 steps.
Found with Claude Code on OLCF Frontier.
Symptom
A run chained across restarts is not the same run as the unrestarted one, even with #1887 applied. The difference is small but systematic and does not decay.
Cause
For geometries whose working centroid is moved to the measured centre of mass (4, 5, 11, 12),
centroid_offsetis measured by voxelising the body — sees_compute_centroid_offset, which sums cell centres whereib_markersis set. On a restart that measurement is repeated with the body at its restart attitude, not the attitude it had att = 0.Voxelisation is attitude-dependent, so the offset comes out slightly different, and the prescribed kinematics — which rotate about the hinge and place the centroid relative to it using
centroid_offset— then run about a slightly different point than the run being continued.Fix
Write the offsets the run is actually using alongside the checkpoint and restore them instead of re-measuring. We write one line per global patch (
gid ox oy oz) torestart_data/ib_offset_<step>.datat each save and restore them on restart; when the file is absent the current behaviour stands, so old checkpoints keep working.Companion to #1887, which fixed the other half of restart continuity (the stale device
num_gps). With both, a mid-beat restart of a flapping wing matches the unrestarted run to 1e-13 at +105 steps.Found with Claude Code on OLCF Frontier.