What a simulation is
A simulation is a problem post with a 3D scene in it: a rocket on a rail, a ball and a target, a drone in the wind. The reader changes one or two values, presses Run, and watches what happens. When they press Check answer, the server runs the scene again with their values and tests it against your checks, so nobody can fake a pass.
| Word | What it is | Example |
|---|---|---|
| Scene | Everything in the 3D world: bodies, forces, joints, fluids, wind, ground. | A ball launched at 15 m/s, a target 20 m away |
| Knob | A number in the scene the reader may change, with a slider range. | Launch angle, 0ยฐ to 90ยฐ |
| Solution | Your own knob settings that solve it. Readers see them only after they answer or reveal. | Angle 30.4ยฐ |
| Check | A measurement of the run and the range it must fall in. | The ball's horizontal distance when it first touches the ground is between 19.5 and 20.5 m |
A simulation is for things that move in space: falling, sliding, flying, floating, colliding. For a number that changes over time with no 3D picture (cooling, populations, savings), a model lab is simpler.
Your first simulation
Open New post โ Problem โ 3D simulation. The fastest way in is to start from a template and change it.
- Load a template. Pick one from the Template list (projectile, incline, collision, putt, drones, barge, dam break and more) and press Load template. It fills in the scene, the answer and the checks.
- Run it. โถ Run starting setup shows what the reader sees first. โถ Run solution shows your answer. Use the speed buttons and Follow to watch closely.
- Change the scene. In 1 ยท Scene, pick a body on the left and edit it on the right: size, mass, material, starting speed. ๏ผ Add adds a body, a force, a knob or anything else.
- Choose what readers change. Keep one or two knobs. Set their ranges and starting values.
- Choose how they answer. In 2 ยท Answer mode: they adjust the knobs, or they pick one of several choices.
- Set the checks. In 3 ยท Checks, press โจ Suggest checks from solution, then widen the ranges so every correct answer passes.
- Verify. Press โ Verify. Your solution must pass and the starting setup must fail.
- Write the problem. Title, the situation, the question, a worked solution and hints, as for any problem. Then publish.
Publishing runs Verify again on the server. A simulation whose starting setup already passes, or whose solution fails, won't publish.
The scene
The ๐งฉ Visual editor lists the scene on the left, with each force and joint under the body it acts on. Whatever you pick is edited on the right. { } JSON shows the same scene as text, for copying or for precise edits; press Apply scene after editing it.
Boxes, spheres, cylinders and capsules. Give each an id: checks and knobs use it. A material (steel, wood, rubber, foamโฆ) works out the mass for you. A body can be fixed, like a wall or a ramp.
Extra forces on a body: thrust, a steady force or torque, air drag, a spring, a heater, or a whole drone with its own flight controller. They can switch on or off when something happens, e.g. light the engine below 240 m.
A hinge or a point that holds two bodies together, or a body to the world: a pendulum, a door, a flywheel on its axle.
Gravity, the ground's friction, wind and gusts, the air at altitude, hills, rain, snow and fog. See below.
Keep it small. Every body and force is one more thing the reader has to understand. If a body doesn't affect the answer, leave it out.
Knobs: what readers change
A knob points at one number in the scene and gives it a slider. In the visual editor, pick ๏ผ Add โ Knob and fill in:
| Field | What to put |
|---|---|
| Shown to solvers as | The name on the slider: "Launch angle". |
| Controls | The number it changes, e.g. the ball's launch angle or the engine's thrust. |
| Minimum, Maximum, Step | The slider's range. Keep it realistic: a thrust of 0 to 10,000 N invites guessing. |
| Unit | Shown beside the value: ยฐ, m/s, N. |
| Starting value | Where the slider starts. It must not solve the problem. |
- One or two knobs. With one, the reader can reason it out. With three or more, they start guessing.
- The answer should be inside the range, but not at an end. If it's at the maximum, the reader just drags the slider all the way.
Two ways to answer
| Mode | The readerโฆ | You giveโฆ | Good for |
|---|---|---|---|
| Solvers adjust the knobs | sets the sliders and checks their own settings | your solution settings | "find the angle", "how much thrust", "what spring stiffness" |
| Multiple choice | picks one of a few choices, each of which sets the knobs | the choices; the ones that pass the checks are correct | "which change keeps it upright?", "which site is safe?" |
Let solvers run the simulation freely before answering is on by default. Turn it off for "predict first" questions, like Which ball lands first?: the reader has to think it through, and sees the run only after they answer.
A multiple-choice question can also do without checks: tick the right choice yourself and say why each wrong one is wrong. Use this for "what happens ifโฆ" questions that the simulation shows rather than measures.
Checks: what counts as right
A check picks a body, a measurement, when to read it and a range. All checks must pass.
Position, height above ground, speed, tilt, rotation, distance from start, distance between two bodies, impact speed, whether it touched something or broke. With water: draft, buoyancy, how much is under water. With heat: temperature.
Max or Min over the run, Final, At t = a moment, Mean, Change from start to end, or At first contact, the moment it lands or hits.
A minimum, a maximum or both. "Tilt Max โค 10ยฐ" means it never tips more than 10ยฐ. "Horizontal distance from start, At first contact with the ground, between 19.5 and 20.5 m" means it lands on the target.
โจ Suggest checks from solution compares your solution's run with the starting run and proposes checks on what differs. It's a starting point: read each one, delete what doesn't matter and widen the ranges.
Leave room for other right answers. If your solution lands at 20.03 m and the check says 20.02 to 20.04 m, a reader with the right idea and a slightly different angle fails. Allow what a careful hand calculation would give.
Why: the check should test the idea, not whether the reader found your exact number.
The words around it
The simulation is the experiment; the post still needs the story. Write these as for any problem post:
- The situation, with the numbers that matter: "A ball is launched at 15 m/s toward a target 20 m away." Maths goes between
$โฆ$. - The question, in one sentence the checks answer: "At what angle must it be launched to land on the target?"
- The worked solution: the hand calculation, then what the simulation shows. Say how wide the accepted range is.
- Hints, from gentle to direct: what to watch first, then which equation.
A good simulation problem can be worked out on paper, and the run confirms it. If the only way to solve it is to drag the slider until it passes, readers learn very little.
Air, water, heat and weather
Most problems need only bodies, gravity and friction. The rest is there when the physics calls for it; the scene reference below gives every setting.
| Add | What it does | Template to copy |
|---|---|---|
| Air drag | An aero behaviour with a drag coefficient (sphere, cube, rocketโฆ) | Rocket stability |
| Wind, gusts, turbulence | The same wind every run, for the same seed | Drone in gusty wind |
| Altitude and heat | Thinner air higher up and on hot days | Hot and high |
| Liquids and gases | Buoyancy and drag: hulls float, balloons rise | Barge, helium balloon |
| Draining and pipes | Tanks empty through holes; pipes carry flow | Draining tank, sap in a tree |
| Heat | Bodies warm and cool by contact, air and radiation | Calorimetry |
| Hills and weather | Terrain, and rain or snow that make the ground slippery | Snowy landing sites |
| Drones | A body that flies itself to a point, follows another, or lands on a pad | Drone pad landing, swarm |
What readers see
- The question, the list of checks their setup must satisfy, and the 3D view, which they can orbit, zoom and replay.
- Sliders for your knobs, โถ Run simulation and โบ Reset settings (or the choices, in multiple choice).
- Check answer. Their first real answer is the one that counts for the problem's solve rate; they can keep trying afterwards. Checking the untouched starting setup doesn't use it up.
- Hints, one at a time, and Reveal the solution, which loads your settings into the scene so they can run it.
When something's wrong
| Verify says | What it means | Fix |
|---|---|---|
| The starting setup already passes | Readers would be done before they start. | Move the knob's starting value away from the answer, or tighten a check. |
| Your solution fails a check | Your own answer doesn't pass. | Run the solution and read the measured values; widen the range or change the solution. |
| No choice passes / every choice passes | Multiple choice needs at least one right and one wrong. | Change a choice's values, or adjust the checks. |
| Unknown body or path | A check or knob names something that was renamed or deleted. | Pick the body or value again in the visual editor. |
| It looks wrong when it runs | Often a mass, a unit or a sign: thrust pointing down, an angle in the wrong direction. | Run at 0.25ร with Follow on and watch the first second. |
Using your simulation
- As a problem: it appears in the feed and under Simulations in search.
- In a lesson: add a Try it step and search for the simulation. Solving it, or revealing the solution, completes the step. See the lesson guide.
- In a course: add it as an item; it counts as practice. See the course guide.
Scene reference
Every setting a scene can use, with its JSON. In the visual editor you set the same things with fields; the JSON is what { } JSON shows. Lengths are in metres, speeds in m/s, forces in N and temperatures in ยฐC.
The scene's parts
A scene is JSON with bodies (box, sphere, cylinder, capsule), behaviours (extra forces: thrust, force, torque, aero, attitude_hold, spring, drone, heater), joints (hinge, point), fluids (liquids and gases), junctions and pipes, heat, materials, world and knobs.
A knob's path points at the number it changes, e.g. "behaviours.engine.magnitude" or "bodies.ball.launch.elevation_deg", with min, max, step, unit and its starting value, default.
Materials
Give a body "material": "steel" and its mass is worked out (density ร volume) unless you give one. Solids: steel, aluminium, copper, lead, glass, concrete, granite, wood, plastic, rubber, foam.
Make your own under "materials" with "phase": "solid", a density, cp (J/(kgยทK)), conductivity (W/(mยทK)) and emissivity.
Heat
"heat": {"ambient": 20, "time_scale": 60} gives every body a temperature (ยฐC). "hold_temperature": true keeps a body at its temperature, like a hot plate.
- Heat flows by conduction where bodies touch each other or the ground, by convection to the fluids around them (faster in a flow), and by radiation to the surroundings. Switch any of them off, e.g.
"effects": {"radiation": false}. time_scaleruns heat faster than the motion, so minutes of warming fit in a short run.- A fluid region with
"warms": trueheats up with what it takes in (a calorimeter). - A
heaterbehaviour puts inpowerwatts (negative cools), with an optional thermostattarget. A behaviour can start or stop when a body's temperature crosses a value. - Measure temperature and heat taken in. A body has one temperature all through, and nothing melts or boils.
Liquids and gases
"fluids": [{"id": "pool", "material": "sea_water", "temperature": 15, "level": 2, "bottom": 0, "min": [-8, -6], "max": [8, 6]}] fills a basin up to the surface at level.
- Liquids:
water,sea_water,ethanol,oil,glycerol,honey,mercury. Gases:air,helium,hydrogen,carbon_dioxide. A gas fills a box the same way, or the whole scene with"everywhere": true. - Each fluid works out its density and viscosity from the region's
temperatureand, for gases, itspressure(Pa, at the top). - Make your own under
"materials":{"id": "syrup", "phase": "liquid", "density": 1300, "viscosity": 2.5}, or a gas with amolar_mass(g/mol). "flow": [0.5, 0, 0]adds a current or a wind.- Bodies feel buoyancy where they are in the fluid, so hulls right themselves or capsize and balloons rise, and drag that grows with viscosity at low speed. A body's
fluid_cdsets its drag at high speed. Switch an effect off with"effects": {"drag": false}. A body with its ownaerobehaviour keeps it, and gases then only lift it. - A basin has no walls: add fixed bodies for them.
- Measure draft, share in the fluid, buoyant force, fluid pressure, Reynolds number and the fluid's density, viscosity, temperature and flow speed. A small fixed zone (ghost) works as a pressure probe at a point.
Draining and filling
Give a liquid in a box "outlets": [{"side": "+x", "height": 0, "diameter": 0.02}] and it drains at Torricelli's speed โ(2 g h) (outlet_cd is 0.61 for a sharp-edged hole), or "inflow": 2 (L/s) to fill it. "time_scale": 60 makes the level change faster.
Measure a region's level, volume and outflow: a check on those names the region instead of a body.
How a fluid is computed
"model": "uniform", the default, gives the exact numbers checks rely on."particles"turns a liquid in a box into a few hundred particles that pour and splash along its floor ("spread_to": [0, 3]), round the bodies in their way. A body the water reaches touches the region, so first touches checks time a wave."flow_field"shows the flow around the bodies on a slice (slice_height), computed live in the browser. It's for looks, with its Reynolds number in the readout.
Pipes
"junctions" (points, some held at a pressure in Pa) and "pipes" between them (radius, length) carry a fluid ("network": {"material": "water"}) by Poiseuille's law, downhill too. Measure a pipe's flow, its share of the network's flow, its speed and Reynolds number.
Drag, wind and friction
- Drag: give a body an
aerobehaviour with a drag coefficientcd, a number or a preset:sphere0.47,half_sphere0.42,cone0.50,cube1.05,angled_cube0.80,long_cylinder0.82,short_cylinder1.15,flat_plate1.28,streamlined0.04,streamlined_half0.09,model_rocket0.75,quadcopter1.0. - Wind:
"world": {"wind": {"velocity": [6, 0, 0], "gust": 4, "gust_period": 2, "seed": 1}}is a steady wind plus gusts of up togustm/s that change about everygust_periodseconds. Wind pushes bodies through theiraerobehaviour (drag acts on the speed relative to the air). Gusts look random but followseed, so every run meets the same wind; change the seed for a different pattern. - Rolling resistance: a body's
rolling_frictionis the rolling resistance coefficient: about 0.001 for steel on rail, 0.01 for a tyre on asphalt, 0.05 to 0.1 for a ball on grass or carpet."rolling_start": truestarts a ball or wheel rolling rather than skidding; its spin then follows its velocity, also when a knob changes the speed. - Sliding friction is
frictionon the body andground_frictionon the world.
Turbulence and wind shear
Add to the wind "turbulence": 2 (the standard deviation of the air speed in m/s; about 10 to 20% of the wind speed outdoors) and "turbulence_scale": 30 (the size of the largest eddies in m). Turbulent air varies from place to place as well as over time, and also follows the seed.
"shear_exponent": 0.2 with "reference_height": 10 makes the wind stronger with height: velocity is then the wind at the reference height. The exponent is about 0.1 over water, 0.15 to 0.25 over open country and 0.3 to 0.4 among buildings.
Atmosphere
"world": {"atmosphere": {"site_altitude": 1600, "temperature": 30}} works out the air density from the standard atmosphere and the ideal gas law: thinner higher up and on hot days. The temperature defaults to the standard one for the altitude. It replaces air_density.
Give a thrust "density_scaled": true for propellers and rotors, whose thrust falls with the air density; its magnitude is then the rating in sea-level air.
Drones and swarms
A drone behaviour turns a body into a multirotor with its own flight controller: {"type": "drone", "body": "d1", "target": [0, 5, 0]} flies to a point (without a target it holds where it starts), and "follow": "leader", "offset": [-2, 0, 0] keeps station on another body.
- Optional:
max_thrust(N; falls in thin air unless"density_scaled": false),max_speed(default 4 m/s),max_tilt_deg(default 30), the position gainskp_posandkd_pos, the attitude gainskp_attandkd_att,max_torque(worked out from the body when left out), and dragcd,area,cp_offset. - Give the body
"visual": "drone"to draw rotors. - Drones keep apart with
"world": {"swarm": {"separation_radius": 2.5, "separation_gain": 8}}: within the radius of another drone they brake, steer away and veer right. Check spacing with the distance to the nearest other moving body measure.
Takeoff and landing
Any behaviour can wait for a condition: "start_when": {"body": "lander", "metric": "height", "below": 240} lights an engine below 240 m, and "stop_when": {"body": "lander", "metric": "vy", "above": -0.2} shuts it once the lander stops descending. The metrics are height, y, vy, speed and tilt_deg; each switches once.
A drone with "land_at": [x, z] flies over the spot, comes straight down at max_vertical_speed and cuts its motors at touchdown. Check the touchdown with impact speed or at first contact.
Damage
Give a body "max_impact_speed": 3: a collision closing faster than that breaks it, every behaviour on it stops (engines, motors, controllers) and it turns dark red. Check it with the broken (1) or intact (0) measure (maximum โค 0 means it never breaks) or the impact speed measure.
Terrain
"world": {"terrain": {"seed": 3, "size": 120, "resolution": 64, "height": 10, "scale": 40, "roughness": 0.5, "pads": [{"x": 0, "z": 0, "radius": 4}]}} replaces the flat ground with hills about scale metres across and up to about ยฑheight metres high, the same every time for the same seed. Pads are levelled at their y (by default the natural height there). Heights measured above the ground follow the terrain.
Weather
"world": {"weather": {"type": "fog", "intensity": 0.8}}, with rain, snow, fog or storm. Besides what you see, it changes what weather really changes at these scales: wet and snowy ground grips less (heavy snow about 30% of dry), and visibility (down to 5 m in thick fog) limits how far a lidar sees. For storm winds, add wind.
Lidar navigation
Give a drone "avoid": {"range": 10, "rays": 36, "gain": 8}: a level fan of range-finder beams (updated rate times a second, with noise in m) steers it round anything it sees within its range or the visibility, whichever is shorter. The beams are drawn during a run, red where they hit.