test: signed interface-probe trace diagnostic (--probe-trace)
Test-only mechanism diagnostic, no pass gates. New pinned shear_probes.py: 24 fixed root-physical points on vertical/horizontal interface-normal transects (>=8 root cells from corners), ACTIVE-leaf selection storing level/i/j/actual centers, root-sync rho/ux/uy at root steps 0-128 and 1920-2048 (U512 every 4 lattice steps), analytic residuals at actual centers, schedule/finite/600 kB validation. run_case: --probe-trace for nested U128/U512/projected d3 and twin projected d2 (not with --final-snapshot), shear_probes.py pin, probe-only steps skip metrics, five qualification samples unchanged. shear_wave/shear_nested/shear_twin/ oracle byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
02bde0f751
commit
1e188e7419
4 files changed
+377
-3
No files matched your search
@@ -25,6 +25,7 @@ NESTED_SHEAR = "nested_shear_n128" # fixed three-level/two-region shear preset
|
||||
SHEAR_NESTED_SHA256 = "fa6cfe87fb4df8c6d732c637c885276833c81973b950c7724d734f8fc350bcb0"
|
||||
TWIN_SHEAR = "twin_shear_n128" # depth-2 twin: nested L0->L1 boxes without L2
|
||||
SHEAR_TWIN_SHA256 = "1cbf37f18e89aea577581631c4565f51e68d22a3739b698816ef64acbf2b2bb4"
|
||||
SHEAR_PROBES_SHA256 = "98ea8090ace48f04b83dfb015db10e681e414e57eb748b34c0fbb90fb790d13b" # signed interface-probe mechanism diagnostic
|
||||
|
||||
|
||||
def flow_functions(flow="taylor_green"):
|
||||
@@ -94,7 +95,7 @@ def provenance(repo):
|
||||
)
|
||||
|
||||
|
||||
def verify_source(repo, revision, flow="taylor_green"):
|
||||
def verify_source(repo, revision, flow="taylor_green", probes=False):
|
||||
"""Exact clean harness commit, fixed production tree, and reviewed capture helper."""
|
||||
import oracle
|
||||
from tests.validation.multigrid import check_projected_pairs as gate
|
||||
@@ -113,6 +114,13 @@ def verify_source(repo, revision, flow="taylor_green"):
|
||||
if result["source_tree_sha256"] != SOURCE_SHA256:
|
||||
raise RuntimeError("Wrong numerical source fingerprint")
|
||||
result["build_capture_sha256"] = BUILD_CAPTURE_SHA256
|
||||
if probes:
|
||||
import shear_probes
|
||||
module = harness / "shear_probes.py"
|
||||
if (Path(shear_probes.__file__).resolve() != module
|
||||
or hashlib.sha256(module.read_bytes()).hexdigest() != SHEAR_PROBES_SHA256):
|
||||
raise RuntimeError("Wrong shear_probes module checkout or content")
|
||||
result["shear_probes_sha256"] = SHEAR_PROBES_SHA256
|
||||
if flow == "shear_twin":
|
||||
import shear_twin
|
||||
module = harness / "shear_twin.py"
|
||||
@@ -206,6 +214,9 @@ def main():
|
||||
"(scaled_n256: Taylor-Green; scaled_shear_n256: shear wave) or the "
|
||||
"fixed three-level/two-region shear preset (nested_shear_n128) "
|
||||
"or its depth-2 twin (twin_shear_n128)")
|
||||
p.add_argument("--probe-trace", action="store_true",
|
||||
help="signed interface-probe trace (nested U128/U512/projected d3, "
|
||||
"twin projected d2); mechanism diagnostic, no gates")
|
||||
p.add_argument("--final-snapshot", action="store_true",
|
||||
help="nested_shear_n128 projected depth-3 only: final macro snapshot")
|
||||
p.add_argument("--early-pressure", action="store_true",
|
||||
@@ -216,6 +227,13 @@ def main():
|
||||
if args.flow == "shear_wave" and (args.re != 100 or (args.depth == 3 and not nested)
|
||||
or args.early_pressure):
|
||||
p.error("shear_wave requires --re 100, depth 1 or 2 and no --early-pressure")
|
||||
probe_cases = {(NESTED_SHEAR, 128, 1, "constant"), (NESTED_SHEAR, 512, 1, "constant"),
|
||||
(NESTED_SHEAR, 128, 3, "projected_linear"),
|
||||
(TWIN_SHEAR, 128, 2, "projected_linear")}
|
||||
if args.probe_trace and (args.final_snapshot or (
|
||||
args.diagnostic, args.n, args.depth, args.explosion) not in probe_cases):
|
||||
p.error("--probe-trace requires nested U128/U512/projected depth 3 or twin projected "
|
||||
"depth 2, without --final-snapshot")
|
||||
if args.final_snapshot and not (nested and args.depth == 3
|
||||
and args.explosion == "projected_linear"):
|
||||
p.error("--final-snapshot requires nested_shear_n128 projected depth 3")
|
||||
@@ -253,7 +271,8 @@ def main():
|
||||
repo = args.repo.resolve()
|
||||
sys.path[:0] = [str(repo / "src"), str(repo)]
|
||||
source = verify_source(repo, args.expected_revision,
|
||||
"shear_nested" if nested else "shear_twin" if twin else args.flow)
|
||||
"shear_nested" if nested else "shear_twin" if twin else args.flow,
|
||||
probes=args.probe_trace)
|
||||
runtime = runtime_source(repo)
|
||||
if args.dry_run:
|
||||
print(json.dumps(dict(source=source, runtime_source=runtime, dry_run=True,
|
||||
@@ -351,8 +370,23 @@ def main():
|
||||
]
|
||||
)
|
||||
initial_mass = None
|
||||
for step in sorted(set(main_steps + early_steps)):
|
||||
probe_steps = set()
|
||||
if args.probe_trace:
|
||||
import shear_probes
|
||||
probe_root = dict(zip(shear_probes.case_steps(args.n), shear_probes.STEPS))
|
||||
probe_steps = set(probe_root)
|
||||
probes = shear_probes.select(masks, args.n)
|
||||
report["probe_trace"] = shear_probes.new_trace(
|
||||
probes, cfg.viscosity, [args.diagnostic, args.n, args.depth, args.explosion])
|
||||
for step in sorted(set(main_steps + early_steps) | probe_steps):
|
||||
run.step(step - run.step_count)
|
||||
if step in probe_steps:
|
||||
trace = report["probe_trace"]
|
||||
trace["steps"].append(probe_root[step]) # root-physical step
|
||||
trace["values"].append(shear_probes.sample(
|
||||
(run.download(),) if args.depth == 1 else run.download(), probes))
|
||||
if step not in main_steps and step not in early_steps:
|
||||
continue # probe-only step: no qualification metrics
|
||||
row = sample(run, masks, step, args.n, cfg.viscosity, initial_mass,
|
||||
metrics, args.depth)
|
||||
row["step"] = step
|
||||
@@ -405,6 +439,11 @@ def main():
|
||||
),
|
||||
flush=True,
|
||||
)
|
||||
if args.probe_trace:
|
||||
try:
|
||||
report["probe_trace"]["bytes"] = shear_probes.validate(report["probe_trace"])
|
||||
except ValueError as error: # keep the scalar receipt; drop an invalid trace
|
||||
report["probe_trace"] = dict(error=str(error))
|
||||
report.update(
|
||||
completed=True,
|
||||
seconds=time.monotonic() - started,
|
||||
|
||||
Reference in new issue
Block a user