Skip to content

About

A building physics sandbox for the browser: draw rooms, add heating, cooling, fans and ducts, put a roof on, pick the weather, and watch a live simulation of the air, heat, humidity, sun and snow in a floor plan, a side view and 3D. 3D air runs on the graphics card. No install, no build step.

Topics

Resources

Security policy

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Airflow Lab

Tests Latest release License: MIT

▶ Open it in your browser: nothing to install · Website · Download to run it on your own computer

A sandbox for the physics of a building. Draw rooms, put in the things that heat, cool and move air, pick the weather, and watch what happens: where the warm air goes, which room stays cold, why the attic is hot, where an ice dam forms.

The picture is a live simulation in real units, not an animation. It runs entirely in the browser: no install, no account, no build step, and nothing you draw is sent anywhere.

A house under snow in 3D: warm rooms, the air in the attic, snow and ice on the roof

The air through a room Ducts sized and balanced
A radiator under a cold window: its warm plume rising to the ceiling, drawn through the room in 3D A ducted house in the floor plan, with the air handler's static pressure, CFM and supply temperature
A cut through the building Smoke, CO₂ and humidity
The Side view: an upright cut through the house, with the attic, the ceiling insulation and the snow to scale Smoke from a range rising and leaving through a high opening

A small home in 3D: a range under its hood, a refrigerator, a bathroom with a shower and a bath fan in the ceiling, a radiator under the window, a ceiling fan

A real one-bedroom apartment on a cold night, in 3D: one heat pump head in the kitchen, the living room two openings away the coldest room, as its real sensors showed

