# Fluid lander ## What this builds A side-on lander game. The craft has mass, fuel, and a downward and a sideways thruster. The exhaust is not a sprite: it is injected into a fluid field, and if atmosphere is on the field already has a slight density. The field is stepped with a documented solver at a fixed timestep. A landing or a crash is decided by the craft's motion, not by a hidden script. Tests use a fixed timestep and a seed so a landing and a crash are deterministic. Read `spekkr.inputs.json` first. `gravity` and `fuel` set the craft. `atmosphere` and `plume` change the field and the picture. `solver` chooses how the field is stepped. ## Out of scope - A 3D world or a real-time NASA-grade solver. - Network or a replay server in the checks. - A physical wind tunnel. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. The craft - The lander is a 4 m tall, 2 m wide rectangle. Dry mass 200 kg plus `fuel`. Thrust is 800 N downward and 200 N sideways, burning 0.6 kg/s when a downward thruster is on and 0.15 kg/s when a side thruster is on. - The timestep is 1/60 s. Integration is semi-implicit Euler. - A soft landing is a contact with a pad with vertical speed under 2 m/s and tilt under 8 degrees. Anything else that hits terrain is a crash. Accept when: the vacuum ballistic drop in `design.md` (thrusters off, atmosphere off) matches the closed form within 0.05 m after 2 s. ### R2. The field - The fluid is a 128 by 96 staggered grid over a 64 by 48 m world. Density and velocity are stored. The chosen solver steps the field each tick. - A downward burn injects density and downward momentum at the listed nozzle cells. - A residual check after 60 steps of the rest-state fixture (no craft, atmosphere on or off as listed) stays under the bound in `design.md`. A mass-check on a closed box with no inflow stays within 1% of the starting mass. Accept when: the rest-state residual and the closed-box mass check pass for both solvers. ### R3. Landing and crash fixtures - `fixtures/lander-soft.json` is a control tape that, from the documented start, produces a soft landing on pad A at t = 8.0 s, with the pose in the file. - `fixtures/lander-crash.json` produces a crash on the slope at t = 5.2 s. - Both are deterministic at timestep 1/60 with atmosphere on, seed 1. Accept when: the soft fixture is a soft landing at the pose in the file, the crash fixture is a crash at the listed place, and a second run of each hashes the same pose trail. ### R4. Frames and files - Four frames: approach at t = 2 s of the soft tape, plume-on at t = 4 s, soft-landing at contact, crash at contact of the crash tape. - One command runs the ballistic, residual, mass, and tape tests, and writes the frames. No network. Accept when: the command passes for both solvers, and the frames match the goldens. ### R5. 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 deterministic landing fixture and a crash fixture, both at a fixed timestep, produce the documented poses and outcomes. The fluid field has a residual check and a closed-box mass check for both solvers. Golden frames cover approach, plume, landing and crash. No physical tunnel and 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 fly, how to run the tapes, and how to switch the solver.