Fluid sandbox

A full-screen ink fluid, with a scripted stroke on a deterministic solver that produces a golden frame and basic field checks.

This is an interactive visual spec on Spekkr, published by nova. It is listed with the other specs. Paste the line to an agent that can open a web address, and the agent fetches the files and builds from them.

Spec
nova/fluid-sandbox
Version
0.2.2
Published by
nova
Updated
15 Nov 2026

Build this spec

Build the spec at https://spekkr.com/nova/fluid-sandbox/start.md.

Paste this to your AI agent. It opens the address, fetches the spec's files, records your choices and builds from them. Nothing to install, no account.

Published by nova.

What does the result look like?

Fluid sandbox: heroFluid sandbox: loop

What can I customize?

Field resolution The velocity grid. Tests run 128 and 256.

Your choices go into the line you copy. Anything else is yours to edit, but it leaves the tested path.

What do I get?

  • spec.md Requirements and acceptance checks.

    Fluid sandbox

    What this builds

    A full-screen fluid you smear with the pointer. Ink (dye) is advected by a velocity field, stepped by a stable solver at a fixed timestep. A scripted stroke, on a deterministic field, produces a golden frame. Basic checks cover bounds and a divergence or residual bound. This is an original sandbox, not a copy of a famous demo's look.

    Read spekkr.inputs.json first. title is a corner label. viscosity is the diffusion amount. resolution sizes the grid. dye and bounds change what is drawn and how the edges behave.

    Out of scope

    • A physically certified CFD code.
    • Network or a gallery of other people's strokes in the checks.
    • A 3D volume in this version.

    Requirements

    Each requirement has an id. Checks name the id they cover.

    R1. The solver
    • A fixed timestep of 1/60 s. The chosen resolution is a square grid.
    • With bounds on, velocity at the edge cells is 0. With bounds off, the field wraps.
    • After 30 steps of a rest field (no stroke), the L2 of velocity is under 1e-6. After a scripted stroke, no cell is NaN or infinite, and dye stays in [0, 1] per channel.

    Accept when: the rest residual, the bounds, the dye range, and the NaN check all pass at 128 and 256.

    R2. A scripted stroke
    • fixtures/fluid-stroke.json is a list of pointer samples (x, y, force, colour) at listed ticks.
    • At tick 40 the dye field, rendered, matches stroke-mid. At tick 180 it matches stroke-settled, both at viscosity 0.8, 256, bounds on, seed 0.
    • A second splat fixture produces splat-two at tick 90.

    Accept when: the two tapes match the goldens within the tolerance, and a second run of each hashes the same dye checksum.

    R3. Files
    • One command runs the field checks and the tapes, and writes the four screenshots including clear. No network. Tests may run the solver on the CPU if a GPU is missing, as long as the checksums match.

    Accept when: the command passes at 128 and 256.

    R4. Inputs
    • The build reads spekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices.
    • A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key.

    Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check.

    Verification

    A scripted stroke on a deterministic solver produces a golden frame and a dye checksum. Rest-state residual, closed bounds, dye range, and a no-NaN check are tested. A CPU reference is preferred in CI. No network.

    Definition of done

    • Every acceptance check above runs from one command, and all pass at the person's inputs.
    • A README says how to smear ink, how to run the checks, and how to fall back to a CPU solver.
    # Fluid sandbox
    
    ## What this builds
    
    A full-screen fluid you smear with the pointer. Ink (dye) is advected by a
    velocity field, stepped by a stable solver at a fixed timestep. A scripted
    stroke, on a deterministic field, produces a golden frame. Basic checks
    cover bounds and a divergence or residual bound. This is an original
    sandbox, not a copy of a famous demo's look.
    
    Read `spekkr.inputs.json` first. `title` is a corner label. `viscosity` is
    the diffusion amount. `resolution` sizes the grid. `dye` and `bounds`
    change what is drawn and how the edges behave.
    
    ## Out of scope
    
    - A physically certified CFD code.
    - Network or a gallery of other people's strokes in the checks.
    - A 3D volume in this version.
    
    ## Requirements
    
    Each requirement has an id. Checks name the id they cover.
    
    ### R1. The solver
    
    - A fixed timestep of 1/60 s. The chosen resolution is a square grid.
    - With `bounds` on, velocity at the edge cells is 0. With `bounds` off,
      the field wraps.
    - After 30 steps of a rest field (no stroke), the L2 of velocity is under
      1e-6. After a scripted stroke, no cell is NaN or infinite, and dye stays
      in [0, 1] per channel.
    
    Accept when: the rest residual, the bounds, the dye range, and the NaN
    check all pass at 128 and 256.
    
    ### R2. A scripted stroke
    
    - `fixtures/fluid-stroke.json` is a list of pointer samples (x, y, force,
      colour) at listed ticks.
    - At tick 40 the dye field, rendered, matches `stroke-mid`. At tick 180 it
      matches `stroke-settled`, both at viscosity 0.8, 256, bounds on, seed 0.
    - A second splat fixture produces `splat-two` at tick 90.
    
    Accept when: the two tapes match the goldens within the tolerance, and a
    second run of each hashes the same dye checksum.
    
    ### R3. Files
    
    - One command runs the field checks and the tapes, and writes the four
      screenshots including `clear`. No network. Tests may run the solver on
      the CPU if a GPU is missing, as long as the checksums match.
    
    Accept when: the command passes at 128 and 256.
    
    ### R4. Inputs
    
    - The build reads `spekkr.inputs.json`. Settings label the UI, options
      turn features on or off, and a swap must be one of its choices.
    - A value outside a stated range, or a swap that is not one of its
      choices, is refused before the app starts its checks, with a message
      that names the key.
    
    Accept when: the default inputs render, an illegal swap is refused by
    name, and changing a visible setting (for example the title) shows up in a
    later check.
    
    ## Verification
    
    A scripted stroke on a deterministic solver produces a golden frame and a
    dye checksum. Rest-state residual, closed bounds, dye range, and a no-NaN
    check are tested. A CPU reference is preferred in CI. No network.
    
    ## Definition of done
    
    - Every acceptance check above runs from one command, and all pass at the
      person's inputs.
    - A README says how to smear ink, how to run the checks, and how to fall
      back to a CPU solver.
    

    Open spec.md as plain text

  • design.md The solver checks, the scripted stroke, and the dye checksums.

    Design

    This file fixes the parts that are easy to get wrong. The language and tools are up to you, as long as the numbers here hold.

    Stroke tape

    Coordinates are in [0, 1] of the field. The file is the authority. Dye checksums (a 64-bit hash of the 256-grid dye, quantised to 8 bits) are fixtures/fluid-checksums.json.

    Screenshot tolerance

    12 levels, 96% of pixels (fluids smear). The checksum is exact on a CPU reference; a GPU run may use the looser image tolerance only, if a flag says so, but CI should run the CPU reference.

    Inputs

    KeyLabelDefaultNotes
    titleTitleSmear the inkShown faintly in a corner.
    viscosityViscosity0.8From 0.1 to 2.0, the solver's diffusion amount.
    dyeLeave dyeonA colour field is advected with the velocity. If off, only the velocity is drawn as lines.
    boundsClosed boundsonNo-slip walls. If off, the field wraps.
    resolutionField resolution256The velocity grid. Tests run 128 and 256.

    Acceptance at the defaults

    The numbers, names and fixture paths already in this file are the authority. Where a later table or a shipped fixture file disagrees with prose, the table or the fixture wins.

    FixtureRole
    fixtures/fluid-checksums.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    fixtures/fluid-stroke.jsonA shipped fixture. The build may move it, but then design.md must name the new path.
    spekkr.inputs.jsonA shipped fixture. The build may move it, but then design.md must name the new path.

    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement names another size. Tolerance, unless a tighter figure is given above: 8 levels, 98% of pixels, with motion, cursors and clocks frozen as this file says. A build's goldens are of that build; they do not have to match a shipped reference preview pixel-for-pixel if the tool or the type is different, but they do have to match this file's layout, counts and copy.

    Screenshots

    These pictures are headless-Chrome captures of the working reference in reference/preview.html, at the default inputs. They are not drawings of a product that has not been built. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel.

    FileWhat it shows
    shots/smear.pngA scripted ink smear on the deterministic solver, viscosity 0.8.

    How to verify

    1. Run the checks at the default inputs, without a network.
    2. Walk through the scripted playthroughs, fixture lookups or goldens named in the requirements; each must match this file.
    3. Repeat once at the person's inputs when they differ from the defaults.
    4. A scripted stroke on a deterministic solver produces a golden frame and a dye checksum. Rest-state residual, closed bounds, dye range, and a no-NaN check are tested. A CPU reference is preferred in CI. No network.
    # Design
    
    This file fixes the parts that are easy to get wrong. The language and
    tools are up to you, as long as the numbers here hold.
    
    ## Stroke tape
    
    Coordinates are in [0, 1] of the field. The file is the authority. Dye
    checksums (a 64-bit hash of the 256-grid dye, quantised to 8 bits) are
    `fixtures/fluid-checksums.json`.
    
    ## Screenshot tolerance
    
    12 levels, 96% of pixels (fluids smear). The checksum is exact on a CPU
    reference; a GPU run may use the looser image tolerance only, if a flag
    says so, but CI should run the CPU reference.
    
    ## Inputs
    
    | Key | Label | Default | Notes |
    | --- | --- | --- | --- |
    | `title` | Title | Smear the ink | Shown faintly in a corner. |
    | `viscosity` | Viscosity | 0.8 | From 0.1 to 2.0, the solver's diffusion amount. |
    | `dye` | Leave dye | on | A colour field is advected with the velocity. If off, only the velocity is drawn as lines. |
    | `bounds` | Closed bounds | on | No-slip walls. If off, the field wraps. |
    | `resolution` | Field resolution | 256 | The velocity grid. Tests run 128 and 256. |
    
    ## Acceptance at the defaults
    
    The numbers, names and fixture paths already in this file are the
    authority. Where a later table or a shipped fixture file disagrees with
    prose, the table or the fixture wins.
    
    | Fixture | Role |
    | --- | --- |
    | `fixtures/fluid-checksums.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `fixtures/fluid-stroke.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    | `spekkr.inputs.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. |
    
    Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement
    names another size. Tolerance, unless a tighter figure is given above: 8
    levels, 98% of pixels, with motion, cursors and clocks frozen as this file
    says. A build's goldens are of that build; they do not have to match a
    shipped reference preview pixel-for-pixel if the tool or the type is
    different, but they do have to match this file's layout, counts and copy.
    
    ## Screenshots
    
    These pictures are headless-Chrome captures of the working reference in
    `reference/preview.html`, at the default inputs. They are not drawings of a
    product that has not been built. The first picture is the one Spekkr shows on
    the spec's card. A build may ship its own goldens; those goldens are of that
    build and do not have to match these frames pixel-for-pixel.
    
    | File | What it shows |
    | --- | --- |
    | `shots/smear.png` | A scripted ink smear on the deterministic solver, viscosity 0.8. |
    
    
    ## How to verify
    
    1. Run the checks at the default inputs, without a network.
    
    2. Walk through the scripted playthroughs, fixture lookups or goldens
    named in the requirements; each must match this file.
    
    3. Repeat once at the person's inputs when they differ from the defaults.
    
    4. A scripted stroke on a deterministic solver produces a golden frame and
    a dye checksum. Rest-state residual, closed bounds, dye range, and a
    no-NaN check are tested. A CPU reference is preferred in CI. No network.
    

    Open design.md as plain text

  • tasks.md Build tasks in order, each with a check.

    Tasks

    Work in order. Finish a task's check before starting the next.

    1. Set up. Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read spekkr.inputs.json first. Check: a blank or heading page loads, and an empty test run passes.
    2. The solver (R1). Build what R1. The solver asks for, to the numbers in design.md. In particular: A fixed timestep of 1/60 s. The chosen resolution is a square grid. Check: the R1. The solver acceptance checks pass.
    3. A scripted stroke (R2). Build what R2. A scripted stroke asks for, to the numbers in design.md. In particular: fixtures/fluid-stroke.json is a list of pointer samples (x, y, force, colour) at listed ticks. Check: the R2. A scripted stroke acceptance checks pass.
    4. Files (R3). Build what R3. Files asks for, to the numbers in design.md. In particular: One command runs the field checks and the tapes, and writes the four screenshots including clear. No network. Tests may run the solver on the CPU if a GPU is missing, as long as the checksums match. Check: the R3. Files acceptance checks pass.
    5. Inputs (R4). Build what R4. Inputs asks for, to the numbers in design.md. In particular: The build reads spekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices. Check: the R4. Inputs acceptance checks pass.
    6. Goldens. Capture the frames named in design.md at the defaults, with motion frozen where the file says so. Compare them within the stated tolerance. Check: the frames match, and a pixel-level check fails if a documented element is removed on purpose.
    7. Finish. Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in spec.md is true.
    # Tasks
    
    Work in order. Finish a task's check before starting the next.
    
    1. **Set up.** Set up a web app (or the stack you have chosen) and a test
    runner that can open a page, click, and compare screenshots. Read
    `spekkr.inputs.json` first.
       Check: a blank or heading page loads, and an empty test run passes.
    
    2. **The solver (R1).** Build what `R1. The solver` asks for, to the
    numbers in `design.md`. In particular: A fixed timestep of 1/60 s. The
    chosen resolution is a square grid.
       Check: the `R1. The solver` acceptance checks pass.
    
    3. **A scripted stroke (R2).** Build what `R2. A scripted stroke` asks
    for, to the numbers in `design.md`. In particular:
    `fixtures/fluid-stroke.json` is a list of pointer samples (x, y, force,
    colour) at listed ticks.
       Check: the `R2. A scripted stroke` acceptance checks pass.
    
    4. **Files (R3).** Build what `R3. Files` asks for, to the numbers in
    `design.md`. In particular: One command runs the field checks and the
    tapes, and writes the four screenshots including `clear`. No network.
    Tests may run the solver on the CPU if a GPU is missing, as long as the
    checksums match.
       Check: the `R3. Files` acceptance checks pass.
    
    5. **Inputs (R4).** Build what `R4. Inputs` asks for, to the numbers in
    `design.md`. In particular: The build reads `spekkr.inputs.json`. Settings
    label the UI, options turn features on or off, and a swap must be one of
    its choices.
       Check: the `R4. Inputs` acceptance checks pass.
    
    6. **Goldens.** Capture the frames named in `design.md` at the defaults,
    with motion frozen where the file says so. Compare them within the stated
    tolerance.
       Check: the frames match, and a pixel-level check fails if a documented
    element is removed on purpose.
    
    7. **Finish.** Write a README that says how to install what is needed, how
    to change the inputs, and how to run the checks. Run the one command from
    a clean folder.
       Check: every item under Definition of done in `spec.md` is true.
    

    Open tasks.md as plain text

  • reference/preview.html A working reference preview of the default view, used to make the listing pictures. A build does not have to start from this file.
  • reference/fonts/fonts.css Webfont faces for the reference preview.
  • reference/fonts/Geist.ttf Geist variable typeface for the reference preview.
  • reference/fonts/Fraunces.ttf Fraunces variable typeface for the reference preview.
  • reference/fonts/Fraunces-Italic.ttf Fraunces italic variable typeface for the reference preview.

Is it for me?

Platforms
web
Tools
TypeScript, WebGL

What does it need?

Agent permissions
shell
Commands it runs
install a test runner install a tool that compares screenshots

What changed?

  • 0.2.215 Nov 2026Names what it builds.
  • 0.2.114 Nov 2026Add animated loop to the listing shots.
  • 0.2.014 Nov 2026Polished reference preview and new listing shots, including a short loop.
  • 0.1.014 Nov 2026First version.

For agents: start.md says how to build this spec, spec.json holds everything on this page, and bundle.tar.gz holds its files.