Thermal window temperature range and balance read-outs
The temperature range of a thermal plot, the probed temperature and the heat balance figures.
How the precision is kept
The vertex temperatures and flux the thermal worker returns are Float32Array values, and the plot range and the probe text are taken from them. The balance rows print 4 significant digits of numbers delivered by the worker.
Open item. Return the vertex temperatures from thermal-worker.js as 64-bit values, or at least compute the reported range from the 64-bit solver result before it is stored in 32-bit.
Calculations under this policy
3 calculations in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.
sim-thermal-ui.jsPartCraft 0.8.1 32-bit in part3 calculationsReviewed
TestsNone found by the review
Temperature range of the plot
32-bit in part
The lowest and highest temperature used for the plot scale and its tick labels.
lo = min T, hi = max T over all vertices (all frames when transient)
The values compared are 32-bit temperatures from the worker, so the range ends carry about 7 digits.
sim-thermal-ui.js
lines 105 to 109
PartCraft 0.8.1
function tRange(r) {
if (!r.transient) { let lo = Infinity, hi = -Infinity; for (const v of r.vertex.T) { lo = Math.min(lo, v); hi = Math.max(hi, v); } return [lo, hi]; }
let lo = Infinity, hi = -Infinity; for (const F of r.frames) for (const v of F) { lo = Math.min(lo, v); hi = Math.max(hi, v); }
return [lo, hi];
}
Probed temperature and flux
32-bit in part
The temperature and flux text shown when a point is probed.
The probe value val() is read from the 32-bit field array and printed with 4 significant digits.
The percent is a 64-bit division by a value kept at 1e-300 or more so it cannot divide by zero. The balance numbers are printed with 4 significant digits.
Minimum and maximum of the stored temperatures; text with 4 significant digits.
Number types
r.vertex.T and r.vertex.q are Float32Array (built in thermal-worker.js sample() and for q); transient frames are Float32Array too (thermal-worker.js at()). Range and probe use these.
Tolerances
When the range has no width the top is set to the bottom plus 1.
Limits
The balance figures are read as delivered; their types are set in the worker.
Approach: 32-bit step, flagged
One step stores or exchanges 32-bit values that reach a number a person reads. It is listed here with its open item, and the step is either moved to 64-bit or the app will warn where the number is read.