Geometries

From the channel to the ball

Every geometry speaks the same language: you name the domain, write the same equations, and name the boundaries where conditions hold. Conatus chooses the bases that belong to the geometry, regular at the axis and at the centre, and prints them with explain().

Declaring a domain

A geometry is one line. The rest of the model does not depend on it: the same equation in a box or in a ball differs only by this line and by the boundary names.

a model on a disk
import conatus as cn

disk = cn.Disk(1.0)                       # coordinates (phi, r), boundary "wall"
m = cn.Model(disk, name="heat in a disk", kappa=1.0)
T = m.scalar("T")
m.equations("dt(T) - kappa*lap(T) = 0")
m.at("wall", T=0)
print(m.explain())                        # bases, conditions and their placement

The geometries

Box

cn.Box(x=cn.periodic(2.0), z=cn.walls(-0.5, 0.5))

Periodic directions and at most one direction between two walls. Fourier along periodic axes, Chebyshev between walls, or sine and cosine series (basis="sincos") when the walls are stress-free or held at a fixed value.

Coordinates x, z (one to three axes, in the order written)
Boundaries bottom, top, walls (or z=-0.5, z=0.5)

Convection, Couette flow, boundary layers, pattern formation.

Lines, half lines and compound intervals

cn.Box(x=cn.periodic(2.0), y=cn.half_line(scale=0.5))

Unbounded directions with the decay built into the basis (Hermite functions on the line, Laguerre functions on the half line); a width you choose, like a resolution. An interval cut into pieces, cn.walls(-1, -0.15, 0.15, 1), puts modes where a thin layer needs them, with continuity across the cuts added for you.

Coordinates as named in the box
Boundaries wall (the half line); none on cn.line(scale=...)

Boundary layers over a plate, localised waves, fronts and interior layers.

Channel

cn.Channel(2 * math.pi, math.pi)

A box with walls at y = ±1, periodic in x and, in 3D, in z.

Coordinates x, y, z (2D without the second length)
Boundaries bottom, top, walls

Plane Poiseuille and Couette flow, turbulent channels.

Disk

cn.Disk(1.0)

Regular at the centre by construction: no axis condition to add, nothing singular to guard against.

Coordinates phi, r
Boundaries wall

Vortices, rotating tanks, flows in a circular cross-section.

Annulus

cn.Annulus(1.0, 2.0)

The gap between two circles.

Coordinates phi, r
Boundaries inner, outer, walls

Taylor–Couette flow in a cross-section, rotating shear flows.

Sphere

cn.Sphere(1.0)

The surface of a sphere, regular at both poles.

Coordinates phi, theta
Boundaries none

Shallow water, planetary waves, atmospheres.

Spherical shell

cn.Shell(0.35, 1.0)

The space between two spheres, where planets and stars convect. Simulations on a CPU or a GPU, exact adjoints and optimal perturbations, and rotating convection ready to run; the wall conditions are written in a form that stays stable at any radial resolution, and checked before the first step.

Coordinates phi, theta, r
Boundaries inner, outer, walls

Rotating convection, dynamos, mantle and core flows, rotating shells.

Spherical shells in the user guide →

Ball

cn.Ball(1.0)

The full sphere, regular at the centre by construction.

Coordinates phi, theta, r
Boundaries wall

Flows in a spherical container, stellar interiors.

Every wall takes rigid or stress-free conditions (u=cn.free_slip), curved walls included. Mapped bases, other polynomial families and hand-chosen bases are available in the expert layer; see the user guide. The gap between two rotating cylinders is cn.TaylorCouette(ri, ro, length); pipe flow and Taylor–Couette flow are also ready problems (cn.problems), as native models in cn.problems.native. To see the geometries at work, open the gallery.