ns-blowup 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. ns_blowup-0.1.0/CHANGELOG.md +13 -0
  2. ns_blowup-0.1.0/CONTRIBUTING.md +15 -0
  3. ns_blowup-0.1.0/LICENSE +25 -0
  4. ns_blowup-0.1.0/MANIFEST.in +6 -0
  5. ns_blowup-0.1.0/PKG-INFO +249 -0
  6. ns_blowup-0.1.0/README.md +218 -0
  7. ns_blowup-0.1.0/docs/api.md +46 -0
  8. ns_blowup-0.1.0/docs/conf.py +18 -0
  9. ns_blowup-0.1.0/docs/conversation.json +5723 -0
  10. ns_blowup-0.1.0/docs/conversation.md +577 -0
  11. ns_blowup-0.1.0/docs/environment-tested.txt +40 -0
  12. ns_blowup-0.1.0/docs/index.md +24 -0
  13. ns_blowup-0.1.0/docs/numerics.md +62 -0
  14. ns_blowup-0.1.0/docs/observatory.html +33 -0
  15. ns_blowup-0.1.0/docs/observatory.json +40707 -0
  16. ns_blowup-0.1.0/docs/platforms.md +34 -0
  17. ns_blowup-0.1.0/docs/releases.md +38 -0
  18. ns_blowup-0.1.0/docs/requirements.txt +3 -0
  19. ns_blowup-0.1.0/docs/research.md +95 -0
  20. ns_blowup-0.1.0/docs/roadmap.md +41 -0
  21. ns_blowup-0.1.0/docs/source-manifest.json +14 -0
  22. ns_blowup-0.1.0/docs/sources.md +29 -0
  23. ns_blowup-0.1.0/docs/test-summary.json +22 -0
  24. ns_blowup-0.1.0/docs/tutorial.md +109 -0
  25. ns_blowup-0.1.0/docs/validation-cpu.json +76 -0
  26. ns_blowup-0.1.0/docs/validation-gpu.json +76 -0
  27. ns_blowup-0.1.0/docs/validation.md +41 -0
  28. ns_blowup-0.1.0/examples/approach_singularity.py +21 -0
  29. ns_blowup-0.1.0/examples/optimize_forcing.py +34 -0
  30. ns_blowup-0.1.0/examples/quickstart.py +7 -0
  31. ns_blowup-0.1.0/examples/reproduce_figures.py +33 -0
  32. ns_blowup-0.1.0/pyproject.toml +43 -0
  33. ns_blowup-0.1.0/scripts/check_release.py +24 -0
  34. ns_blowup-0.1.0/scripts/smoke_wheel.py +24 -0
  35. ns_blowup-0.1.0/scripts/validate.py +60 -0
  36. ns_blowup-0.1.0/setup.cfg +4 -0
  37. ns_blowup-0.1.0/src/ns_blowup/__init__.py +13 -0
  38. ns_blowup-0.1.0/src/ns_blowup/__main__.py +41 -0
  39. ns_blowup-0.1.0/src/ns_blowup/analytical.py +78 -0
  40. ns_blowup-0.1.0/src/ns_blowup/assets/observatory.html +33 -0
  41. ns_blowup-0.1.0/src/ns_blowup/construction.py +84 -0
  42. ns_blowup-0.1.0/src/ns_blowup/diagnostics.py +75 -0
  43. ns_blowup-0.1.0/src/ns_blowup/exterior.py +73 -0
  44. ns_blowup-0.1.0/src/ns_blowup/grid.py +45 -0
  45. ns_blowup-0.1.0/src/ns_blowup/io.py +27 -0
  46. ns_blowup-0.1.0/src/ns_blowup/observatory.py +76 -0
  47. ns_blowup-0.1.0/src/ns_blowup/simulation.py +188 -0
  48. ns_blowup-0.1.0/src/ns_blowup/spectral.py +167 -0
  49. ns_blowup-0.1.0/src/ns_blowup.egg-info/PKG-INFO +249 -0
  50. ns_blowup-0.1.0/src/ns_blowup.egg-info/SOURCES.txt +58 -0
  51. ns_blowup-0.1.0/src/ns_blowup.egg-info/dependency_links.txt +1 -0
  52. ns_blowup-0.1.0/src/ns_blowup.egg-info/requires.txt +14 -0
  53. ns_blowup-0.1.0/src/ns_blowup.egg-info/top_level.txt +1 -0
  54. ns_blowup-0.1.0/tests/conftest.py +12 -0
  55. ns_blowup-0.1.0/tests/test_analytical.py +49 -0
  56. ns_blowup-0.1.0/tests/test_construction.py +41 -0
  57. ns_blowup-0.1.0/tests/test_exterior.py +38 -0
  58. ns_blowup-0.1.0/tests/test_observatory.py +14 -0
  59. ns_blowup-0.1.0/tests/test_spectral.py +134 -0
  60. ns_blowup-0.1.0/tests/test_workflow.py +74 -0
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — research preview
4
+
5
+ - Import the design conversation with source provenance.
6
+ - Add a JAX periodic Navier–Stokes library, analytical checks and a friendly simulation API.
7
+ - Implement similarity coordinates, viscosity scaling and heat-exterior quadrature.
8
+ - Add the standalone Singularity Observatory for implemented components and numerical precision experiments.
9
+ - Document scientific scope, unimplemented construction steps, validation and prior work.
10
+ - Configure CI, documentation builds and tag-triggered GitHub releases.
11
+
12
+ The complete smooth blowup construction is not implemented. No production-speed,
13
+ Blender-integration, formal-verification or near-singularity tracking claim is made.
@@ -0,0 +1,15 @@
1
+ # Contributing
2
+
3
+ The flagship is the Singularity Observatory. Favor changes that make the mathematical construction executable, testable, and usable, with a reusable Navier–Stokes API beneath it.
4
+
5
+ Install with `python -m pip install -e '.[dev,plot]'`, then run `JAX_PLATFORMS=cpu python -m pytest -q`. NVIDIA contributors can also run the suite with `JAX_PLATFORMS=cuda XLA_PYTHON_CLIENT_PREALLOCATE=false`. Never silently treat CPU execution as a successful GPU test.
6
+
7
+ A numerical contribution should explain the equation, discretization, units, data layout, domain, and failure modes. Cite the primary source near any translated formula. For construction components, name the equation/lemma and pin the source commit. Supply a test that can detect a physically meaningful error: independent derivatives, a different discretization, a conserved quantity, analytic substitution, or a convergence study. Tests duplicating the same formula in two places are insufficient.
8
+
9
+ Do not label a synthetic concentrating field as the full blowup construction. Do not define forcing as a residual and then use the resulting identity to claim force regularity. Finite tests and upstream proofs establish different facts; keep that distinction in the docs and API.
10
+
11
+ Keep the simple path short: named examples, clear errors, predictable shapes, and portable results. Add a runnable example for a new public workflow. Avoid global changes to JAX device, precision, or memory settings on import. Changes to saved-data formats require a schema revision and migration/compatibility notes.
12
+
13
+ Update the README status matrix with measured evidence. Use **Not Yet Tested** when code exists without relevant validation, and **Not Implemented** when it does not exist. A CI workflow is not a passed CI run. Performance claims need fair workloads, completed device execution, separated compilation, memory measurements, and matched error targets.
14
+
15
+ Before a public release, run the built wheel outside the source checkout, execute the documented examples, inspect the observatory in a browser, and have a human reviewer assess the scientific claims and release notes.
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ns-blowup contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ This license covers original project code and documentation. The imported
24
+ conversation in docs/conversation.md and docs/conversation.json, and referenced
25
+ third-party works, retain their respective rights and are not relicensed here.
@@ -0,0 +1,6 @@
1
+ include LICENSE README.md CHANGELOG.md CONTRIBUTING.md
2
+ recursive-include src/ns_blowup/assets *.html
3
+ recursive-include tests *.py
4
+ recursive-include examples *.py
5
+ recursive-include scripts *.py
6
+ recursive-include docs *.md *.py *.txt *.json *.html
@@ -0,0 +1,249 @@
1
+ Metadata-Version: 2.4
2
+ Name: ns-blowup
3
+ Version: 0.1.0
4
+ Summary: Differentiable JAX Navier–Stokes simulation and analytical validation
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/james-coder/navier-stokes-blowup
7
+ Project-URL: Documentation, https://github.com/james-coder/navier-stokes-blowup/tree/main/docs
8
+ Project-URL: Issues, https://github.com/james-coder/navier-stokes-blowup/issues
9
+ Project-URL: Changelog, https://github.com/james-coder/navier-stokes-blowup/blob/main/CHANGELOG.md
10
+ Keywords: navier-stokes,fluid-dynamics,jax,differentiable-simulation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Scientific/Engineering :: Physics
17
+ Requires-Python: >=3.12
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: jax>=0.11.1
21
+ Requires-Dist: numpy>=1.26
22
+ Provides-Extra: cuda12
23
+ Requires-Dist: jax[cuda12]>=0.11.1; extra == "cuda12"
24
+ Provides-Extra: cuda13
25
+ Requires-Dist: jax[cuda13]>=0.11.1; extra == "cuda13"
26
+ Provides-Extra: plot
27
+ Requires-Dist: matplotlib>=3.8; extra == "plot"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # ns-blowup
33
+
34
+ **A Navier–Stokes library with one flagship: the Singularity Observatory.**
35
+
36
+ The aim is to make a new mathematical construction something people can inspect, evaluate, and eventually use to challenge numerical solvers. A friendly Python API provides the simulation and diagnostics underneath it.
37
+
38
+ **Version 0.1.0 is a research preview.** The library runs real 2D/3D periodic simulations and evaluates specific components of OpenAI’s published construction. **The complete smooth blowup solution is Not Implemented.** This release does not yet support the claim that it reproduces the theorem or enables previously impossible fluid simulation.
39
+
40
+ [Open the observatory](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/observatory.html) · [Getting started](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/tutorial.md) · [API](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/api.md) · [Research and implementation gaps](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/research.md) · [Original conversation](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.md)
41
+
42
+ ## The flagship application
43
+
44
+ **“How close to a known singularity can a numerical solver remain accurate—and why does it fail?”**
45
+
46
+ That is the question the completed Singularity Observatory should answer. OpenAI’s paper supplies the motivating construction; its accompanying repository contains Lean formalizations. These are mathematical sources, not a ready-made GPU fluid solver. [Paper](https://cdn.openai.com/pdf/32d9f210-8b73-45e0-91bc-82a30aef8a9a/navier-stokes.pdf), [formalization](https://github.com/openai/NavierStokesAndEuler/tree/8937a8f4cbc7abaab5e9e97d1cc7f5d2319d9538).
47
+
48
+ The **working preview** lets you:
49
+
50
+ - Move toward the singular time and inspect the similarity-coordinate geometry.
51
+ - Compare normalized velocity and core-energy scaling.
52
+ - Change a hypothetical grid resolution and see its spatial coverage.
53
+ - Inspect an actual FP32/FP64 refinement experiment for the outer heat-flow component.
54
+ - Download every numerical dataset behind the display.
55
+
56
+ The geometry sampling threshold is a heuristic. The scaling plots are not measured norms of a completed blowup solution. The heat exterior is valid away from the axis and is itself singular on the axis at all times; it must not be used as smooth initial data for a purported blowup reproduction. The implementation boundary follows equations (3.2), (4.1), and Lemma A.6 of the [paper](https://cdn.openai.com/pdf/32d9f210-8b73-45e0-91bc-82a30aef8a9a/navier-stokes.pdf).
57
+
58
+ To use the checked-in app, download/open `docs/observatory.html` in a browser. GitHub’s file viewer displays its source. The app is standalone: no server, account, CDN, or Python installation is needed to view it. To regenerate it:
59
+
60
+ ```bash
61
+ python -m ns_blowup.observatory --output outputs/observatory.html
62
+ ```
63
+
64
+ Its data are also saved as `outputs/observatory.json`. The intended mature application and its acceptance criteria are described in [the roadmap](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/roadmap.md).
65
+
66
+ ## Install
67
+
68
+ Requires **Python 3.12+**. Install the research preview from [PyPI](https://pypi.org/project/ns-blowup/):
69
+
70
+ ```bash
71
+ python3 -m venv .venv
72
+ source .venv/bin/activate
73
+ python -m pip install 'ns-blowup[plot]==0.1.0'
74
+ ```
75
+
76
+ For an NVIDIA GPU on Linux/WSL2:
77
+
78
+ ```bash
79
+ python -m pip install 'ns-blowup[cuda12,plot]==0.1.0'
80
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
81
+ ```
82
+
83
+ CUDA 12 was exercised on the local RTX 4090. A `cuda13` extra is provided but **Not Yet Tested**. Driver/platform requirements come from the [JAX installation guide](https://docs.jax.dev/en/latest/installation.html). Disabling preallocation helps when sharing a GPU; it does not make an oversized calculation fit in memory. See [JAX GPU memory allocation](https://docs.jax.dev/en/latest/gpu_memory_allocation.html).
84
+
85
+ For development, clone this repository and run `python -m pip install -e '.[dev,plot]'` from its root.
86
+
87
+ ## Your first simulation
88
+
89
+ ```python
90
+ from ns_blowup import Simulation
91
+
92
+ result = Simulation((32, 32), nu=0.05).run(
93
+ initial="taylor-green",
94
+ t_end=1.0,
95
+ frames=21,
96
+ )
97
+
98
+ result.plot(quantity="vorticity", path="outputs/vorticity.png")
99
+ result.save("outputs/flow.npz")
100
+ print(result.diagnostics()["energy"])
101
+ ```
102
+
103
+ `Simulation` chooses a JAX device, projects the initial velocity, adapts the timestep, checks for nonfinite states, and returns uniformly timed snapshots. `result.final` is the last velocity field. No array-layout knowledge is needed for the built-in examples.
104
+
105
+ For a genuinely three-dimensional exact benchmark:
106
+
107
+ ```python
108
+ result = Simulation((24, 24, 24), nu=0.02).run("abc", t_end=0.5)
109
+ result.export_vtk("outputs/final.vtk")
110
+ ```
111
+
112
+ Or run the CLI:
113
+
114
+ ```bash
115
+ python -m ns_blowup --dim 3 --flow abc --resolution 24 --time 0.5 --plot
116
+ ```
117
+
118
+ The CLI writes `flow.npz`, `final.vtk`, and `diagnostics.json` to `outputs/demo/`. VTK exports follow the structured-points layout with x varying fastest. [VTK file-format documentation](https://docs.vtk.org/en/latest/vtk_file_formats/vtk_legacy_file_format.html).
119
+
120
+ ## Analytical evaluation and numerical checks
121
+
122
+ ```python
123
+ import jax.numpy as jnp
124
+ from ns_blowup import ABCFlow, FieldDiagnostics
125
+
126
+ flow = ABCFlow(nu=0.01)
127
+ points = jnp.array([[0.2, 0.4, 0.6], [1.0, 2.0, 3.0]])
128
+ checks = FieldDiagnostics(flow.velocity, flow.pressure, flow.nu, flow.forcing)
129
+
130
+ velocity = flow.velocity(points, 0.3)
131
+ vorticity = checks.vorticity(points, 0.3)
132
+ residual = checks.residual(points, 0.3)
133
+ divergence = checks.divergence(points, 0.3)
134
+ ```
135
+
136
+ The momentum residual is
137
+
138
+ ```text
139
+ R = ∂t u + (u · ∇)u + ∇p − ν Δu − f
140
+ ```
141
+
142
+ Pointwise checks differentiate field callbacks independently of the spectral solver. Tests include wrong-pressure/wrong-force controls so a residual that always returns zero would fail. The implemented exact flows are documented with their formulas in [the numerical-methods note](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/numerics.md).
143
+
144
+ ## Differentiable simulation
145
+
146
+ The lower-level API composes with `jax.jit`, `jax.grad`, and `jax.vmap`:
147
+
148
+ ```python
149
+ import jax
150
+ from ns_blowup import PeriodicGrid, SpectralSolver, TaylorGreen, kinetic_energy
151
+
152
+ grid = PeriodicGrid((16, 16))
153
+ solver = SpectralSolver(grid, nu=0.05)
154
+ u0 = TaylorGreen(nu=0.05).velocity(grid.points(), 0.0)
155
+
156
+ def final_energy(amplitude):
157
+ final = solver.integrate(amplitude * u0, dt=0.01, steps=50)
158
+ return kinetic_energy(final, grid)
159
+
160
+ d_energy_d_amplitude = jax.jit(jax.grad(final_energy))(1.0)
161
+ ```
162
+
163
+ [The forcing-optimization example](https://github.com/james-coder/navier-stokes-blowup/blob/main/examples/optimize_forcing.py) infers a scalar forcing amplitude through the numerical evolution. It is a small reproducible inverse problem, not evidence of globally optimal engineering designs. Differentiable CFD predates this project and the cited blowup result: see [JAX-Fluids](https://arxiv.org/abs/2203.13760) and [PhiFlow](https://github.com/tum-pbs/PhiFlow).
164
+
165
+ ## What works, and what does not
166
+
167
+ “Tested” means the listed checks passed in this checkout on the recorded environment, not that all physical regimes are validated.
168
+
169
+ | Capability | Status | Evidence / limit |
170
+ |---|---|---|
171
+ | 2D/3D periodic, constant-density incompressible flow | Tested | Projection, analytic decay, forced nonlinear flow, energy identity |
172
+ | JAX CPU / NVIDIA CUDA 12 execution | Tested | Local CPU and RTX 4090 reports below; small grids |
173
+ | FP32 and FP64 | Tested | Precision-specific numerical reports; FP64 needs x64 enabled |
174
+ | Fourth-order time convergence | Tested | Timestep refinement on a resolved analytic flow |
175
+ | Nonlinear dealiasing | Tested | Comparison against a 4× finer grid and inviscid energy production |
176
+ | Gradients through initial amplitude and forcing | Tested | Analytic derivative and centered finite-difference comparison |
177
+ | Adaptive convenience API, plots, NPZ round-trip | Tested | Workflow tests and executed examples |
178
+ | VTK writer | Tested: format/order | **Not Yet Tested** in the ParaView GUI |
179
+ | Similarity coordinates / viscosity rescaling | Tested: component identities | Implicit derivatives and equation residuals |
180
+ | Heat exterior | Tested: bounded sample ranges | Independent adaptive quadrature and momentum/heat residuals |
181
+ | Observatory browser controls and responsive layout | Tested in Chromium | Desktop/mobile viewport, sliders, animation, no JS errors |
182
+ | Full smooth blowup construction | **Not Implemented / Not Yet Tested** | Missing inner profiles, matching, pulses, corrections, localization |
183
+ | Formal certification of Python results | **Not Yet Tested** | Lean build and Comparator were not run here |
184
+ | Near-singularity solver tracking | **Not Yet Tested** | Needs complete executable field and certified truncation control |
185
+ | CUDA 13, AMD, Apple GPU, TPU, multi-GPU | **Not Yet Tested** | No hardware/runtime validation here; multi-GPU API not implemented |
186
+ | Large turbulent production cases / arbitrary precision | **Not Yet Tested** | No production qualification; arbitrary-precision backend not implemented |
187
+ | Walls, obstacles, free surfaces, FLIP/APIC, smoke/fire | **Not Implemented** | Current domain is periodic and single-phase |
188
+ | Blender add-on / OpenVDB exporter | **Not Implemented / Not Yet Tested** | Integration research only |
189
+ | Speedup over Blender or other CFD packages | **Not Yet Tested** | No comparative benchmark or speed claim |
190
+ | Hosted CI | Configured; see [live runs](https://github.com/james-coder/navier-stokes-blowup/actions/workflows/ci.yml) | CPU tests, docs and distribution builds; CUDA remains locally tested |
191
+ | Tag-triggered releases / PyPI | Automated validation and Trusted Publishing | Check the [release run](https://github.com/james-coder/navier-stokes-blowup/actions/workflows/release.yml) for publication status |
192
+
193
+ ## Reproducible validation
194
+
195
+ ```bash
196
+ JAX_PLATFORMS=cpu python -m pytest -q
197
+ XLA_PYTHON_CLIENT_PREALLOCATE=false JAX_PLATFORMS=cuda python -m pytest -q
198
+ JAX_PLATFORMS=cpu python scripts/validate.py --output outputs/validation-cpu.json
199
+ XLA_PYTHON_CLIENT_PREALLOCATE=false JAX_PLATFORMS=cuda \
200
+ python scripts/validate.py --output outputs/validation-gpu.json
201
+ python examples/quickstart.py
202
+ python examples/optimize_forcing.py
203
+ ```
204
+
205
+ **Final local test runs: 34 passed on CPU and 34 passed on CUDA (2026-09-10).**
206
+
207
+ Recorded environments and measurements: [CPU](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation-cpu.json), [GPU](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation-gpu.json), [validation explanation](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation.md). Tests enable x64 within the test process. The installed library never enables global x64 or memory preallocation on import.
208
+
209
+ The reports separate compilation from repeated execution and wait for device completion. That follows [JAX’s benchmarking guidance](https://docs.jax.dev/en/latest/benchmarking.html). These small checks, on an occupied GPU, are **not** a fair performance ranking.
210
+
211
+ ## Numerical scope
212
+
213
+ The current solver uses periodic Fourier differentiation, a pressure projection, strict two-thirds truncation, and explicit RK4. It solves in physical units chosen consistently by the caller; `nu` is kinematic viscosity and pressure is per unit density. The default box has side length `2π`.
214
+
215
+ Periodic spectral methods are an established route for this problem; [Mortensen and Langtangen (2016)](https://arxiv.org/abs/1602.03638) and [spectralDNS](https://github.com/spectralDNS/spectralDNS) provide important prior art. Our choices and independent tests are described in [Numerics](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/numerics.md).
216
+
217
+ Use `JAX_ENABLE_X64=1` and `dtype="float64"` for tighter numerical checks. FP64 is not arbitrary precision. See [JAX’s default-dtype documentation](https://docs.jax.dev/en/latest/default_dtypes.html). The convenience API checks timestep estimates on the host; use `SpectralSolver.integrate` for compiled fixed-step loops and differentiation. An adaptive timestep cannot rescue inadequate spatial resolution.
218
+
219
+ ## Position among existing libraries
220
+
221
+ | Need today | Existing project worth examining | This project’s role |
222
+ |---|---|---|
223
+ | Differentiable simulation with multiple ML backends | [PhiFlow](https://github.com/tum-pbs/PhiFlow) | Construction-focused evaluation and an approachable periodic solver |
224
+ | Compressible and two-phase differentiable CFD | [JAX-Fluids](https://arxiv.org/abs/2203.13760) | Different equation/domain scope; those features are not implemented here |
225
+ | Distributed pseudospectral DNS | [spectralDNS](https://github.com/spectralDNS/spectralDNS) | Single-device JAX reference and diagnostics |
226
+ | Historical JAX finite-volume/spectral research | [JAX-CFD](https://github.com/google/jax-cfd) | Useful prior art; its README now states it is no longer maintained |
227
+ | Mathematical certificates for the new result | [NavierStokesAndEuler](https://github.com/openai/NavierStokesAndEuler) | Numerical component evaluation, not a substitute for proof checking |
228
+
229
+ Becoming a widely trusted library requires reliable examples, stable interfaces, independent validation, documented failure modes, and sustained maintenance. That is the development direction, not a release claim.
230
+
231
+ ## NVIDIA Warp and Read the Docs
232
+
233
+ **Warp:** a promising optional kernel backend, with no performance claim yet. Keep the JAX reference and evaluate targeted kernels first; Warp’s JAX autodiff integration has documented restrictions. [Warp JAX interoperability](https://nvidia.github.io/warp/stable/user_guide/interoperability/jax.html).
234
+
235
+ **Read the Docs:** configuration and a Sphinx/MyST site are included. The local build is tested; hosted deployment is **Not Yet Tested / Not Connected**. [Build instructions and assessment](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/platforms.md), [Read the Docs Sphinx guide](https://docs.readthedocs.com/platform/stable/intro/sphinx.html).
236
+
237
+ ## Blender
238
+
239
+ Blender remains a possible presentation frontend for the flagship, rather than the initial killer application. Blender documents OpenVDB volume sequences and Mantaflow cache/script workflows. This repository currently exports NPZ and VTK; it has **no Blender cache integration**. [Blender volume objects](https://docs.blender.org/manual/en/4.5/modeling/volumes/introduction.html), [fluid cache](https://docs.blender.org/manual/en/4.5/physics/fluid/type/domain/cache.html), [OpenVDB Python API](https://www.openvdb.org/documentation/doxygen/python.html).
240
+
241
+ ## Builds and releases
242
+
243
+ GitHub Actions tests Python 3.12/3.13, builds the documentation, builds and checks wheel/source distributions, and exercises the installed wheel. Matching `v*` tags run the same validation before publishing to PyPI through Trusted Publishing, then attaching the same distributions, documentation, and checksums to a GitHub Release. No stored PyPI API token is needed. See [the release workflow](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/releases.md) and [PyPI's Trusted Publishing guide](https://docs.pypi.org/trusted-publishers/using-a-publisher/). Read the Docs hosting is not connected.
244
+
245
+ ## Sources and provenance
246
+
247
+ The shared conversation was extracted with the existing `chatgpt-import-share` checkout. The [Markdown transcript](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.md), [structured export](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.json), and [source manifest](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/source-manifest.json) preserve provenance and redacted/unavailable-message markers. The conversation is a design input, not independent evidence for its claims.
248
+
249
+ The manifest pins the inspected Lean commit and records the paper hash. Read the [research note](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/research.md) and [annotated sources](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/sources.md) for the implementation decisions and unresolved questions. [Contributing](https://github.com/james-coder/navier-stokes-blowup/blob/main/CONTRIBUTING.md) describes the evidence required for new features. Code is MIT licensed; the imported conversation and referenced third-party works retain their respective rights.
@@ -0,0 +1,218 @@
1
+ # ns-blowup
2
+
3
+ **A Navier–Stokes library with one flagship: the Singularity Observatory.**
4
+
5
+ The aim is to make a new mathematical construction something people can inspect, evaluate, and eventually use to challenge numerical solvers. A friendly Python API provides the simulation and diagnostics underneath it.
6
+
7
+ **Version 0.1.0 is a research preview.** The library runs real 2D/3D periodic simulations and evaluates specific components of OpenAI’s published construction. **The complete smooth blowup solution is Not Implemented.** This release does not yet support the claim that it reproduces the theorem or enables previously impossible fluid simulation.
8
+
9
+ [Open the observatory](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/observatory.html) · [Getting started](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/tutorial.md) · [API](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/api.md) · [Research and implementation gaps](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/research.md) · [Original conversation](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.md)
10
+
11
+ ## The flagship application
12
+
13
+ **“How close to a known singularity can a numerical solver remain accurate—and why does it fail?”**
14
+
15
+ That is the question the completed Singularity Observatory should answer. OpenAI’s paper supplies the motivating construction; its accompanying repository contains Lean formalizations. These are mathematical sources, not a ready-made GPU fluid solver. [Paper](https://cdn.openai.com/pdf/32d9f210-8b73-45e0-91bc-82a30aef8a9a/navier-stokes.pdf), [formalization](https://github.com/openai/NavierStokesAndEuler/tree/8937a8f4cbc7abaab5e9e97d1cc7f5d2319d9538).
16
+
17
+ The **working preview** lets you:
18
+
19
+ - Move toward the singular time and inspect the similarity-coordinate geometry.
20
+ - Compare normalized velocity and core-energy scaling.
21
+ - Change a hypothetical grid resolution and see its spatial coverage.
22
+ - Inspect an actual FP32/FP64 refinement experiment for the outer heat-flow component.
23
+ - Download every numerical dataset behind the display.
24
+
25
+ The geometry sampling threshold is a heuristic. The scaling plots are not measured norms of a completed blowup solution. The heat exterior is valid away from the axis and is itself singular on the axis at all times; it must not be used as smooth initial data for a purported blowup reproduction. The implementation boundary follows equations (3.2), (4.1), and Lemma A.6 of the [paper](https://cdn.openai.com/pdf/32d9f210-8b73-45e0-91bc-82a30aef8a9a/navier-stokes.pdf).
26
+
27
+ To use the checked-in app, download/open `docs/observatory.html` in a browser. GitHub’s file viewer displays its source. The app is standalone: no server, account, CDN, or Python installation is needed to view it. To regenerate it:
28
+
29
+ ```bash
30
+ python -m ns_blowup.observatory --output outputs/observatory.html
31
+ ```
32
+
33
+ Its data are also saved as `outputs/observatory.json`. The intended mature application and its acceptance criteria are described in [the roadmap](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/roadmap.md).
34
+
35
+ ## Install
36
+
37
+ Requires **Python 3.12+**. Install the research preview from [PyPI](https://pypi.org/project/ns-blowup/):
38
+
39
+ ```bash
40
+ python3 -m venv .venv
41
+ source .venv/bin/activate
42
+ python -m pip install 'ns-blowup[plot]==0.1.0'
43
+ ```
44
+
45
+ For an NVIDIA GPU on Linux/WSL2:
46
+
47
+ ```bash
48
+ python -m pip install 'ns-blowup[cuda12,plot]==0.1.0'
49
+ export XLA_PYTHON_CLIENT_PREALLOCATE=false
50
+ ```
51
+
52
+ CUDA 12 was exercised on the local RTX 4090. A `cuda13` extra is provided but **Not Yet Tested**. Driver/platform requirements come from the [JAX installation guide](https://docs.jax.dev/en/latest/installation.html). Disabling preallocation helps when sharing a GPU; it does not make an oversized calculation fit in memory. See [JAX GPU memory allocation](https://docs.jax.dev/en/latest/gpu_memory_allocation.html).
53
+
54
+ For development, clone this repository and run `python -m pip install -e '.[dev,plot]'` from its root.
55
+
56
+ ## Your first simulation
57
+
58
+ ```python
59
+ from ns_blowup import Simulation
60
+
61
+ result = Simulation((32, 32), nu=0.05).run(
62
+ initial="taylor-green",
63
+ t_end=1.0,
64
+ frames=21,
65
+ )
66
+
67
+ result.plot(quantity="vorticity", path="outputs/vorticity.png")
68
+ result.save("outputs/flow.npz")
69
+ print(result.diagnostics()["energy"])
70
+ ```
71
+
72
+ `Simulation` chooses a JAX device, projects the initial velocity, adapts the timestep, checks for nonfinite states, and returns uniformly timed snapshots. `result.final` is the last velocity field. No array-layout knowledge is needed for the built-in examples.
73
+
74
+ For a genuinely three-dimensional exact benchmark:
75
+
76
+ ```python
77
+ result = Simulation((24, 24, 24), nu=0.02).run("abc", t_end=0.5)
78
+ result.export_vtk("outputs/final.vtk")
79
+ ```
80
+
81
+ Or run the CLI:
82
+
83
+ ```bash
84
+ python -m ns_blowup --dim 3 --flow abc --resolution 24 --time 0.5 --plot
85
+ ```
86
+
87
+ The CLI writes `flow.npz`, `final.vtk`, and `diagnostics.json` to `outputs/demo/`. VTK exports follow the structured-points layout with x varying fastest. [VTK file-format documentation](https://docs.vtk.org/en/latest/vtk_file_formats/vtk_legacy_file_format.html).
88
+
89
+ ## Analytical evaluation and numerical checks
90
+
91
+ ```python
92
+ import jax.numpy as jnp
93
+ from ns_blowup import ABCFlow, FieldDiagnostics
94
+
95
+ flow = ABCFlow(nu=0.01)
96
+ points = jnp.array([[0.2, 0.4, 0.6], [1.0, 2.0, 3.0]])
97
+ checks = FieldDiagnostics(flow.velocity, flow.pressure, flow.nu, flow.forcing)
98
+
99
+ velocity = flow.velocity(points, 0.3)
100
+ vorticity = checks.vorticity(points, 0.3)
101
+ residual = checks.residual(points, 0.3)
102
+ divergence = checks.divergence(points, 0.3)
103
+ ```
104
+
105
+ The momentum residual is
106
+
107
+ ```text
108
+ R = ∂t u + (u · ∇)u + ∇p − ν Δu − f
109
+ ```
110
+
111
+ Pointwise checks differentiate field callbacks independently of the spectral solver. Tests include wrong-pressure/wrong-force controls so a residual that always returns zero would fail. The implemented exact flows are documented with their formulas in [the numerical-methods note](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/numerics.md).
112
+
113
+ ## Differentiable simulation
114
+
115
+ The lower-level API composes with `jax.jit`, `jax.grad`, and `jax.vmap`:
116
+
117
+ ```python
118
+ import jax
119
+ from ns_blowup import PeriodicGrid, SpectralSolver, TaylorGreen, kinetic_energy
120
+
121
+ grid = PeriodicGrid((16, 16))
122
+ solver = SpectralSolver(grid, nu=0.05)
123
+ u0 = TaylorGreen(nu=0.05).velocity(grid.points(), 0.0)
124
+
125
+ def final_energy(amplitude):
126
+ final = solver.integrate(amplitude * u0, dt=0.01, steps=50)
127
+ return kinetic_energy(final, grid)
128
+
129
+ d_energy_d_amplitude = jax.jit(jax.grad(final_energy))(1.0)
130
+ ```
131
+
132
+ [The forcing-optimization example](https://github.com/james-coder/navier-stokes-blowup/blob/main/examples/optimize_forcing.py) infers a scalar forcing amplitude through the numerical evolution. It is a small reproducible inverse problem, not evidence of globally optimal engineering designs. Differentiable CFD predates this project and the cited blowup result: see [JAX-Fluids](https://arxiv.org/abs/2203.13760) and [PhiFlow](https://github.com/tum-pbs/PhiFlow).
133
+
134
+ ## What works, and what does not
135
+
136
+ “Tested” means the listed checks passed in this checkout on the recorded environment, not that all physical regimes are validated.
137
+
138
+ | Capability | Status | Evidence / limit |
139
+ |---|---|---|
140
+ | 2D/3D periodic, constant-density incompressible flow | Tested | Projection, analytic decay, forced nonlinear flow, energy identity |
141
+ | JAX CPU / NVIDIA CUDA 12 execution | Tested | Local CPU and RTX 4090 reports below; small grids |
142
+ | FP32 and FP64 | Tested | Precision-specific numerical reports; FP64 needs x64 enabled |
143
+ | Fourth-order time convergence | Tested | Timestep refinement on a resolved analytic flow |
144
+ | Nonlinear dealiasing | Tested | Comparison against a 4× finer grid and inviscid energy production |
145
+ | Gradients through initial amplitude and forcing | Tested | Analytic derivative and centered finite-difference comparison |
146
+ | Adaptive convenience API, plots, NPZ round-trip | Tested | Workflow tests and executed examples |
147
+ | VTK writer | Tested: format/order | **Not Yet Tested** in the ParaView GUI |
148
+ | Similarity coordinates / viscosity rescaling | Tested: component identities | Implicit derivatives and equation residuals |
149
+ | Heat exterior | Tested: bounded sample ranges | Independent adaptive quadrature and momentum/heat residuals |
150
+ | Observatory browser controls and responsive layout | Tested in Chromium | Desktop/mobile viewport, sliders, animation, no JS errors |
151
+ | Full smooth blowup construction | **Not Implemented / Not Yet Tested** | Missing inner profiles, matching, pulses, corrections, localization |
152
+ | Formal certification of Python results | **Not Yet Tested** | Lean build and Comparator were not run here |
153
+ | Near-singularity solver tracking | **Not Yet Tested** | Needs complete executable field and certified truncation control |
154
+ | CUDA 13, AMD, Apple GPU, TPU, multi-GPU | **Not Yet Tested** | No hardware/runtime validation here; multi-GPU API not implemented |
155
+ | Large turbulent production cases / arbitrary precision | **Not Yet Tested** | No production qualification; arbitrary-precision backend not implemented |
156
+ | Walls, obstacles, free surfaces, FLIP/APIC, smoke/fire | **Not Implemented** | Current domain is periodic and single-phase |
157
+ | Blender add-on / OpenVDB exporter | **Not Implemented / Not Yet Tested** | Integration research only |
158
+ | Speedup over Blender or other CFD packages | **Not Yet Tested** | No comparative benchmark or speed claim |
159
+ | Hosted CI | Configured; see [live runs](https://github.com/james-coder/navier-stokes-blowup/actions/workflows/ci.yml) | CPU tests, docs and distribution builds; CUDA remains locally tested |
160
+ | Tag-triggered releases / PyPI | Automated validation and Trusted Publishing | Check the [release run](https://github.com/james-coder/navier-stokes-blowup/actions/workflows/release.yml) for publication status |
161
+
162
+ ## Reproducible validation
163
+
164
+ ```bash
165
+ JAX_PLATFORMS=cpu python -m pytest -q
166
+ XLA_PYTHON_CLIENT_PREALLOCATE=false JAX_PLATFORMS=cuda python -m pytest -q
167
+ JAX_PLATFORMS=cpu python scripts/validate.py --output outputs/validation-cpu.json
168
+ XLA_PYTHON_CLIENT_PREALLOCATE=false JAX_PLATFORMS=cuda \
169
+ python scripts/validate.py --output outputs/validation-gpu.json
170
+ python examples/quickstart.py
171
+ python examples/optimize_forcing.py
172
+ ```
173
+
174
+ **Final local test runs: 34 passed on CPU and 34 passed on CUDA (2026-09-10).**
175
+
176
+ Recorded environments and measurements: [CPU](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation-cpu.json), [GPU](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation-gpu.json), [validation explanation](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/validation.md). Tests enable x64 within the test process. The installed library never enables global x64 or memory preallocation on import.
177
+
178
+ The reports separate compilation from repeated execution and wait for device completion. That follows [JAX’s benchmarking guidance](https://docs.jax.dev/en/latest/benchmarking.html). These small checks, on an occupied GPU, are **not** a fair performance ranking.
179
+
180
+ ## Numerical scope
181
+
182
+ The current solver uses periodic Fourier differentiation, a pressure projection, strict two-thirds truncation, and explicit RK4. It solves in physical units chosen consistently by the caller; `nu` is kinematic viscosity and pressure is per unit density. The default box has side length `2π`.
183
+
184
+ Periodic spectral methods are an established route for this problem; [Mortensen and Langtangen (2016)](https://arxiv.org/abs/1602.03638) and [spectralDNS](https://github.com/spectralDNS/spectralDNS) provide important prior art. Our choices and independent tests are described in [Numerics](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/numerics.md).
185
+
186
+ Use `JAX_ENABLE_X64=1` and `dtype="float64"` for tighter numerical checks. FP64 is not arbitrary precision. See [JAX’s default-dtype documentation](https://docs.jax.dev/en/latest/default_dtypes.html). The convenience API checks timestep estimates on the host; use `SpectralSolver.integrate` for compiled fixed-step loops and differentiation. An adaptive timestep cannot rescue inadequate spatial resolution.
187
+
188
+ ## Position among existing libraries
189
+
190
+ | Need today | Existing project worth examining | This project’s role |
191
+ |---|---|---|
192
+ | Differentiable simulation with multiple ML backends | [PhiFlow](https://github.com/tum-pbs/PhiFlow) | Construction-focused evaluation and an approachable periodic solver |
193
+ | Compressible and two-phase differentiable CFD | [JAX-Fluids](https://arxiv.org/abs/2203.13760) | Different equation/domain scope; those features are not implemented here |
194
+ | Distributed pseudospectral DNS | [spectralDNS](https://github.com/spectralDNS/spectralDNS) | Single-device JAX reference and diagnostics |
195
+ | Historical JAX finite-volume/spectral research | [JAX-CFD](https://github.com/google/jax-cfd) | Useful prior art; its README now states it is no longer maintained |
196
+ | Mathematical certificates for the new result | [NavierStokesAndEuler](https://github.com/openai/NavierStokesAndEuler) | Numerical component evaluation, not a substitute for proof checking |
197
+
198
+ Becoming a widely trusted library requires reliable examples, stable interfaces, independent validation, documented failure modes, and sustained maintenance. That is the development direction, not a release claim.
199
+
200
+ ## NVIDIA Warp and Read the Docs
201
+
202
+ **Warp:** a promising optional kernel backend, with no performance claim yet. Keep the JAX reference and evaluate targeted kernels first; Warp’s JAX autodiff integration has documented restrictions. [Warp JAX interoperability](https://nvidia.github.io/warp/stable/user_guide/interoperability/jax.html).
203
+
204
+ **Read the Docs:** configuration and a Sphinx/MyST site are included. The local build is tested; hosted deployment is **Not Yet Tested / Not Connected**. [Build instructions and assessment](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/platforms.md), [Read the Docs Sphinx guide](https://docs.readthedocs.com/platform/stable/intro/sphinx.html).
205
+
206
+ ## Blender
207
+
208
+ Blender remains a possible presentation frontend for the flagship, rather than the initial killer application. Blender documents OpenVDB volume sequences and Mantaflow cache/script workflows. This repository currently exports NPZ and VTK; it has **no Blender cache integration**. [Blender volume objects](https://docs.blender.org/manual/en/4.5/modeling/volumes/introduction.html), [fluid cache](https://docs.blender.org/manual/en/4.5/physics/fluid/type/domain/cache.html), [OpenVDB Python API](https://www.openvdb.org/documentation/doxygen/python.html).
209
+
210
+ ## Builds and releases
211
+
212
+ GitHub Actions tests Python 3.12/3.13, builds the documentation, builds and checks wheel/source distributions, and exercises the installed wheel. Matching `v*` tags run the same validation before publishing to PyPI through Trusted Publishing, then attaching the same distributions, documentation, and checksums to a GitHub Release. No stored PyPI API token is needed. See [the release workflow](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/releases.md) and [PyPI's Trusted Publishing guide](https://docs.pypi.org/trusted-publishers/using-a-publisher/). Read the Docs hosting is not connected.
213
+
214
+ ## Sources and provenance
215
+
216
+ The shared conversation was extracted with the existing `chatgpt-import-share` checkout. The [Markdown transcript](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.md), [structured export](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/conversation.json), and [source manifest](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/source-manifest.json) preserve provenance and redacted/unavailable-message markers. The conversation is a design input, not independent evidence for its claims.
217
+
218
+ The manifest pins the inspected Lean commit and records the paper hash. Read the [research note](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/research.md) and [annotated sources](https://github.com/james-coder/navier-stokes-blowup/blob/main/docs/sources.md) for the implementation decisions and unresolved questions. [Contributing](https://github.com/james-coder/navier-stokes-blowup/blob/main/CONTRIBUTING.md) describes the evidence required for new features. Code is MIT licensed; the imported conversation and referenced third-party works retain their respective rights.
@@ -0,0 +1,46 @@
1
+ # API guide
2
+
3
+ All primary names are imported from `ns_blowup`. Python docstrings describe arguments and array conventions. Version 0.1 is a preview; additions should preserve these conventions, and breaking changes must be called out before release.
4
+
5
+ | API | Purpose | Returns |
6
+ |---|---|---|
7
+ | `Simulation(shape, nu=..., lengths=..., dtype=..., device=...)` | Friendly simulation setup | Simulation object |
8
+ | `sim.run(initial, t_end=..., frames=..., dt=..., forcing=...)` | Adaptively evolve a flow | `SimulationResult` |
9
+ | `SimulationResult.load(path)` | Read a saved NPZ without pickle | Result object |
10
+ | `result.final` | Last saved velocity | JAX array |
11
+ | `result.diagnostics()` | Per-frame energy, speed, curl and divergence maxima | Dictionary of NumPy arrays |
12
+ | `result.plot(quantity=..., path=...)` | 2D image or middle xy slice in 3D | Matplotlib Axes |
13
+ | `result.save(path)` | NPZ with grid, time and metadata | Path |
14
+ | `result.export_vtk(path, frame=-1)` | Legacy structured-point velocity export | Path |
15
+ | `PeriodicGrid(shape, lengths=None)` | Endpoint-excluding 2D/3D box | Grid object |
16
+ | `grid.points(dtype=None)` | Coordinates in physical units | `(*shape, dimension)` array |
17
+ | `SpectralSolver(grid, nu=...)` | Compilable periodic solver | Solver object |
18
+ | `solver.project(u)` | Truncate and make velocity divergence free | Velocity array |
19
+ | `solver.rhs(u, t=..., forcing=...)` | Semidiscrete time derivative | Velocity array |
20
+ | `solver.step(u, t, dt, forcing=None)` | One RK4 step; caller controls positive stable dt | Velocity array |
21
+ | `solver.integrate(u, dt, steps, t0=..., forcing=..., save_every=...)` | Fixed-step differentiable evolution | Final velocity, or `(times, frames)` |
22
+ | `solver.pressure(u, t=..., forcing=...)` | Recover zero-mean pressure | Scalar grid array |
23
+ | `solver.divergence(u)`, `solver.vorticity(u)` | Fourier diagnostics | Scalar/vector grid array |
24
+ | `solver.suggest_dt(u, safety=0.4)` | Instantaneous step estimate | Scalar |
25
+ | `TaylorGreen(nu=..., amplitude=..., wavenumber=...)` | Exact 2D vortex, with optional 3D embedding | Field object |
26
+ | `ABCFlow(nu=..., a=..., b=..., c=..., wavenumber=...)` | Exact 3D Beltrami flow | Field object |
27
+ | `FieldDiagnostics(velocity, pressure, nu, forcing=None)` | Autodiff diagnostics | Diagnostic object |
28
+ | `checks.residual(points,t)`, `.divergence(...)`, `.vorticity(...)`, `.gradient(...)` | Batched analytical checks | JAX array |
29
+ | `kinetic_energy(u, grid)` | Integral energy estimate | Scalar |
30
+ | `sampled_norms(u, omega, gradient)` | Sampled norm maxima | Dictionary |
31
+ | `SimilarityCoordinates(h=0.005)(xyz,tau)` | Positive-branch similarity coordinates | Named tuple `(q, eta, X)` |
32
+ | `SimilarityCoordinates(h).scales(tau)` | Unit-normalized power laws | Dictionary |
33
+ | `ViscosityScaled(base, nu)` | Rescale a supplied viscosity-one field | Field object |
34
+ | `HeatExterior(h=..., c=..., nu=..., order=...)` | Outer-flow quadrature, away from axis | Field object |
35
+ | `exterior.factor(Z)` | Heat-factor integral approximation | Scalar/batched array |
36
+ | `exterior.azimuthal_velocity(radius,tau)` | Swirl speed with direct time remaining | Scalar/batched array |
37
+
38
+ Analytical field objects expose `.velocity(points,t)`, `.pressure(points,t)`, and `.forcing(points,t)`. Diagnostics require callbacks that accept a **single point** and return respectively `(d,)`, `()`, and `(d,)`; the supplied field objects also support batches. Time is scalar per evaluation. Use `jax.vmap` for multiple times.
39
+
40
+ Simulation initial callbacks accept the **whole point grid** and return a velocity grid. Solver forcing callbacks accept `(points, time)` and must return exactly the velocity-grid shape. Uniform forces should explicitly broadcast to that shape.
41
+
42
+ Choose `device="gpu"` to require a GPU, `"cpu"` to require CPU, or `"auto"` to use JAX's default. `JAX_PLATFORMS` can restrict which backends exist in a process. A required unavailable device produces an error, rather than a hidden fallback. The observatory generator is the exception: it prefers CPU for its small report and uses the enabled device if CPU is disabled.
43
+
44
+ Construct grids, solver objects, and quadrature objects outside JIT. Close over them in a compiled function; keep `steps` and `save_every` static. The friendly `Simulation.run` driver, plotting, filesystem operations, and data loading are host APIs and do not belong inside JIT.
45
+
46
+ Positive `tau` is required for similarity coordinates; the heat exterior permits `tau=0` only at positive radius. Invalid mathematical-domain inputs return NaN even under JIT. Validate evaluation ranges before large batched work. Geometry h is a selected static parameter; this library does not supply the theorem's complete parameter-selection machinery.
@@ -0,0 +1,18 @@
1
+ """Documentation-only build: no GPU runtime or simulation execution required."""
2
+ from pathlib import Path
3
+ import os
4
+
5
+ project = "ns-blowup"
6
+ author = "ns-blowup contributors"
7
+ release = "0.1.0"
8
+ extensions = ["myst_parser", "sphinx.ext.mathjax"]
9
+ myst_enable_extensions = ["dollarmath", "colon_fence"]
10
+ source_suffix = {".md": "markdown"}
11
+ exclude_patterns = ["conversation.md", "_build", "requirements.txt"]
12
+ html_theme = "sphinx_rtd_theme"
13
+ html_title = "ns-blowup — Singularity Observatory"
14
+ html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
15
+ # Preserve source artifacts as downloads without parsing the imported conversation.
16
+ root = Path(__file__).parent
17
+ html_extra_path = [p.name for p in root.iterdir() if p.suffix in (".json", ".txt", ".html")
18
+ and p.name != "requirements.txt"] + ["conversation.md"]