What you can do

  • Draw a building. Walls in twelve constructions and glass in four, each with its real R-value; windows, doors, vents and openings with no door, at their own heights. Or type the figures you have: a wall's R-value, the U-factor and solar heat gain on a window's label, the ceiling's R-value. Or build a wall or a ceiling up layer by layer (siding, sheathing, batts between wood or steel studs, foam board, brick, drywall) and it works out the R-value, framing and all. A floor over a crawl space or a basement by its R-value; a door by its kind (solid wood, insulated steel, glass, a dock door insulated or bare). A room can have a ceiling and a floor of its own: a slab under the shop, a crawl space under the offices. And a ceiling height of its own: a high bay beside offices. A building can have several storeys, each drawn as its own plan: + Storey puts one on top, beginning with the outside walls of the storey under it, and the Loads window adds them all up. In feet and inches or in metres. Select, move, turn, duplicate, undo; pick several things at once, move them together, and copy and paste them, into another layout too.
  • Put things in it, by the names you know them by. Radiators, electric and hot-water baseboards, a heated floor, a wood stove, a fireplace; a mini-split heat pump, window and portable air conditioners; a ceiling fan, a window fan, a fan through a wall between rooms, a bath fan in the ceiling, a range hood, a whole-house fan, wall exhaust and supply; a shower, a humidifier, a dehumidifier; a range, refrigerator, dishwasher, washer, dryer, water heater, lights, TV, computer, people, a server rack. Each lands where a real one goes (a hood on the wall over the range, a bath fan in the ceiling) and heating and cooling run on thermostats you set.
  • Run ducts. An air handler with supply and return runs, tees, registers and return grilles, dampers and a filter, run in the ceiling, the attic or in the open. Round sizes are picked for you or set by hand; the program works out the CFM, speed and pressure drop of every run.
  • Put a roof on it. Gable, hip, shed or flat, with a pitch, eaves, attic vents and ceiling insulation.
  • Set the weather. Outdoor temperature, wind, humidity and sun; a day and night cycle; snowfall and rain; or recorded readings in a layout file, followed point by point.
  • See it three ways, and build in them. A floor plan, a side view (an upright cut you can drag across the building) and 3D are three views of the same building. Walls, windows, ducts and equipment can be drawn and moved in the floor plan and in 3D, with a preview of what a click will make; things that belong on a wall click onto it. In 3D the air is drawn through the rooms, so a plume is a plume.
  • Measure. Sensors with a live chart and a CSV file. A sensor reads the air itself, or the way a real room sensor does (half the air, half the room's surfaces, a few minutes behind), so the model can be set against real recordings; the chart keeps the average of each stretch of time with a band for how far the reading swung. Each room's square feet, CFM, air changes and heat loss; estimated watts and kWh; colours for temperature, air speed, humidity, smoke, CO₂ and pressure.
  • Skip ahead. Fast-forward covers hours of building time in seconds.

Twelve example layouts are in the Examples list: a real apartment that was checked against its own room sensors, a small home with the everyday things in it, a radiator under a cold window, a ducted house, a house under snow with ice dams, a summer attic, a smoky kitchen, a server room and more. Point at anything for what it is and its reading; the Guide button explains the rest.

What it models

  • Air. Incompressible flow on a staggered grid: the air is carried along its own motion (semi-Lagrangian with a MacCormack correction), warm air is lifted by buoyancy, a Smagorinsky model supplies the turbulence the grid cannot resolve, and a pressure solve makes the flow add up. Flat (a floor plan's worth of air, 4 in cells) or in 3D (floor to ridge, 8 in cells, or 4 in on a fast graphics card).
  • 3D air on the graphics card. The work done on every cell runs as WebGL2 shader passes, about four times faster than on the processor; walls, heat stores, equipment and the roof stay in JavaScript. The two are checked against each other, and the page falls back to the processor where the browser cannot do it.
  • Heat. Conduction through walls, glass, ceilings and roofs by their R-values; coils, blowers, people and appliances.
  • What is in the rooms. Floors, ceilings, wall linings and furnishings hold heat and water vapour and trade both with the air. So rooms warm and cool at a realistic pace, the air sags only a degree or two when the heating stops, and humidity takes hours to follow a change, as in a lived-in room.
  • Fans and room pressure. A fan moves what the building lets through. Each shut room settles at the pressure where its fans and the cracks of its shell balance: a bath fan in a leaky house loses a few percent, a range hood pulls a tight house well below outdoors, and a fan in an airtight room moves nothing. Rooms show their pressure; fans show what they really move.
  • Air leaks. How leaky the building is, from airtight to very leaky, sized the way a blower-door test sizes it. The outdoor air that leaks in follows from the weather (more when it is colder or windier outdoors) and comes in along the outside walls, taking heat, moisture and CO₂ with it.
  • The floor. Over a heated room, a crawl space (floor insulated or not), an unheated basement, or a slab on the ground, which loses its heat around its edge. Over damp bare earth, about half of the air that leaks in comes up through the floor carrying the ground's moisture, so the rooms stay damp through a dry winter.
  • Moisture. Humidity carried by the air, relative humidity and dew point, condensation and frost on cold glass and walls, moisture from people and cooking, humidifiers and dehumidifiers with their latent heat.
  • Heat pumps. Electricity by the outdoor temperature, and by how hard the unit works: asked for less than about a third of its size it runs on and off, and uses more for the same heat. Or set one from its maker's data sheet: type in the heat it gives and the watts it draws at each outdoor temperature (at its least, its rated point and its most), and it gives and draws that, with less to give in the cold as the sheet says. A unit set to run on and off starts and stops like a single-speed one: in turns, so many starts an hour as a thermostat is set for, with a rest before each start, and a start during which the electricity is drawn in full while the heat is still coming up.
  • Sun and sky. Sun on each wall and roof slope by how squarely it faces the sun, through glass onto the floor where the sun's height throws it, and heat lost to a clear night sky.
  • Roofs, attics and snow. An attic whose air moves (it is part of the 3D air) with real vent openings; snow that lies on the roof and insulates it, melts from underneath where the deck is warm, runs down the slope and refreezes into ice over the cold eaves.
  • Ducts. A pressure balance the way a duct designer does it: Darcy-Weisbach friction with the Colebrook factor, fitting losses, the filter and the blower's curve. Duct heat lost through the duct skin goes into the air the duct runs through, so a bare duct in a cold attic warms the attic.
  • Tracers. Smoke and CO₂ ride with the air, through rooms and ducts.

Use it to size a real building

The Loads window: for each room of a small house, what it loses on the winter design day part by part, the air to carry it, and what the heating there can give The report to print: a shop drawn to scale on a sheet, with its rooms, sizes and equipment tags

A shop with a rooftop unit in the floor plan: the trunk duct and its registers, eight people, the sun through the front glass, and the unit's outdoor air and economizer

  • Loads. One button works out, from the drawing, what each room loses on a winter design day and gains on a summer one: walls, windows and doors by which way they face, ceiling, floor, air leaks, sun, people and equipment, and the moisture to take out. With it come the load per square foot, the supply air that would carry it, and what the heating and cooling you have drawn can give on that day. Set the two design days for where the building is, or drop in a weather file for the place (.epw, free for nearly anywhere) and they are worked out from its hours. Save it as a spreadsheet, or print the report.
  • A report to print. From the Loads window, Report to print puts it all on sheets: the floor plan drawn to a standard scale (1/4 in = 1 ft, 1 in = 20 ft, 1 : 50), with the sizes of the outside walls, room names and areas, doors, windows and ducts, and a tag on each piece of equipment (RTU-1, UH-3); the equipment list by those tags; the loads; and what the building is made of. Choose the sheet (Letter, Tabloid, A4, A3) and the scale, then print it or save it as a PDF from the browser's print window.
  • Ventilation air. Outdoor air brought in for the people has its own line in the report: by the head count and the floor area, with the figures of ASHRAE 62.2 for a home and 62.1 for offices, classrooms, meeting rooms, shops and dining rooms, or an amount you set; straight from outdoors, or through a heat or energy recovery ventilator.
  • A year of energy and cost. With a weather file in, the same window works through its whole year hour by hour: what the building needs to stay between your heating and cooling temperatures, what the heat pumps and electric heat in the layout draw to give it (each heat pump from its data sheet, at that hour's outdoor temperature), and what that costs at your price for a kWh. It comes month by month and by outdoor temperature, with the hours the equipment cannot keep up. Gas heat is counted as gas: therms burned, at your price for a therm.
  • Choosing the equipment. The same window sets the loads against what is in the layout: the nearest standard size at or above each load, and whether what you have drawn is short, about right or much more than it needs; a chart of what the building needs at each outdoor temperature against what the heat pumps can give there (from their data sheets), with the balance point where they stop keeping up and the other heat that takes; and for each room the air its load needs against what its registers move now.
  • Two versions side by side. At the end of the same window, keep the layout as it is, then change something: the insulation, the windows, a unit, the place. The two are set side by side: both design days part by part, the year's energy and cost, the change in each, and what is different between the two in words. Type what the change costs and it works out the years of savings that pay it back. One button switches between the two, and the kept version is saved with the file.
  • People, lights and plugs by the floor area. For a building whose people and lights are not drawn one by one, choose what it is used for (offices, classrooms, shops, a warehouse, or figures you set): so many people for each 1,000 sq ft and so many watts of lights and plugs per sq ft, shared out to the rooms and counted in the summer loads. The figures to begin with are usual ones and any of them can be typed over.
  • A use for each room. Offices beside a warehouse floor: give a room a use of its own (in the table of rooms in the Loads window, or in the room's own panel) and it has the people, lights and plugs of that use for its own floor, and its ventilation air. Rooms with the same use share one head count, and the room's figures can be typed over too.
  • The hours the building is occupied. Choose them (offices on weekdays, shops every day, a home that is empty on weekdays, or hours you set) and the year counts the people only while they are there, with a share of the lights and plugs left on when it is empty. The temperatures can be set back while it is empty (they go back two hours before people come), and the ventilation air can run only while it is occupied.
  • Shops and warehouses. A group of things for commercial buildings: a rooftop unit that brings in outdoor air and has an economizer (while it is cool enough outdoors it cools with outdoor air, and the compressor only does what is left), a make-up air unit, a unit heater, a roof exhaust fan and a big ceiling fan. Any air handler with ducts can take a share of outdoor air, and the loads report can count it as the ventilation air. Sizes go up to about 1,000,000 BTU/h and 42,000 CFM. The example "A shop with a rooftop unit" shows it at work. A unit heater, a make-up air unit and an air handler's furnace can burn gas (the gas is counted, and a make-up air unit that burns it in its air stream adds the flame's steam and CO₂ to that air). An economizer can go by enthalpy, and the outdoor air can go by the CO₂ in the air coming back. A dock door rolls up; an air curtain over a door stops part of the air that passes while it stands open.
  • VAV boxes. Put a VAV box on the supply duct to each room or zone: the air handler then holds its supply air at a set temperature, each box lets through what its rooms need (down to a least amount, with a reheat coil for when they get cold), and the blower slows as the boxes close.
  • Plants and laboratories. A machine or process that gives off heat (and steam or smoke), a process cooling unit, a fume hood (its air is the speed at its open front times the opening, less as the sash comes down) and a dust collector that hands its cleaned air back to the room or blows it outdoors.
  • Trace a blueprint. Pick Blueprint, choose a picture of the floor plan (a scan, a photo, a screenshot of a PDF page), click the two ends of a length you know and type it: the picture is then to scale under the drawing, and you trace the walls over it. The picture stays on your computer and is saved with the layout.
  • Type the sizes. While drawing a wall, point the way it goes, type its length (12' 6", 12.5, 3.8 m) and press Enter. A room can be put down by its inside size, and a wall's length can be typed after it is drawn: what is joined to its far end moves with it.
  • Name the rooms by clicking inside them.
  • A bigger field. Under Conditions, the field can be 85 ft 4 in by 53 ft 4 in: a whole house or a shop.
  • A field for a big building. Three more fields work the air out in bigger cells: 8 in, 1 ft or 2 ft, for up to 512 ft by 320 ft. Everything drawn keeps its real size. The grid takes each thing as the whole cells nearest to it, so a wall is one cell there and a room comes out a little narrower than drawn (4 in each way on 1 ft cells, 16 in on 2 ft cells). The example "A warehouse, 200 ft long" is on 2 ft cells.
  • A heat pump from its data sheet (above), counted in the report at what it really has at the design temperature.

The report is hand sums with the same numbers the moving model uses, and the two agree: run to rest, each room's heater settles within 3% of the report's load. It leaves out the heat the building stores (a real summer peak is lower), sun on the roof, shade and duct losses, and it does not look up design days by place yet. The list of what a full tool still needs, for homes and for commercial buildings, is in the roadmap.

How far to trust it

Every piece is checked against a known answer before it counts as done: 671 checks run on every change (npm test), among them the energy books of a sealed box, heat through a wall against the hand sum, the textbook two-way flow through an open doorway, an attic's temperature against a hand balance, and the roof's books of heat and water.

It has also been set against one real building: the apartment in the Examples list, which has a sensor in every room. With its leakiness and what its heat pump head really holds picked to fit, the model puts the six rooms within 1 to 3 °F of a night's readings. Its heat pump is set from the data sheet of the unit that is really there and runs on and off as that one's recordings show (about four starts an hour, all night); with that it draws about a fifth more than the real one is estimated to have used (it has no meter of its own). With the app's typical heat pump it had drawn a seventh less: that one was too efficient at part load, which hid that the model's building loses somewhat more heat than the real one. The same home run hour by hour through a recorded winter day, with the real weather, kept five of the six rooms within about 2 °F of their sensors and one room 5 °F too warm, with the bedroom's CO₂ within about 140 ppm, and its air came out too dry. That is a fit to one home, not a proof. It is how the missing air leaks and floor loss were found, a bug with them, and then three more faults: rooms that let go of their heat far too fast, humidity that moved in minutes, and a heat pump that kept getting more efficient as its load fell. The heat pump's label and its recordings at full detail then led to heat pumps set from a data sheet and to on-and-off running.

It is still a model on a coarse grid, and best for seeing why and comparing this against that. Known limits:

  • Rooms in 3D air come out 8 to 24% larger than drawn, because walls there have no thickness.
  • Still rooms in the flat model lose about 12% too little heat on the fine grid; a room's heat loss otherwise comes within 5% of a hand sum.
  • Fast-forward trades detail for speed. It holds the air flow while heat and moisture jump ahead: the balance is kept, fine detail in the air is lost, and a room reads about 2 °F cooler during a fast warm-up.
  • Attic vents are whole cell faces, so a small attic is vented a little too well. With flat air an attic is one temperature.
  • Eaves do not shade the windows, and one part of a roof does not shade another.
  • Air leaks are one number for the whole building, spread evenly along its outside walls: no draught in at the floor and out at the ceiling yet, no windward and lee side. A new layout starts airtight until you pick how leaky it is under Conditions, and in an airtight shut room a fan moves nothing.
  • Fans and pressure go by typical figures. Each kind of fan gives up at one typical pressure, and its flow falls in a straight line toward it. Air is pushed through the cracks between a room and the outdoors, not yet between two rooms. A duct register blowing into a shut airtight room still has its air spread through the room.
  • What is in a room is not drawn. Floors, wall linings and furnishings are one store of heat and one of moisture for each bit of room. The walls' share comes from the drawing; furnishings are taken as one more floor's worth, and the moisture they hold is one figure for every building. Furniture does not block air, and a real room's first minutes after the heating stops have not been checked against a measured one yet.
  • Heat pumps. A data sheet gives a few points and the app joins them with straight lines. Defrosting and the draw while resting are not counted. A sheet's cooling figure includes drying the air; here all of it cools. What a start costs an on-and-off unit is the rating standards' figure, not a measurement of that unit, and Fast-forward works with the average, not with each start.
  • What is under the floor is not drawn. A crawl space or basement is taken to sit part of the way to the outdoor temperature, and a slab loses a handbook amount per foot of outside wall; the ground does not store heat.
  • Electricity is an estimate of watts and kWh per device. There are no circuits yet.
  • Hot-water heating has no boiler or pipes: a radiator or a hot-water baseboard is given its heat. A shut door passes no air, so a bath fan behind one moves only what the cracks of that room's own outside walls let in.
  • A fan in flat air is counted over the whole height of the room, so a pedestal fan reads far more CFM than a real one. With 3D air it is its own size.
  • Storeys keep their air to themselves. The air that moves is the air of the storey shown: none passes between storeys (no stairwells or open wells), and a duct does not run from one storey to another. The storeys are taken to be at the same temperature. One roof shape over the whole building.

It is a tool for learning and exploring. Verify independently before sizing equipment or changing a real building. The roadmap lists what is built, what is next and every known limit.

Run it

Online: jamesccupps.github.io/Airflow-Lab/app/. Layouts are kept in your browser and in the files you save with Save.

On your own computer: download Airflow-Lab.zip and unzip it, or clone this repository, then

Both need Node.js 20 or newer, only to hand the files to the browser (a page opened straight from disk is not allowed to load its 3D drawing library). Any other static file server works too. Nothing is installed and there is no build step.

Browser: made and tested in Chrome and Edge on a desktop; other current browsers should work. The 3D view and 3D air on the graphics card need WebGL2; without it the floor plan and Side view still work and 3D air runs on the processor. It is built for a mouse and a wide screen, not for a phone.

For developers

npm test          # the four check files below, one after another (a few minutes)
npm run shots     # retake the pictures in docs/ from the real page (needs Chrome or Edge)
  • js/sim.js, js/sim3.js: the air and heat solvers, flat and 3D. No DOM: they run in Node for the checks.
  • js/gpu3.js: the 3D solver's per-cell work as WebGL2 passes.
  • js/scene.js, js/scene3.js: the layout (walls, openings, devices) and the step that turns it into a grid; the example layouts.
  • js/ducts.js, js/roof.js: the duct network; the roof, attic, snow and ice.
  • js/render.js, js/cutview.js, js/view3d.js, js/cloud3d.js, js/models3d.js, js/elevation.js: the floor plan, the Side view, the 3D view, the air drawn through the rooms, and the equipment's shapes.
  • js/editor.js, js/app.js, js/chart.js: tools, panels and the chart.
  • test/*.test.js: the checks, run with plain node. test/gpu.browser.js checks the graphics-card solver against the processor solver and runs in the page's console.

Everything is plain JavaScript loaded by index.html, in SI units inside and US or metric on screen. CLAUDE.md has the notes for working on it.

Credits

  • three.js (MIT) draws the 3D view. A copy is in lib/three with its licence.
  • The methods are the standard ones: stable-fluids advection with a MacCormack correction, the Smagorinsky eddy viscosity, incomplete-Cholesky conjugate gradients for pressure, Darcy-Weisbach and Colebrook for ducts, and ASHRAE's stack and wind formulas for attic vents.

License

MIT

About

A building physics sandbox for the browser: draw rooms, add heating, cooling, fans and ducts, put a roof on, pick the weather, and watch a live simulation of the air, heat, humidity, sun and snow in a floor plan, a side view and 3D. 3D air runs on the graphics card. No install, no build step.

Topics

Resources

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages