| #!/usr/bin/env python3 | |
| """用干净模板覆盖所有 stokes_wave case 的 controlDict""" | |
| import os, shutil | |
| raw = '/mnt/f/agent-workspace/paper2/Exp/data/raw/stokes_wave' | |
| template = '/mnt/f/agent-workspace/paper2/Exp/data/scripts/stokes_controlDict_template' | |
| with open(template) as f: | |
| tmpl = f.read() | |
| fixed = 0 | |
| for d in sorted(os.listdir(raw)): | |
| if not d.startswith('t'): | |
| continue | |
| cd = os.path.join(raw, d, 'system', 'controlDict') | |
| if os.path.isdir(os.path.dirname(cd)): | |
| with open(cd, 'w') as f: | |
| f.write(tmpl) | |
| fixed += 1 | |
| print(f'Overwrote {fixed} controlDicts with clean template') | |