Resources Numerical accuracy

Calculations

Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Filling a hole

    Closes a boundary loop with triangles.

    Newell normal n = Σ ((a_y − b_y)(a_z + b_z), …); ear when cross(a, b, c) > 0 and no other point is inside

    Mesh import, repair and storage meshimport.js
    • PartCraft
    64-bit
  • Growing flat faces

    Joins neighboring triangles into one flat face when they share a plane.

    join when n_s·n_t ≥ cos 0.05° and every corner of t is within tol of s's plane; tol = 2e-6 × size + 1e-7

    Mesh import, repair and storage meshimport.js
    • PartCraft
    64-bit
  • Plane of a flat face

    The normal and origin of each flat face a sketch can sit on.

    n = unit(Σ n_t A_t); origin = Σ (triangle center × A_t) ÷ Σ A_t

    Mesh import, repair and storage meshimport.js
    • PartCraft
    32-bit in part
  • Mesh kept in the part file

    Packs the repaired mesh into the text the part file stores.

    vertices → Float32Array → base64

    Mesh import, repair and storage meshimport.js
    • PartCraft
    32-bit in part
  • Mesh read back from the part file

    Unpacks and checks the stored mesh when a part is opened or rebuilt.

    Mesh import, repair and storage meshimport.js
    • PartCraft
    32-bit in part
  • Permeability of free space

    The constant μ₀ used for air, linear materials and the Maxwell stress.

    μ₀ = 4 × 10⁻⁷ × π

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Reluctivity from a measured B–H curve

    Turns a table of B and H points into ν(B²) and its derivative for the solver.

    H(B) by a monotone cubic through the points; beyond the last point H = H_s + (B − B_s) ÷ μ₀; ν = H ÷ B; dν/dB² = (H′ ÷ B − H ÷ B²) ÷ (2B)

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Banded Cholesky solve

    Factors the tangent matrix and solves for the correction of the potential.

    K = L Lᵀ in band storage; forward then back substitution

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Triangle areas and shape-function gradients

    The area, center and the three gradient vectors of every triangle.

    d = (x₁ − x₀)(y₂ − y₀) − (x₂ − x₀)(y₁ − y₀); area = |d| ÷ 2; ∇Nᵢ = (bᵢ, cᵢ) ÷ d

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Residual and tangent matrix

    Assembles the out-of-balance load and, when asked, the tangent stiffness for the current potential.

    R = load − Σ ν A (∇Nᵢ·∇A); K_ik = Σ A (ν ∇Nᵢ·∇N_k + 2ν′ (∇Nᵢ·∇A)(∇N_k·∇A))

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Newton iteration

    Repeats solve and update until the potential stops changing.

    A ← A + α ΔA, α halved until the residual norm falls; stop when |ΔA| ÷ |A| < tol or |R| < 1e-14 × |load|

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Flux density and energy per element

    The flux density in each triangle and the stored energy per unit depth.

    B = (∂A/∂y, −∂A/∂x); |B| = hypot; energy = Σ ½ ν(|B|²) |B|² × area

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Force and torque by the Maxwell stress

    The force per meter of depth and the torque about the origin on everything inside a set of elements.

    t = ((B_x² − ½B²) n_x + B_x B_y n_y, B_x B_y n_x + (B_y² − ½B²) n_y) ÷ μ₀; F = Σ t × dl; τ = Σ (x t_y − y t_x) dl

    Magnet study: 2D field, force and torque magnet.js
    • PartCraft
    64-bit
  • Sketch regions in SI units

    Converts each profile to meters and sets its material, magnet direction or coil current density.

    x_m = x_mm × 1e-3; area_m² = area_mm² × 1e-3 × 1e-3; B_r = B (cos θ, sin θ); J = I ÷ area

    Magnet study: 2D field, force and torque magnet-study.js
    • PartCraft
    64-bit
  • Mesh sizes for the study

    The triangle size asked for in each body, in each air gap and in the surrounding air.

    base = size × (1 + 2 pad) ÷ 14 ÷ q; body: narrowest side ÷ 5 ÷ q; gap: gap ÷ 4 ÷ q

    Magnet study: 2D field, force and torque magnet-study.js
    • PartCraft
    64-bit
  • Air gap between two bodies

    The narrowest distance between two profiles that stand apart.

    d = min over the corners of each profile of the distance to the other's edges

    Magnet study: 2D field, force and torque magnet-study.js
    • PartCraft
    64-bit
  • Force and torque on each body

    The force in newtons and the torque about the body's own center, for the depth given.

    F = F_per_m × depth; τ = (τ_origin − (c_x F_y − c_y F_x)) × depth

    Magnet study: 2D field, force and torque magnet-study.js
    • PartCraft
    64-bit
  • Results as CSV

    Writes the peak flux density, forces and torques to a CSV file.

    number → toPrecision(8)

    Magnet study: 2D field, force and torque magnet-study.js
    • PartCraft
    64-bit
  • Orientation test

    Which side of a directed line a point lies on, used to walk the triangulation.

    (b_x − a_x)(c_y − a_y) − (b_y − a_y)(c_x − a_x)

    Magnet study: 2D field, force and torque magnetmesh.js
    • PartCraft
    64-bit
  • In-circle test

    Whether a new point lies inside the circle through a triangle's corners, which decides the Delaunay cavity.

    3 × 3 determinant of (a − d, b − d, c − d) with their squared lengths

    Magnet study: 2D field, force and torque magnetmesh.js
    • PartCraft
    64-bit
  • Circumcenter and quality of a triangle

    A triangle's circumcenter, circumradius and shortest edge, used to decide whether to refine it.

    u = (c_y |b|² − b_y |c|², b_x |c|² − c_x |b|²) ÷ (2 (b_x c_y − b_y c_x)), b and c relative to a

    Magnet study: 2D field, force and torque magnetmesh.js
    • PartCraft
    64-bit
  • Encroached boundary segment

    Whether a point lies inside the circle whose diameter is a boundary segment, in which case the segment is split at its midpoint.

    (p − mid)² < (|a − b|² ÷ 4) × (1 − 1e-12)

    Magnet study: 2D field, force and torque magnetmesh.js
    • PartCraft
    64-bit
  • Smallest and largest mesh angle

    The mesh quality figures shown with the result.

    angle = atan2(|u × v|, u·v) in degrees

    Magnet study: 2D field, force and torque magnetmesh.js
    • PartCraft
    64-bit
  • Coarse element matrix

    Forms Rᵀ K R for one fine element inside a coarse element.

    K_coarse += s × Rᵀ K R

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Inverse of each node's 3 × 3 block

    Inverts the diagonal block of every node for the block Jacobi smoother.

    D⁻¹ = adj(D) ÷ det(D)

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Damped block Jacobi sweep

    One smoothing step on a level.

    x ← x + ω D⁻¹ (b − A x), ω = 0.6

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Restriction and prolongation

    Moves residuals to the coarser grid and corrections back to the finer one.

    weight = ½ for each direction in which the fine node lies between two coarse nodes

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Coarsest-level factorization

    Factors the coarsest level's matrix once so each cycle can solve it directly.

    A = L Lᵀ in band storage, nodes renumbered with the longest axis slowest

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Coarsest-level solve

    Forward and back substitution with the stored factor.

    Geometric multigrid for the voxel stress model mg.js
    • PartCraft
    64-bit
  • Motion laws

    How far along its travel the joint is at each fraction of the time.

    linear: s; ease: s²(3 − 2s); sine: ½ − ½ cos(πs); round trip: 2s or 2 − 2s; value = from + (to − from) × law(k ÷ steps)

    Motion study of an assembly motion.js
    • PartCraft
    64-bit
  • Default tracked point

    The middle of a part's bounding box, tracked when no point is given.

    center = (min + max) ÷ 2 per axis

    Motion study of an assembly motion.js
    • PartCraft
    32-bit in part
  • Solids for the clearance check

    Rebuilds each part as a solid so the gap between parts can be measured at every step.

    Motion study of an assembly motion.js
    • PartCraft
    32-bit in part
  • Velocity and acceleration

    The rate of the joint value and each tracked point's velocity, speed and acceleration.

    v_k = (p_(k+1) − p_(k−1)) ÷ (t_(k+1) − t_(k−1)); a_k = (p_(k−1) − 2p_k + p_(k+1)) ÷ Δt²

    Motion study of an assembly motion.js
    • PartCraft
    64-bit
  • Peak speed, peak acceleration and travel

    The largest speed and acceleration of each tracked point and the length of its path.

    travel = Σ |p_k − p_(k−1)|

    Motion study of an assembly motion.js
    • PartCraft
    64-bit
  • Numbers in the CSV export

    Formats each time, value, position, speed and gap written to the CSV file.

    text = value.toFixed(5), trailing zeros removed

    Motion study of an assembly motion.js
    • PartCraft
    64-bit
  • Bilinear material constants

    Shear modulus, bulk modulus and hardening modulus from E, ν, yield stress and tangent modulus.

    G = E ÷ (2(1 + ν)); K = E ÷ (3(1 − 2ν)); H = E × E_t ÷ (E − E_t)

    Nonlinear and contact stress study nonlinear.js
    • PartCraft
    64-bit
  • Stress update at a Gauss point

    The stress, the new plastic strain and the algorithmic tangent for a given total strain.

    q = √(1.5 s:s); f = q − (σ_y + H α); Δγ = f ÷ (3G + H); σ = p 1 + (1 − 3GΔγ ÷ q) s

    Nonlinear and contact stress study nonlinear.js
    • PartCraft
    64-bit
  • Element tangent and internal force

    Integrates each element's tangent stiffness and internal force over its four Gauss points.

    K_e = Σ w Bᵀ D_ep B; f_e = Σ w Bᵀ σ; w = weight × det J

    Nonlinear and contact stress study nonlinear.js
    • PartCraft
    64-bit
  • Load-stepped Newton solve

    Raises the load in steps and iterates each step to equilibrium.

    r = λ f − f_int(u) (− contact); converged when |r| ÷ (λ |f|) < tol

    Nonlinear and contact stress study nonlinear.js
    • PartCraft
    64-bit
  • Von Mises stress and plastic strain per element

    The largest von Mises stress and the largest equivalent plastic strain among each element's Gauss points.

    vm_e = max over 4 points of vonMises(σ); α_e = max over 4 points of α

    Nonlinear and contact stress study nonlinear.js
    • PartCraft
    32-bit in part
  • Reported maximum stress, displacement and safety factor

    The peak von Mises stress and where it is, the peak displacement, and the smallest safety factor against yield.

    max σ_vm = largest element value; max |u| = largest nodal √(u_x² + u_y² + u_z²); safety = yield ÷ max σ_vm

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    32-bit in part
  • Support reactions

    The total force the supports carry, overall and per support group.

    R = Σ over constrained nodes of (f_int − f_applied)

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    64-bit
  • Element values averaged to nodes

    The nodal stress and plastic strain fields the plot colors by.

    node value = mean of the values of the elements that share the node

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    64-bit
  • Separating the pieces of a part

    Splits a part's surface mesh into its connected pieces so each can be meshed on its own for a contact study.

    vertices are the same when round(x × 10⁴), round(y × 10⁴), round(z × 10⁴) agree

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    32-bit in part
  • Density unit for the solver

    Converts the material's density from kg/m³ to the solver's tonnes per mm³.

    ρ_t/mm³ = ρ_kg/m³ × 1e-12

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    64-bit
  • Von Mises stress from CalculiX results

    The von Mises stress at each node from the six stress components of a results file.

    σ_vm = √(½((a − b)² + (b − c)² + (c − a)²) + 3(d² + e² + f²))

    Nonlinear and contact stress study nl-worker.js
    • PartCraft
    64-bit
  • Signed area of a pixel outline

    Tells an outer outline from a hole and gives the hole size used to drop specks.

    a = ½ × Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ); hole kept when 2 × √(|a| ÷ π) ≥ minHole

    Photo to sketch: outline fitting and scale photo-sketch.js
    • PartCraft
    64-bit
  • Outline simplification

    Keeps only the outline points that lie farther than the tolerance from the chord between their neighbors.

    d = |dx·(Qy − Ay) − dy·(Qx − Ax)| ÷ L; keep the farthest point when d > tol

    Photo to sketch: outline fitting and scale photo-sketch.js
    • PartCraft
    64-bit
  • Circle through outline points

    The center and radius of the circle that best fits a run of outline points, with its largest and root-mean-square deviation.

    u = x − x̄, v = y − ȳ; solve [Σu² Σuv; Σuv Σv²]·(u_c, v_c) = ½·(Σu³ + Σuv², Σv³ + Σvu²); r = mean distance to the center

    Photo to sketch: outline fitting and scale photo-sketch.js
    • PartCraft
    64-bit
  • Line through outline points

    The direction of the straight line that best fits a run of outline points, through their centroid.

    θ = ½ × atan2(2·Σuv, Σu² − Σv²); d = (cos θ, sin θ)

    Photo to sketch: outline fitting and scale photo-sketch.js
    • PartCraft
    64-bit

A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.