Datasets:
Formats:
json
Languages:
English
Size:
1K - 10K
Tags:
mathematics
fluid-dynamics
navier-stokes
helicity
nonlinear-observability
experimental-mathematics
Download research/src/refinement_demo.py from PureOne/Chisael-Nexythra: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/datasets/PureOne/Chisael-Nexythra/resolve/main/research/src/refinement_demo.py
- Command line
-
hf download hf://datasets/PureOne/Chisael-Nexythra/research/src/refinement_demo.py
-
curl -L -o refinement_demo.py https://huggingface.co/datasets/PureOne/Chisael-Nexythra/resolve/main/research/src/refinement_demo.py
1.55 kB
| """Refine forward evaluation of the saved corrected initial data. | |
| This is convergence evidence, not a validated continuum existence certificate. | |
| Run nonlinear_demo.py first to regenerate the input amplitude corrections. | |
| """ | |
| from pathlib import Path | |
| import json | |
| import time | |
| import numpy as np | |
| from nonlinear_demo import Galerkin | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def main() -> None: | |
| path = ROOT / 'data/nonlinear_demo.json' | |
| if not path.exists(): | |
| raise FileNotFoundError('Run src/nonlinear_demo.py first.') | |
| raw = json.loads(path.read_text()) | |
| case = next(r for r in raw['results'] if abs(r['epsilon'] - .4) < 1e-12) | |
| a = np.array(raw['base_amplitudes']) * np.exp(case['theta']) | |
| signs, delta = np.array(raw['chiralities']), raw['delta'] | |
| times = [0., .12, .25] | |
| target = np.array([0., 0., delta**2]) | |
| checks = [] | |
| for cutoff in (3, 4, 5): | |
| start = time.perf_counter() | |
| sim = Galerkin(cutoff, 1., .0005) | |
| values, _ = sim.integrate(sim.initial(a, signs, delta, .4), times) | |
| checks.append({'K': cutoff, 'grid': sim.n, 'dt': sim.dt, | |
| 'helicity_residual_max': float(np.max(abs(values[:, 1] - target))), | |
| 'seconds': time.perf_counter() - start}) | |
| output = {'checks': checks, | |
| 'warning': 'Forward convergence evidence only; no interval PDE certificate.'} | |
| (ROOT / 'data/refinement_comparison.json').write_text(json.dumps(output, indent=2)) | |
| print(json.dumps(output, indent=2)) | |
| if __name__ == '__main__': | |
| main() | |