Files
OpenNest/docs/plate-heat-map.md
T
ajandClaude Fable 5.2 ff8f97f44a perf(thermal): take the heat map's short steps only around the torch
While the torch cuts, every cell of the plate took steps short enough to
follow it: 4 to 76 times more steps than diffusion needs. On the processor
only the cells within four cells of the torch's recent path take them now;
the rest of the plate takes one long step per slot. A full sheet at
quarter-inch cells runs in 0.23-0.45 s instead of 0.9-2.9 s, and a fast
feed no longer makes it slower.

Peaks stay within 1% of the color scale at the 99th percentile of the
whole-plate result. Graphics cards keep whole-plate steps. Decay factors
for the support bed are worked out per distinct contact fraction.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-02 20:21:08 -05:00

13 KiB
Raw Blame History

Plate heat map

OpenNest.Core/CNC/Thermal/PlateHeatSimulation.cs estimates how heat builds up in the sheet while a cut simulation plays. The Cut Simulator shows it under the cut trail (Heat: Now or Peak so far). It is a display and analysis aid and never changes the plate; a removed heat-aware sequencer used a cheaper estimate of the same physics (Sequencing).

Model

  • A grid over the plate's bounds. Unless CellSize is set, cells start at 0.5 in (12 mm) and halve, down to 1/16 in (1.5 mm), while the whole run (cells times diffusion-limited time steps) stays within a work budget. The first halving has 800 million cell updates on the processor, about a second, which gives a 5×10 ft sheet 0.25 in cells, and 20 billion with an accelerator, which keeps 0.25 in on longer cuts. Finer halvings have 60 million with either, so only small plates and short cuts get them: on a full sheet 0.125 in cells leave hot lines too thin to see and stretch the color scale. Halving costs up to sixteen times the work, since diffusion shortens the time step with the cell's area. Automatic grids have at most 700,000 cells, and any size asked for is made coarser past that. Each cell holds its temperature rise above ambient. Finer cells hold the torch's heat in less metal, so cells along the cut read hotter; compare cut orders at one cell size (a long cut can get a finer one with a card than without).
  • Heat in: while the torch is on (cuts and pierces), AbsorbedPower watts go into the sheet at the torch, in proportion to the time spent there. The path is sampled four times per cell, and each sample is shared between the four cells whose centers surround it, by closeness, among those in the same piece as the cell under the torch. Scribes add nothing.
  • Conduction: explicit finite differences between the four neighbors of the same piece. Time is divided into slots as long as the stability limit allows (at most 1 s). A slot in which the torch cuts is split into equal steps, so that none is longer than the torch takes to cross one cell at that move's speed (half a cell where cells are under 4 mm), but not shorter than 5 ms for that. A step adds its heat all at once, so a longer one shows stripes along a straight cut; rapids and pierces keep the long steps (HeatStepSchedule). Splits come from a short list of counts, and the boundaries depend on the timeline alone, so a replay takes the same steps. Sheet edges are insulated. A rise below 1e-30 °C is set to zero: the front of the spreading heat would otherwise pass through subnormal floats, which make each step several times slower. It changes no cell above about 1e-18 °C.
  • Short steps only around the torch: on the processor, the short steps of a slot are taken only by the window of cells within four cells of where the torch put heat during those steps or during the slot before them (which keeps the cells beside a fresh cut on short steps until their own peak has passed). The cells touching the window hold their starting values meanwhile, and every other cell takes one step as long as the short ones together (StepInterval). Heat moves about a cell per slot, so the cells past the window change too slowly to need more. A piece that changes inside a slot ends the long step there, and a new one starts; steps in which the torch adds no heat are one long step for every cell. Compared with every cell taking the short steps, on full sheets at 100 to 1600 in/min: peaks differ by under 1% of the color scale at the 99th percentile and a few dozen cells of 115,200 by more than 5%, final temperatures by under 0.1%, total heat by under 0.06%, and the stripe check is unchanged. For scale, halving every step moves the peaks by 5-7% at the 99th percentile. So a fast feed no longer makes the run longer. ThermalParameters.WholePlateSteps (internal) turns the window off for comparison.
  • Loss: convection from both faces at SurfaceCoefficient (W/m²·K), plus, when ThermalParameters.SupportBed is given, contact with the bed through the bottom face at ContactCoefficient (W/m²·K) times each cell's share of area over the bed. The share is the overlap of the cell with each slat's top (SupportSlats.SlatsIn) or with a square pad GridContactSize wide (0.125 in / 3 mm by default) around each grid point (SupportGrid.PointsIn), placed for the plate's quadrant as the beds mirror themselves; it is not snapped to cells, so slats narrower or wider than a cell count their true area. The nominal bed is used, without registration shifts. Each cell decays by an exponential factor per step, which stays stable however strong the contact. A part cut free still rests on the bed and keeps losing heat to it; a dropped slug has no heat left. Without a bed (or with a zero ContactCoefficient) the model is exactly the air-only model.
  • Contact default: 200 W/m²·K. A sheet resting dry on slats, often over slag, conducts poorly (a few hundred W/m²·K when the slat is cold), and the slats warm up under a long cut. The slats are not given a temperature of their own; the default is a lower effective value standing in for that. An estimate to calibrate, like AbsorbedPower.
  • Pieces: when a closed contour finishes (within half a cell, so a tab's gap counts as closed), a cutout (an interior contour by the posts' perimeter rule the timeline already uses) removes its slug's cells and their heat; a part's perimeter separates its cells from the skeleton, so no heat crosses the kerf. Only skeleton cells change, so a part nested in a cutout stays its own piece. Open contours (cut-offs, breaks) change nothing.
  • Material from the nest's material name and grade (ThermalMaterial.ForName: stainless, aluminum, otherwise mild steel); thickness from the nest.

