User layer: import conatus as cn

import conatus as cn

import conatus is light: nothing heavy (solvers, compiled core, GPU) is loaded until it is used. The names below are reached as cn.<name>.

Geometries

A geometry fixes the coordinates, the spectral bases (chosen once per geometry, printed by explain()) and the names of the boundaries used by Model.at.

Box

Cartesian box: Box(x=periodic(2.0), z=walls(-0.5, 0.5)); 1 to 3 axes in keyword order.

Channel

Plane channel: x periodic of length Lx, walls at y = -h and y = +h, and z periodic of length Lz in 3D (coordinates in the order x, y, z; boundaries "bottom"/"top"/"walls").

Disk

Disk r <= R: PolarCoordinates(phi, r), RealFourier(phi) x DiskBasis(r) (regular at the axis, no axis condition).

Annulus

Annulus ri <= r <= ro: RealFourier(phi) x AnnulusBasis(r).

Pipe

Pipe (cylinder) r <= R, z periodic of length L: CylindricalCoordinates(phi, r, z), RealFourier(phi) x DiskBasis(r) x ComplexFourier(z).

Sphere

Sphere surface of radius R: S2Coordinates(phi, theta), RealFourier(phi) x SphereBasis(theta).

Ball

Ball r <= R: SphericalCoordinates(phi, theta, r), RealFourier x SphereBasis x BallBasis (regular at the centre).

Shell

Spherical shell ri <= r <= ro: RealFourier x SphereBasis x ShellBasis.

TaylorCouette

Annular cylinder ri <= r <= ro, z periodic of length L (Taylor–Couette geometry): CylindricalCoordinates(phi, r, z), RealFourier(phi) x AnnulusBasis(r) x ComplexFourier(z).

MappedBox

Channel between two surfaces over periodic axes: MappedBox(x=periodic(L), z=between(b, t)) (2D) or MappedBox(x=periodic(Lx), y=periodic(Ly), z=between(b, t)) (3D).

periodic

Periodic axis of length L ([0, L)) or on (a, b); complex=True uses complex exponentials (ComplexFourier) instead of the real cos/sin series (RealFourier).

walls

Bounded axis [a, b] (walls at a and b); walls(a, c, ..., b): a compound interval.

line

The whole line, discretized with Hermite functions psi_n((x - center)/scale) (no boundary, no condition: the functions decay like a Gaussian).

half_line

The half line x >= start, discretized with Laguerre functions of (x - start)/scale; the wall at start takes boundary conditions (named "wall", "x=start" and "bottom").

between

Vertical axis from the surface bottom up to the surface top of a MappedBox: each a number (a flat wall) or a callable of the periodic coordinates (lambda x: 0.1*cos(x), lambda x, y: ...), smooth and periodic; top > bottom everywhere.

cn.Cylinder is another name for cn.Pipe.

Wall conditions on a vector unknown

Named conditions for m.at(...) (guide: Boundary conditions).

no_slip

A named wall condition on a vector unknown (cn.free_slip, cn.no_slip).

free_slip

A named wall condition on a vector unknown (cn.free_slip, cn.no_slip).

navier_slip

Navier partial-slip wall condition u·n = 0, u_t + l dn(u_t) = 0 (dn: outward normal derivative), for m.at(wall, u=cn.navier_slip(l)) on plane walls.

The model

Model

A PDE model on a geometry, declared as on paper.

What the model returns:

Simulation

Time integration of a compiled IVP (Model.simulate): scheme and dt are explicit.

Linearization

Normal modes of a model about a base state (Model.linearize(about=...)).

Compiled

The IR problem of a model at one resolution, with the record of every automatic choice.

Ready problems: cn.problems

Canonical flows written once, each returning an ordinary problem with its handles and the reference it reproduces.

channel

3D plane channel (Poiseuille) flow, incompressible Navier–Stokes, as an IVP.

channel_evp

Orr–Sommerfeld EVP of plane Poiseuille flow U = 1 - y^2 (2D modes).

plane_couette

3D plane Couette flow, incompressible Navier–Stokes, as an IVP.

plane_couette_evp

Orr–Sommerfeld EVP of plane Couette flow U = y (2D modes), same form as channel_evp() (U'' = 0): eigenvalue c, v = v' = 0 at y = -1, +1, Re = U_w h / nu.

rayleigh_benard

2D Rayleigh–Benard convection between rigid, fixed-temperature plates (Boussinesq), IVP.

rayleigh_benard_evp

Linear onset of Rayleigh–Benard convection: normal modes exp(i k x + s t) of the conduction state, same equations and units as rayleigh_benard() (z in [-1/2, 1/2]).

taylor_couette

Taylor–Couette flow between rotating cylinders: perturbation u of circular Couette flow U0 = V(r) e_phi, V = A r + B / r, incompressible Navier–Stokes, IVP.

