Spectral PDEs · Dynamical systems · GPU
Write the equations.
Conatus finds the structure.
A spectral framework for partial differential equations and the dynamical systems they define, native on GPUs. Write the equations as on paper, simulate them, find where the flow becomes unstable, follow its orbits and bifurcations.
Version 0.1.1 · CPU supported, GPU in beta · source on GitHub · install: pip install conatus (Install)
A Kelvin–Helmholtz shear layer rolling up: an illustration computed in your browser by a simple WebGL grid scheme, not by the Conatus spectral solver. The films below are Conatus runs.
In motion
Computed with Conatus
Each film is a Conatus run, frame by frame: a shear layer rolling up, and heavy fluid falling into light fluid.
Kelvin–Helmholtz billowsPassive dye between two shear layers rolling up, Re = 400, t = 2 to 9.95. 384 × 192 Fourier modes, RK443, dt = 0.0025, CPU. The last frames cross-fade into the first where the film loops: a display transition, not part of the run. Rayleigh–Taylor instabilityHeavy fluid falling into light fluid, Ra 1e7, computed with Conatus. The film fades through black where it loops: a display transition, not part of the run.
Write
The equation on the page is the equation that runs
Conatus reads the problem as mathematics, compiles it for the CPU or the GPU, and tells you exactly what it did. Nothing changes behind your back. Below, the first tutorial as it ran, and what it printed.
line = cn.Box(y=cn.walls(-1, 1)) # wall-normal coordinate y in [-1, 1]
m = cn.Model(line, name="Orr-Sommerfeld", Re=1e4, alpha=1.0)
m.scalar("v") # v(y) exp(i alpha (x - c t)), wall-normal velocity
m.given(U=lambda y: 1 - y**2) # plane Poiseuille base flow (depends on y)
m.eigenvalue("c", growth="imag") # wave speed c: a mode grows with Im c
m.define("L2(f) = dy(dy(f)) - alpha**2*f") # D^2 - alpha^2
m.equations("Orr_Sommerfeld: L2(L2(v))/(1j*alpha*Re) - U*L2(v) + dy(dy(U))*v + c*L2(v) = 0")
m.at("walls", "v = 0", "dy(v) = 0") # rigid walls at y = -1 and y = 1
print(m.explain(full=True)) # every automatic decision (taus, modes)
res = m.eigenvalues(N=64, drift=96, drift_tol=1e-6) # keep modes found again at N = 96
i = int(res.values.imag.argmax()) # least stable surviving mode
print(res.explain(key="imag"))
print(f"c = {res.values[i]:.10f} backward residual {res.residuals[i]:.1e}")c = 0.2375264888+0.0037396706j backward residual 1.4e-16
Re_c = 5772.2218 alpha_c = 1.020547
[PASS] right residual: 5.16e-20 (threshold 1e-12) — ||(L + sigma M) x|| backward error
[PASS] spectral tail: 1.72e-10 (threshold 1e-08) — last 4 Chebyshev coefficients / max (mode resolved in N)
OK: c and Re_c agree with Orszag (1971) to the published digits; alpha_c within 2e-5
- Declare the domain, the fields and the equations, as written on paper.
- Discretise and check. A rank report refuses a missing or extra boundary condition before anything runs.
- Solve, and see how far to trust it. Every result comes with its own checks.
What it does
From the equations to the structure of the flow
Write
Equations as on paper
Declare the domain, the fields and the equations in their usual form; name the boundaries and say what holds there. Conatus places the rest and tells you what it did.
Simulate
On a CPU or a GPU
The same model runs on your laptop or on a GPU with one keyword. Resolution, scheme and time step are always yours to choose.
Analyse
Where a flow becomes unstable
Eigenvalues with their residuals, critical parameters, exact adjoints, transient growth and Floquet analysis of time-periodic flows.
Discover
Orbits and bifurcations
Equilibria, travelling waves and periodic orbits by Newton–Krylov; branches followed through folds, pitchforks and Hopf points.
Keep track
Runs you choose to record
Ask for it (record=True, or cn.runs.track) and the parameters, code version and results of a run are kept, so you can find it, compare it and reproduce it later.
Get started
Install, learn, read, cite
Install it, work through the tutorials, then find each part described once in the documentation.
pip install conatusCPU wheel with the compiled core, no compiler needed; a CUDA 12 wheel for NVIDIA GPUs (beta). python -m conatus doctor says what this machine can run.LearnTutorialsExecuted tutorials, each ending on a published result: start with 0, getting started.ReadDocumentationThe user guide, the API reference and the mathematics behind each method.CiteCitingCITATION.cff and BibTeX. Licence: BSD-3-Clause.NextComing nextMulti-GPU runs, the Studio from anywhere and further stability tools: under development, not in this release.