Add frozen negative density localization and independent EOS projection diagnostics
This commit is contained in:
@@ -132,6 +132,26 @@ def main():
|
||||
path = source / path
|
||||
path = path.resolve()
|
||||
state_files[str(path)] = digest(path)
|
||||
elif word == '--density-snapshot':
|
||||
path = Path(case['arguments'][i + 1])
|
||||
path = (path if path.is_absolute() else source / path).resolve()
|
||||
# Modal coordinates also depend on the mesh and named block
|
||||
# layout. Bind replay to its original recorded campaign rather
|
||||
# than trusting a coincidentally matching vector length.
|
||||
prior_manifest = path.parent / 'provenance.json'
|
||||
prior_run = path.parent / (path.name + '_run.json')
|
||||
prior = json.loads(prior_manifest.read_text())
|
||||
saved_run = json.loads(prior_run.read_text())
|
||||
if prior['mesh_sha256'] != provenance['mesh_sha256']:
|
||||
raise RuntimeError('Density replay mesh differs from the snapshot campaign.')
|
||||
for filename in ('accepted_state.txt', 'metadata.txt', 'layout.csv'):
|
||||
snapshot_file = path / filename
|
||||
value = digest(snapshot_file)
|
||||
if value != saved_run['output_hashes'][filename]:
|
||||
raise RuntimeError('Density replay input no longer matches its original run: ' + filename)
|
||||
state_files[str(snapshot_file)] = value
|
||||
state_files[str(prior_manifest)] = digest(prior_manifest)
|
||||
state_files[str(prior_run)] = digest(prior_run)
|
||||
print('START', name, flush=True)
|
||||
start = time.monotonic()
|
||||
cpu_start = resource.getrusage(resource.RUSAGE_CHILDREN)
|
||||
@@ -161,12 +181,15 @@ def main():
|
||||
for path in sorted(folder.rglob('*'))
|
||||
if path.is_file() and path.suffix in ('.txt', '.csv', '.json')
|
||||
}
|
||||
record['inputs_unchanged'] = all(digest(Path(path)) == value for path, value in state_files.items())
|
||||
write_json(output / (name + '_run.json'), record)
|
||||
summaries.append({**record, **summarize(folder)})
|
||||
write_json(output / 'summary.json', summaries)
|
||||
print('FINISH', name, record['exit_code'], round(record['seconds'], 2), flush=True)
|
||||
if record['exit_code'] not in (0, 3):
|
||||
raise RuntimeError('Case failed to execute; see its retained log and run record.')
|
||||
if not record['inputs_unchanged']:
|
||||
raise RuntimeError('A frozen input changed during the diagnostic run.')
|
||||
# Exit 0 denotes completed observations; exit 3 from a model remains explicitly recorded as nonconvergence.
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user