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

  • Lattice units from physical ones

    Chooses the lattice speed, viscosity, relaxation time and time step for a cell size, speed and fluid.

    Re_cell = U dx ÷ ν; u = min(0.05, √(0.03 ÷ k), 0.5 Re_cell); τ = 3 u ÷ Re_cell + ½; dt = u dx ÷ U

    Flow study: lattice Boltzmann solver flow.js
    • PartCraft
    64-bit
  • Face normal and area

    The area-weighted outward normal of a face, its area and how flat it is.

    area = Σ |nₜ| ÷ 2; flatness = |Σ nₜ| ÷ (2 × area)

    Flow study: fluid cells, openings and wall distances flow-domain.js
    • PartCraft
    64-bit
  • Area of an opening's holes

    The area of the holes in a flat face, which is the opening's true area.

    loop area = ½ Σ (pₐ × p_b) · n; holes = Σ −area over clockwise loops

    Flow study: fluid cells, openings and wall distances flow-domain.js
    • PartCraft
    64-bit
  • Lid cells over an opening

    Finds the cells just behind a flat face that cover its holes.

    raster area = hole pixels × (h ÷ 2)²

    Flow study: fluid cells, openings and wall distances flow-domain.js
    • PartCraft
    64-bit
  • Wall distance along a link

    Where the link from a fluid cell to a solid cell crosses the part's surface.

    t = (e₂ · (tv × e₁)) ÷ (e₁ · (d × e₂))

    Flow study: fluid cells, openings and wall distances flow-domain.js
    • PartCraft
    64-bit
  • Frontal area

    The area of the part seen along the flow, used as the reference area for drag and lift coefficients.

    area = covered pixels × pixel size², pixel size = larger extent ÷ 1024

    Flow study: fluid cells, openings and wall distances flow-domain.js
    • PartCraft
    64-bit
  • Automatic cell size

    Picks the cell size that gives about a target number of cells in the grid box.

    h = ∛(volume ÷ target), rounded up to 1, 1.25, 1.5, 2, 2.5, 3, 4, 5, 6, 8 or 10 times a power of ten

    Flow study: fluid cells, openings and wall distances flow-study.js
    • PartCraft
    64-bit
  • Cell count estimate

    The number of grid cells a study will use.

    n = ⌈extent ÷ h − 1e-6⌉ + margin cells, per axis

    Flow study: fluid cells, openings and wall distances flow-study.js
    • PartCraft
    64-bit
  • Lift direction

    The direction lift is measured along, made square to the flow.

    l = l₀ − (l₀ · d) d, then divided by its length

    Flow study: fluid cells, openings and wall distances flow-study.js
    • PartCraft
    64-bit
  • Inlet flow and speed

    Each inlet's flow rate, mean speed and the speed set on its lattice links.

    Q = v × A (or the given Q); U = Q ÷ A; link speed = Q × (A_face ÷ A) ÷ (lattice link area × dx²); D = √(4A ÷ π)

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Speed and pressure scales

    The factors between lattice and physical speed and pressure, and the density set at each outlet.

    c_u = dx ÷ dt; c_p = ρ c_u²; ρ_outlet = 1 + 3 (p − p_ref) ÷ c_p

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Second steady-state test

    Watches the pressure drop or the drag force between checks before the run is accepted as steady.

    |q − q_prev| ÷ max(|q|, 1e-30) < 1e-4 on two checks in a row

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Mass flow, mean pressure and pressure drop

    The mass and volume flow through each opening, its mean pressure, and the pressure drop between inlets and outlets.

    ṁ = lattice mass × ρ dx³ ÷ dt; p = p_ref + (mean ρ − 1) ÷ 3 × c_p; Δp = flow-weighted mean inlet p − outlet p

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Force, drag and lift coefficients

    The force on the part in newtons and, for external flow, drag, lift and their coefficients.

    F = lattice force × ρ dx⁴ ÷ dt²; C_d = F · d ÷ (½ ρ U² A)

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Reynolds number

    The Reynolds number of the study.

    Re = U √(4A ÷ π) ÷ ν (internal); Re = U L ÷ ν (external)

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Inflow eddy viscosity

    The turbulence level given to inflows in a turbulent run.

    ν_t = max(3ν, √1.5 × 0.09^0.25 × I × u × ℓ), I = 5 % (internal) or 1 % (external)

    Flow study: results in physical units flow-worker.js
    • PartCraft
    64-bit
  • Mass balance

    The share of the inflow that does not leave through the outlets.

    balance = (ṁ_in − ṁ_out) ÷ ṁ_in

    Flow study: results in physical units flow-ui.js
    • PartCraft
    64-bit
  • Point on a B-spline curve

    The point of a curve at a parameter, from its poles and knots.

    C(t) = Σ Nⱼ(t) × Pⱼ over the p + 1 poles of the span

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Point on a B-spline surface

    The point of the surface at (u, v), from its pole grid and two knot vectors.

    S(u, v) = Σᵢ Σⱼ Nᵢ(u) × Nⱼ(v) × Pᵢⱼ

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Interpolation knots by averaging

    The knot vector used to interpolate points at given parameters.

    inner knot j = (t_j + … + t_(j+p−1)) ÷ p

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Band solve for interpolation

    Factors the collocation matrix once and solves for the poles of every curve that shares its parameters.

    N × P = Q, with N banded; LU without pivoting, then forward and back substitution

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Degree raising and knot refinement

    Re-expresses a curve with a higher degree or more knots without changing its shape.

    new poles = solve(N_fine(g), C(g)), g = Greville points of the finer knot vector

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Merged knot vector

    The smallest knot vector that contains the knot vectors of several curves.

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Joining exact curves end to end

    Makes one B-spline from a chain of lines and splines, with a corner knot at each joint.

    knot = a + (b − a) × u for each piece's inner knots; joint knots repeated d times

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Sketch chains as world curves

    Turns the chosen lines, arcs, circles and splines of a sketch into curves over 0 to 1, one per chain.

    share of a piece = its length ÷ total length; arc length = r × sweep; circle = 2π × r

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Closest points of two segments

    The nearest pair of points on two straight segments, used to find where two curves may cross.

    s = (b·f − c·e) ÷ (a·e − b²), t = (b·s + f) ÷ e, both clamped to 0…1

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Crossing of two curves

    The parameters on a profile and a guide where they meet, and the gap between them there.

    minimize |A(s) − B(t)|² by Gauss–Newton; point = (A(s) + B(t)) ÷ 2; gap = |A(s) − B(t)|

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • All crossings of a profile and a guide

    Finds every place two curves come within the gap tolerance, so the network can be checked to be a grid.

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Common parameters of a curve family

    The shared parameter at which every profile (or guide) meets each curve of the other family.

    t_q = mean over the curves of (x_q − x_first) ÷ (x_last − x_first)

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Monotone reparametrization

    A smooth increasing map from the common parameters to one curve's own crossing parameters.

    m_k = (w₁ + w₂) ÷ (w₁ ÷ d_(k−1) + w₂ ÷ d_k); cubic Hermite on each interval

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Distance from a point to a curve

    How far a point of the fitted surface or curve is from the true curve near a given parameter range.

    golden-section search for the minimum of |g(t) − q|

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Making a curve family compatible

    Gives every profile (or every guide) the same degree and knots, exactly when possible and by fitting otherwise.

    exact: raise degree, merge knots; otherwise: cubic interpolation of C(r(s)), points doubled until error ≤ fitTol

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Boolean sum of the three surfaces

    Adds the surface through the profiles and the surface through the guides and subtracts the surface through the grid points.

    P = Lu + Lv − T, pole by pole

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Tangency to a plane along a boundary

    Makes the surface leave a boundary curve tangent to a plane and reports the angle it made with the plane before.

    second pole row: q ← a + (d − n × (d·n)), d = q − a; angle = asin(|d·n| ÷ |d|)

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Deviation from the input curves

    The largest distance between the finished surface and any profile or guide, shown in the panel.

    dev = max over 401 samples per curve of |S(s) − C(r(s))|

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Fold check

    Refuses a surface whose normal flips between neighboring sample points.

    n = (S(u + h, v) − S(u − h, v)) × (S(u, v + h) − S(u, v − h)), h = 1e-7; fold if n₁·n₂ < 0

    Surface through a network of curves gordon.js
    • PartCraft
    64-bit
  • Extrude height and start

    The height of the extruded tool and where it starts along the sketch normal, for blind, two-sided, mid-plane and through-all ends.

    two-sided: h = depth + depth₂; mid-plane: z₀ = −h ÷ 2; through all: h = extent + 1 + 0.01 × (max − min)

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Revolve profile in axis coordinates

    Turns each profile point into a radius from the axis and a height along it before the profile is revolved.

    r = max(0, d·n); z = d·u; d = p − a, u = unit axis, n = unit normal to the axis on the profile's side

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Plane, cylinder or cone swept by a profile line

    Classifies the surface a straight profile line sweeps and, for a cone, finds its apex and slope.

    slope = (r₂ − r₁) ÷ (z₂ − z₁); apex height = z₁ − r₁ ÷ slope

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Hole depth

    The depth of a drilled hole, including a through hole's length past the body.

    through: depth = extent on the drilling side + 1 + 0.01 × (max − min)

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Countersink cone height

    The height of a countersink from its diameter, the hole diameter and the included angle.

    h = (R − r) ÷ tan(angle × π ÷ 360)

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Thread zone of a tapped hole

    The inner and outer radius of a tapped hole's thread, used when parts are checked against each other.

    r₀ = min(drill, d − 1.082532 × p) ÷ 2; r₁ = d ÷ 2

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Circular pattern step

    The angle between copies of a circular pattern and the rotation applied to each copy.

    full turn: step = 360 ÷ count; otherwise step = angle ÷ (count − 1); copy i turned by step × i

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Extent of the body along a normal

    How far the body reaches in front of and behind a sketch plane, for through-all cuts and through holes.

    range = min and max of (corner − o)·n over the 8 corners of the bounding box

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Reference stored for a picked flat face

    Chooses the stable face reference for a picked flat triangle, or stores a fixed plane when none matches.

    match: c.n·n > 1 − 1e-6 and |(p − c.o)·c.n| < 1e-4 × max(1, |p|); else o rounded to 9 decimals, n to 12

    Feature tool dimensions on the mesh kernel kernel.js
    • PartCraft
    64-bit
  • Arc through three points

    Center, radius, start angle and signed sweep of an outline arc given by its start, middle and end.

    c_x = (|a|²(m_y − b_y) + |m|²(b_y − a_y) + |b|²(a_y − m_y)) ÷ d, d = 2 (a_x(m_y − b_y) + m_x(b_y − a_y) + b_x(a_y − m_y))

    Circuit board outline, holes and part boxes kicad.js
    • PartCraft
    64-bit
  • Arc as straight segments

    The points that replace an arc or circle of the board outline.

    steps = max(2, ⌈|sweep| ÷ 7.5°⌉); pₖ = c + r (cos aₖ, sin aₖ), aₖ = a₀ + sweep × k ÷ steps

    Circuit board outline, holes and part boxes kicad.js
    • PartCraft
    64-bit
  • Joining outline pieces into loops

    Chains lines and arcs of the edge layer into closed outlines.

    Circuit board outline, holes and part boxes kicad.js
    • PartCraft
    64-bit
  • Footprint point on the board

    Moves a point of a footprint (a pad, a corner of its box) to board coordinates.

    x = at_x + l_x cos a − l_y sin a; y = −at_y + l_x sin a + l_y cos a; l_y = −p_y, a = rotation × π ÷ 180

    Circuit board outline, holes and part boxes kicad.js
    • PartCraft
    64-bit
  • Board thickness parameter

    The part parameter that drives the board's extrusion depth.

    board_t = thickness rounded to 4 decimals

    Circuit board outline, holes and part boxes kicad.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.