Repository navigation
fix: the GoSPL coupling after any remesh uses the instantaneous velocity - #112
Merged
Merged
Conversation
use_gospl sends GoSPL each top node's displacement since the last coupling, divided by the interval, and falls back to the instantaneous velocity only when the surface node count changed. But a remesh renumbers every node (renumbering_mesh sorts by x + 1e-3 y + 1e-6 z), so after a remesh that keeps the count, top_nodes[i] can name another node and the "time-averaged" velocity differences unrelated nodes. Re-sorting the top nodes saved in frames 1-11 of gaussian-weakzone-3d-with-gospl.cfg reassigns 174-1459 of 2469-6088 nodes, paired with nodes a median 22-28 km away and up to 3.1 km higher or lower: up to ~480 m/yr against a real 0.015-0.05 m/yr. The guard now compares var.nremesh at the two couplings, which catches every remesh. A restart of that case from frame 5 had 48 remeshes, all of which changed the count, so only the rare count-preserving one behaves differently. The log line says "same count" when it is one, so a run shows whether it happened. make cmp on benchmarks-cores/test-3d-equ-tiny.cfg is bit-exact. The narrow Gaussian weak-zone case to step 20000 gives the same GoSPL summaries as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both READMEs say to build DynEarthSol outside the gospl environment "to keep the compiler off conda's libraries". The build does not depend on it: make -n -B ndims=3 usemmg=1 usegospl=1 gives the same compile and link commands with gospl active and with conda cleared (114 of 114 tokens), because the Makefile reaches GoSPL's Python through CONDA_ENV_PATH, and the executable links into that env's lib either way. The only path from an active env into the build is CONDA_PREFIX in the Boost search (Linux) and the OpenMP search (macOS), so an env that ships its own Boost or compilers is the one case that matters. The advice also did not do what it said: one conda deactivate from gospl leaves base active. Building gospl_extensions still needs the env active, and the run instructions keep activating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sungho91
approved these changes
Nov 1, 2026
sungho91
left a comment
Collaborator
There was a problem hiding this comment.
The fix looks correct to me. Checking the remesh counter addresses the node correspondence problem even when the surface node count remains unchanged. Both the regular and PT-loop remeshing paths are covered, and time averaging resumes at the next coupling if no further remeshing occurs.
I don’t see any major issues with this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A GoSPL-coupled run of
gospl_driver/examples/gaussian-weakzone-3d-with-gospl.cfgafter #95 grew small irregular bumps along the scarp between frames 6 and 7: GoSPL's max elevation jumped from 1472 m to 3950 m, while DES's surface only reached 1846 m.The cause is the time-averaged velocity sent to GoSPL. It's each top node's displacement since the last coupling over the interval, and it falls back to the instantaneous velocity only when the surface node count changed. But every remesh renumbers the nodes (
renumbering_meshsorts by x + 1e-3 y + 1e-6 z), so after a remesh that keeps the count,top_nodes[i]can name another node. Re-sorting the saved top nodes reassigns hundreds of them to nodes ~25 km away, which comes out as up to ~480 m/yr instead of 0.015-0.05 m/yr. Thegospl_driver/README.mdcaveat already warned about this.What
var.nremeshbetween couplings instead of the node count.GoSPL: instantaneous velocity at t=... yr: remeshed since the last coupling (surface nodes N0 -> N1[, same count]), where "same count" marks the case the old check missed.make -n -B, 114 of 114 tokens); see the second commit. Same change for gospl_extensions in docs: building DynEarthSol does not need the gospl env deactivated gospl_extensions#2.For the reviewer
use_gosplinbc.cxx. The change is one condition,use_time_avg = has_surface_start && nremesh_at_start == var.nremesh, plus recordingnremesh_at_startafter each coupling. To confirm no remesh can slip past it, check thatvar.nremesh += 1at the end ofremesh()(remeshing.cxx:6339) is the only place a remesh ends, including the remesh inside the PT loop.max_steps = 18000; the first remesh came at step 16000 in my run). EachRemeshing startsline should be followed by oneremeshed since the last couplingline before the next remesh, and no such line should appear without a remesh before it. This prints the two violation counts and should give0 0:var.nremeshcheck above is what covers that case.Try it
n/a
Numerical effect
benchmarks-cores/test-3d-equ-tiny.cfg. A GoSPL run only changes after a remesh that keeps the surface node count.t=13893.005937 yr: remeshed since the last coupling (surface nodes 2379 -> 2469). The first "same count" remesh comes att=129416.585101 yr(4425 -> 4425). After it, GoSPL's max elevation is 1669 m at frame 7 (was 3950 m) and the number of nodes >100 m off their neighbours' mean is 68 (was 1269). 4 of 388 remeshes kept the count up to 335 kyr, with no jump after any of them, and the awk check above gives0 0over all 388.New or retired names
Checklist
ndims=2andndims=3: yes## [Unreleased]in CHANGELOG.md: yesinput.cxxand documented inexamples/defaults.cfg: nonetests/functional/orbenchmarks-cores/: no new test; the 330 kyr coupled run above is the checkAI disclosure
Claude Code (Claude Opus 5.5) traced the bumps to the node renumbering, wrote both commits and this description, and ran the benchmark comparison and the analysis of both runs; I ran the long coupled run and reviewed it all.
🤖 Generated with Claude Code