taylor_couette_evp

Linear stability of circular Couette flow: normal modes exp(i m phi + i k z + s t) of the equations of taylor_couette() (same units, u = 0 on both cylinders).

pipe

Pressure-driven pipe flow (Hagen–Poiseuille), incompressible Navier–Stokes, IVP.

pipe_evp

Linear stability of Hagen–Poiseuille flow U0 = (1 - r^2) e_z, primitive variables.

kuramoto_sivashinsky

Kuramoto–Sivashinsky equation on the periodic line (0, L), IVP.

kolmogorov

2D Kolmogorov flow on the torus [0, 2 pi]^2 (Chandler & Kerswell 2013), IVP in streamfunction form (u = psi_y, v = -psi_x, vorticity -lap(psi)).

swift_hohenberg

Swift–Hohenberg equation on a doubly periodic box, IVP (Swift & Hohenberg 1977).

rotating_shell_convection

Rotating Boussinesq convection in a spherical shell (Christensen et al. 2001 geometry and units, non-magnetic), IVP.

rotating_shell_convection_evp

Linear onset of rotating shell convection: normal modes exp(i m phi + s t) about the conduction state, equations and units of rotating_shell_convection() multiplied back by E.

Ready

A ready-to-discretize problem and its handles.

The run registry: cn.runs

Record runs, find and compare them, reproduce one bit for bit (guide: The run registry).

track

Record a block (with track("rb", tags=[""]) as run: ...) or every call of a function (@track("eig", cache=True)).

record

Record one finished computation in one call and return the closed run.

find

Runs matching every criterion, newest first.

get

One run by id or unique id prefix.

compare

Differences between two runs (ids or Run objects): parameters, numerics, results, code.

lineage

Parent chain and descendants (fork, restart, reproduce, cache reuse) of a run.

reproduce

Run the recorded computation again and compare with the recorded output.

to_dataframe

pandas DataFrame of runs (default: find(**filters)); pandas is optional.

export

Small JSON per run in dest (default selection: status="certified").

explain

Where the registry is, what it holds, and every declared constant.

Run

A registry run.

RunList

A list of Run (what find returns), with a table view.

Registry

A registry root: run directories + index.

Quantities of a run

Series, spectra and profiles of a simulation, what to watch while it runs, and the statistics of a result (guide: Diagnostics and visualization).

series

A number per callback, f(sim) (energy, a Nusselt number...); logy for its plot.

spectrum

One-sided power spectrum of a field along a periodic axis, averaged over the others: with f_k the discrete Fourier coefficients of the grid values (rfft / N), E(k) = c_k \|f_k\|^2 (c_k = 2 except k = 0 and the Nyquist mode), so that sum_k E(k) = mean(f^2) (Parseval, checked by test).

profile

Mean of a field over every coordinate but along, against the grid nodes of along (their true positions, Chebyshev nodes included).

view

Declare a view for Simulation.watch().

time_average

Mean and standard error of a stationary, correlated series (one value per sample; dt, optional, only converts tau to time units).

uncertainty

Run quantity(N=..., dt=...) (a number) on the declared studies and report its value with an error estimate: three time steps at the finest N, three resolutions at the finest dt (5 runs; the finest/finest run is shared).

StopRun

Raised inside the computation's callback when the Studio asks to stop the run.

cn.StopRun is the exception a callback raises to stop a run.

Utilities

doctor

Run every check and return the report; with file (e.g. sys.stdout) also print explain() to it.

from_dedalus

Translate a Dedalus 3 script (a path, or the source text) into Conatus.

parse_equation

Parse "lhs = rhs" into an Equation (no eval).

parse_expr

Parse one expression (no '=') into an IR expression (a number stays a Constant).

Regions of the complex plane: cn.box, cn.contour

m.eigenvalues(N, ..., region=cn.box(re=(a, b), im=(c, d))) returns every eigenvalue in the box with a certified count; cn.contour.count and cn.contour.beyn take any operator (Eigenvalues in a region).

box

The rectangle re[0] <= Re z <= re[1], im[0] <= Im z <= im[1] of the complex plane, for m.eigenvalues(..., region=cn.box(...)) and conatus.contour.

contour.count

Number of eigenvalues of T(z) in region (a conatus.contour.box()) by the argument principle, certified as an integer (module docstring).

contour.beyn

Every eigenvalue of T(z) v = 0 in region, certified (module docstring).

contour.CountResult

Number of eigenvalues of T(z) in a region, by the argument principle (count()).

contour.BeynResult

Certified eigenvalues of T(z) v = 0 in a region (beyn()).

contour.RegionEVPResult

An EVPResult restricted to a region of the eigenvalue plane: values are every eigenvalue of the discrete pencil in region (one entry per distinct eigenvalue, multiplicity gives the algebraic multiplicity) and count their number, multiplicities included, certified by the argument principle (count_method).