Not modeled: radiation, the slats' own temperature (they are an infinite sink at ambient behind an effective coefficient), less air loss from the bottom face where slats cover it, pierce power differing from cutting power, the heat carried off by the melt beyond AbsorbedPower, kerf width and warping. The absorbed power (1000 W by default) is an uncalibrated guess, so the temperatures are relative; use them to compare cut orders of one plate, not as real values.

Playback and seeking

Each step runs a vector of cells at a time, with the links between neighbors of one piece precomputed as 1 or 0 whenever the pieces change; grids of 65,536 cells or more split each step across processors. Neither changes a result bit.

A straight run from the start (one never stopped short of a scheduled step, or partway through a slot's run of short steps) keeps checkpoints of the temperatures, peaks and event cursors, about every 500,000 cell updates of short steps and within 128 MB, more widely spaced on large grids. The simulator's first run to the end, made to set the color scale, lays them down. Going back in time, or more than eight steps ahead, resumes from the latest checkpoint that a straight run to the target passes, so a seek steps through at most one checkpoint's interval instead of the whole run, and gives exactly the state a straight run from the start gives. The pieces are rebuilt from the event cursor rather than stored. Playing forward frame by frame continues from the current state.

The simulator builds and runs the model off the UI thread (HeatEstimate) and shows "Estimating heat…" meanwhile. A changed setting cancels the run in progress; a rebuilt timeline with the same moves and settings keeps the model it has.

Graphics card

ThermalParameters.Accelerator runs grids of 100,000 cells or more elsewhere; smaller ones stay on the processor, as a card takes longer to start each step than such a step takes. OpenNest.Gpu is the one implementation: ILGPU, using CUDA on an NVIDIA card, otherwise OpenCL where ILGPU accepts the driver (not verified on AMD or Intel cards; Apple graphics are not supported). Without a usable card, or when it fails while building or playing (out of memory, driver fault), the model runs on the processor with the cell size that suits it.

The simulation keeps the pieces, timeline and checkpoints and the card keeps the temperatures. On the card every cell takes the short steps, so its picture differs from the processor's by what the window costs (above). Against the processor taking whole-plate steps too, its results are within one part in a million, not bit for bit (devices may fuse a multiply and an add). The processor stays the reference. GpuHeatAcceleratorTests compares the card with whole-plate steps on the processor within a tolerance, running the card's programs on ILGPU's processor emulation everywhere and on a real card where there is one (skipped otherwise, as on build agents). A change to DiffuseCells or Add needs the same change in OpenNest.Gpu/HeatKernels.cs.

Measured on a Ryzen 7 3700X and an RTX 4060, 5×10 ft nests, 0.25 in and 16 gauge mild steel at 100 to 1600 in/min, whole run: 0.25 in cells took 0.9-2.9 s on the processor before the window and take 0.23-0.45 s with it; the card takes 0.45-1.0 s, most of it the fixed cost of starting two programs per step, so at this cell size the processor is now the faster of the two. 0.125 in cells take 1.3-6.2 s on the processor (11-22 s before) and 1.1-2.7 s on the card.

Display

The tooltip on the heat label names the cell size and the hardware. The simulator colors the field against the 99.5th percentile of the whole cut's peaks: a pierce puts its energy into a single cell, and scaling to that cell would hide the areas where heat builds up. Cells whose slug fell away are transparent. Cool cells are translucent, so while the layer shows, every cut or cutting part is filled with one neutral gray set apart from the sheet color instead of its drawing color, which would shift the scale's hues; outlines, numbers, pending parts and selection keep their usual look. The simulator passes the plate's support bed, and its heat label says whether the sheet is cooled by air only or by air and the slats (or support grid).

Sequencing

A heat-aware part sequencer was tried and removed: the cut order comes from Plan Cutting or the user, and OpenNest keeps no automatic part sequencers (the code is in git history before the commit that removed them). A heat-aware order belongs in Plan Cutting's search once FLIR thermal-camera readings calibrate the model. What was tried:

  • Order: a forward greedy from the plate's origin corner. The next part was the one with the least travel seconds plus HeatWeight (seconds per °C, 0.15 by default) times the estimated temperature at its center when the tool got there. Without a thickness it was nearest neighbor.
  • Estimate: each finished part left a Gaussian blob of its energy (AbsorbedPower times its torch-on time), as wide as the part to begin with (a quarter of its squared diagonal), widening by 4αΔt and fading with the surface loss; only the latest 200 parts count. Torch-on time comes from each part's cut length and pierces at stand-in feeds by thickness: 400 in/min up to 0.135 in, 150 up to 0.26 in, 80 above, a 0.5 s pierce up to 0.26 in and 1.5 s above, and 3000 in/min travel.

Why it did not help: Plan Cutting plans its own shortest tour (nearest neighbor, 2-opt, Or-opt), which already traveled a fraction of the removed row-based Advanced sequencer's distance, so the heat order's travel savings over Advanced did not carry over. And its strict search refuses head-down rapids over parts already cut free. A heat-spreading order skips neighbors and comes back to them across cut parts, so the search stalls, learns rules, and ends on its shortest tour or the safest-route fallback; a heat order used only where it does not stall moved the zone metric by noise (±3-5%). Kept as given through Plan Cutting, the heat order does spread the heat, at this cost against the planned shortest tour (2ER and N26-2GT, weights 0.1-0.4, stand-in feeds):

Plate Travel Cut time Head raises (tour: 0) Zone P95 Zone P75
2ER plate 1 (130 parts, 0.25 in) +52 to +82% +0.8 to +1.2% 59-78 −14 to −18% −18 to −23%
N26-2GT plate 1 (112 parts, 0.09 in) +50 to +65% +2.3 to +3.1% 54-62 −24 to −25% −26 to −28%
N26-2GT plate 2 (148 parts, 0.09 in) +64 to +102% +1.8 to +2.8% 53-75 −12 to −20% −18 to −24%

The zone metric is the hottest average over each 4 in square during the cut, as a percentile over zones; pierces and hole clusters inside one part set the hottest cell whatever the order. The head raises are the safest-route fallback's last-resort markers, which the strict search never adds, so a heat order that spreads heat would need designed head raises (or rapids routed around cut parts). Revisit once FLIR readings calibrate the absorbed power and the feeds.