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

  • One time step: stream and collide

    Pulls the populations into each cell, takes density and velocity, and relaxes toward equilibrium.

    ρ = Σ fᵢ; u = (Σ cᵢ fᵢ + F ÷ 2) ÷ ρ

    Flow study: lattice Boltzmann solver flow.js
    • PartCraft
    64-bit
  • Collision with an eddy viscosity

    The collision used in turbulent runs, with a per-cell viscosity and a stabilizer.

    τ = ½ + 3(ν + ν_t); τ_s = ¼ + √(1/16 + 4.5 √2 C² |Π| ÷ ρ); τ = max(τ, τ_s)

    Flow study: lattice Boltzmann solver flow.js
    • PartCraft
    64-bit
  • Mass through boundaries and force on walls

    Sums the net mass rate per boundary group and the momentum-exchange force on the part.

    mass = Σ (f_in − f_out); F = −Σ cᵢ (f_in + f_out)

    Flow study: lattice Boltzmann solver flow.js
    • PartCraft
    64-bit
  • Stepping to a steady state

    Repeats time steps until the velocity field stops changing.

    res = √(Σ |u − u_prev|² ÷ Σ |u|²) ÷ steps between checks

    Flow study: lattice Boltzmann solver flow.js
    • PartCraft
    64-bit
  • 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
  • The mesh handed to the flow solver

    Builds the job for a flow study from the part and the study's settings.

    Flow study: 32-bit steps in the mesh and the result fields flow-study.js
    • PartCraft
    32-bit in part
  • Cell fields, maximum speed and pressure range

    Velocity and pressure of every cell in physical units, and the largest speed and lowest and highest pressure the results state.

    v = u × c_u; p = p_ref + (ρ − 1) ÷ 3 × c_p; v_max = max |v|

    Flow study: 32-bit steps in the mesh and the result fields flow-worker.js
    • PartCraft
    32-bit in part
  • Pressure on the part's surface

    The static pressure at each vertex of the plot mesh, sampled a little way into the fluid.

    p = Σ (wᵢ + 1e-6) pᵢ ÷ Σ (wᵢ + 1e-6) over the fluid cells around the sample point

    Flow study: 32-bit steps in the mesh and the result fields flow-worker.js
    • PartCraft
    32-bit in part
  • Result probe

    Shows the speed, velocity and pressure of the cell under the pointer, or the surface pressure.

    speed = √(v_x² + v_y² + v_z²)

    Flow study: 32-bit steps in the mesh and the result fields flow-ui.js
    • PartCraft
    32-bit in part
  • Lattice Mach number warning

    The fastest cell's speed as a share of the lattice speed of sound.

    Ma = v_max × dt ÷ dx × √3

    Flow study: 32-bit steps in the mesh and the result fields flow-ui.js
    • PartCraft
    32-bit in part
  • Model constants

    The constants of the turbulence model.

    c_w1 = c_b1 ÷ κ² + (1 + c_b2) ÷ σ

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Spalding's law of the wall

    y⁺ as a function of u⁺.

    y⁺ = u⁺ + e^(−κB) (e^(κu⁺) − 1 − κu⁺ − (κu⁺)² ÷ 2 − (κu⁺)³ ÷ 6)

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Friction velocity

    Solves the wall law for the friction velocity from the speed at a distance from the wall.

    find u_τ with spalding(U ÷ u_τ) = y u_τ ÷ ν

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Inverse wall law

    u⁺ as a function of y⁺.

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Wall cells: normal and wall distance

    Each wall cell's wall normal and its true distance to the wall, and the model's starting fields.

    n = Σ wᵢ nᵢ ÷ |Σ wᵢ nᵢ|; y = Σ wᵢ c_n (q c_n) ÷ Σ wᵢ c_n over links with c_n > 0.3, y ≥ 0.05

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    32-bit in part
  • Wall distance of every cell

    The distance from each fluid cell to the nearest wall point.

    d(m) = |v(n) − c| carried from a settled neighbor n along the link c

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Model update in a cell

    The wall function in wall cells and one pseudo-time step of the model equation elsewhere.

    ν̃_new = (ν̃ + Δt × rhs) ÷ (1 + Δt c_w1 f_w ν̃ ÷ d²); wall cell: ν̃ = κ u_τ y

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Pseudo-time step

    The model's time step from the advection and diffusion limits.

    Δt = max(0.05, min(every, 0.5 ÷ u_max, 0.8 σ ÷ (6 (ν + ν̃_max))))

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • First-cell y⁺ statistics

    The minimum, maximum, mean and percentiles of y⁺ over the wall cells.

    percentile p = sorted[⌊p × n⌋]

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Wall force correction for slip

    The term added to the momentum-exchange force on walls that carry a slip velocity.

    F += Σ u_w (f_in − f_out)

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Streamlines

    Traces lines along the flow from seed points for drawing.

    x ← x + ds × v(x + ½ ds v̂) ÷ |v|

    Simulation and flow result plots flow.js
    • PartCraft
    32-bit, display only
  • Slice of a field

    Copies one layer of cells of a field for the cut-plane picture.

    Simulation and flow result plots flow.js
    • PartCraft
    32-bit, display only
  • Field for coloring

    Picks the values and the color range for the cut plane.

    Simulation and flow result plots flow-ui.js
    • PartCraft
    32-bit, display only
  • Plot mesh

    Splits the part's triangles until no edge is longer than the cell size, for drawing a field.

    midpoint = (a + b) ÷ 2

    Simulation and flow result plots fea.js
    • PartCraft
    32-bit, display only
  • One subdivision step

    New face, edge and vertex points of the cage refined once.

    smooth vertex = Q ÷ n + 2R ÷ n + (n − 3) v ÷ n; crease vertex = (a + 6v + b) ÷ 8; edge = mean of its ends and the two face points

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Limit position of a vertex

    Where a vertex ends up on the smooth surface.

    smooth: (n² v + 4 Σ e + Σ f) ÷ (n (n + 5)); crease: (a + 4v + b) ÷ 6; corner: v

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Limit surface normal at a vertex

    The unit normal of the smooth surface at an interior vertex.

    A = 1 + cos(2π ÷ n) + cos(π ÷ n) √(2 (9 + cos(2π ÷ n))); normal = t₁ × t₂ ÷ |t₁ × t₂|

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Bézier patch of one quad

    The 16 control points of the bicubic patch for one face of the refined cage.

    b = M G Mᵀ with rows of M: (1, 4, 1, 0) ÷ 6, (0, 4, 2, 0) ÷ 6, (0, 2, 4, 0) ÷ 6, (0, 1, 4, 1) ÷ 6; across a sharp edge: 2 × edge − inner

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Point on a patch

    Evaluates a bicubic Bézier patch at (u, v).

    S(u, v) = Σᵢ Σⱼ Bᵢ(u) Bⱼ(v) b_ij, B = ((1 − u)³, 3u(1 − u)², 3u²(1 − u), u³)

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Normal of a patch

    The unit normal of a patch at (u, v).

    n = ∂S/∂u × ∂S/∂v, normalized

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Refinement level for conversion

    How many times the cage is refined before it is turned into patches.

    level = max(1 if any face is not a quad, ⌈largest semi-sharp weight − 1e-12⌉), at most 4

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    Exact
  • How well the patches meet

    The largest gap and the largest angle between normals across shared patch edges.

    gap = max |p₀ − p₁|; angle = acos(clamp(n₀ · n₁, −1, 1)) × 180 ÷ π

    Freeform bodies: subdivision surface and cage edits form.js
    • PartCraft
    64-bit
  • Fitting a cage to a target surface

    Moves cage vertices until their limit points lie on a sphere or torus.

    p ← p + (proj(L) − L), L the vertex's limit point

    Freeform bodies: subdivision surface and cage edits form.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.