Resources Numerical accuracy Calculation policy

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.js PartCraft 0.8.1 32-bit in part 3 calculations Reviewed

Tests None 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.

  • sim-thermal-ui.js
  • lines 124 to 126
  • PartCraft 0.8.1
  const T = val(field(r, { ...S, plot: 'temp' }).values);
  return r.transient && S.frame !== r.frames.length - 1 ? t('study.thermal.probe.temp', { T: U.sig(T), at }) : t('study.thermal.probe.temp_flux', { T: U.sig(T), q: U.sig(val(r.vertex.q)), at });
}

Heat balance imbalance

64-bit

The unbalanced heat in watts and as a percent of the larger of inflow and outflow.

percent = 100 × |imbalance| ÷ max(inflow, outflow, 1e-300)

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.

  • sim-thermal-ui.js
  • lines 163 to 165
  • PartCraft 0.8.1
const ref = Math.max(bal.inflow, bal.outflow, 1e-300);
add(t(r.transient ? 'study.thermal.row.imbalance_stored' : 'study.thermal.row.imbalance'), `${U.sig(bal.imbalance)} W (${U.sig(100 * Math.abs(bal.imbalance) / ref)} %)`, { simImbalance: String(bal.imbalance) });
const radiation = r.radiation ? (r.transient ? t('study.thermal.solver.rad_each_step') : t('study.thermal.solver.rad_settled', { n: r.radiation.iterations })) : '';

In detail

Method
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.

Every policy that takes this approach