Resources Numerical accuracy Calculation policy

Nonlinear study fields and thermal stress history

The defaults and checks of a nonlinear or contact study, and the time steps and loads of a thermal stress history.

How the precision is kept

These functions build the inputs and read the results of solvers that live in other files. The arithmetic here is small and 64-bit. The solver tolerance and step counts set the accuracy of the results.

Calculations under this policy

4 calculations in 2 source files. 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.

nlstudy.js PartCraft 0.8.1 64-bit 2 calculations Reviewed

Tests None found by the review

Default tangent modulus and its check

64-bit

Sets the slope after yield when none is given and flags one that is not below E.

Et = E ÷ 100 when not given

One 64-bit division. The check Et < E is a plain comparison with no tolerance.

  • nlstudy.js
  • lines 72 to 73
  • PartCraft 0.8.1
const Et = nl.Et === null ? (mat ? mat.E / 100 : 0) : nl.Et;
if (mat && !(Et < mat.E)) problems.push(t('study.nl.problem.et_too_big', { Et, E: mat.E }));

Contact penetration problem

64-bit

Flags a contact penetration over 1 percent of the element size, with the values it reports.

problem when max penetration > 0.01 × h; pct = 100 × pen ÷ h

The comparison is exact. The reported values are rounded to 3 significant digits and the percent to 2 decimals, in the message only.

  • nlstudy.js
  • lines 102 to 110
  • PartCraft 0.8.1
const c = n.contact;
if (c && c.h > 0 && c.maxPenetration > PEN_LIMIT * c.h) out.push({
  id: src + ':nl.penetration', code: 'sim.nl.penetration', severity: 'warning',
  msg: { key: 'study.nl.p.penetration', vars: { pen: +c.maxPenetration.toPrecision(3), h: +c.h.toPrecision(3), pct: +(100 * c.maxPenetration / c.h).toFixed(2) } },
  about: [{ kind: 'study', id: 'simulation', label: t('study.nl.p.about') }],
  ...(c.at ? { where: { space: '3d', at: c.at } } : {}),
  source: { kind: 'engine', name: src },
  req: { op: '<=', value: +(PEN_LIMIT * c.h).toPrecision(3), unit: 'mm' }, found: { value: +c.maxPenetration.toPrecision(3), unit: 'mm' },
});
thermal-history.js PartCraft 0.8.1 64-bit 2 calculations Reviewed

Tests tools/partcraft-test/test-thermal.mjs

Time steps solved for stress

Exact

Chooses which time steps of the heat run get a stress solve.

stepᵢ = round(i × steps ÷ (n − 1)), i = 0…n−1

Integer steps from one 64-bit division and rounding, with duplicates removed. n is limited to 2 to 51.

  • thermal-history.js
  • lines 31 to 37
  • PartCraft 0.8.1
/** The time steps solved for stress: [step] for 'time', else `solves` steps evenly over the run, 0 (the start) and the end included. */
export function stressSteps(tr, tl) {
  if ((tl.at || 'worst') === 'time') return [stepAt(tr, tl.time).step];
  const n = Math.max(2, Math.min(MAX_SOLVES, Math.round(tl.solves || 21)));
  const out = new Set(); for (let i = 0; i < n; i++) out.add(Math.round(i * tr.steps / (n - 1)));
  return [...out].sort((a, b) => a - b);
}

Thermal load per step

64-bit

The load vector of each stress step and the temperature range of the worst step.

ΔT = T − Tref; f = f_mech + ft(ΔT)

ΔT and f are Float64Array. Frames of T come from the heat run, so their type is whatever thermal.js gives (not read here). The reported temperature range is taken from the 64-bit ΔT copy of the worst step.

  • thermal-history.js
  • lines 87 to 89
  • PartCraft 0.8.1
for (let n = 0; n < s.nn; n++) dT[n] = s.active[n] ? T[n] - Tref : 0;
const ft = TH.thermalLoadVector(s.mesh, s.mat, dT);
for (let k = 0; k < f.length; k++) f[k] = fm[k] + ft[k];

In detail

Method
Default tangent modulus Et = E ÷ 100; thermal load vector uses ΔT = T − Tref per node; time steps spread evenly over the run.
Number types
64-bit arrays (Float64Array for the load and temperature difference). The temperature frames are read from the thermal run, whose storage type is set in thermal.js (not read here).
Tolerances
Nonlinear tol is 1e-6 by default and must be 1e-10 to 1e-2; a penetration over 1 percent of the element size is a problem; the stress solve tolerance defaults to 1e-8; contact penalty factor 1 to 1e4 (20 by default).
Checked by
tools/partcraft-test/test-thermal.mjs is named in the file header as the check of linear superposition and the steady limit; it was not run here.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach