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

  • Pressure

    The virial pressure of the box.

    P = (2 KE + W) ÷ (3V) × unit factor

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Time stepping, thermostats and barostat

    Advances the system by velocity Verlet, with optional temperature and pressure coupling.

    v += ½ dt a; x += dt v; forces; v += ½ dt a; Berendsen λ = √(1 + dt÷τ (T₀÷T − 1)); μ = ∛(max(0.5, 1 − dt÷τ_p κ (P₀ − P)))

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Radial distribution function

    g(r): how many atoms sit at each distance, relative to an ideal gas of the same density.

    g(b) = count(b) ÷ (frames × shell × N_A × (N_B, or N_A − 1 for one type) ÷ V), shell = 4⁄3 π ((b+1)³ − b³) dr³

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Mean-square displacement and diffusion

    The mean-square displacement over time and the diffusion coefficient from its slope.

    D = (n Σtm − Σt Σm) ÷ (n Σt² − (Σt)²) ÷ 6 over the chosen part of the samples

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Mass density

    The density of the box in g/cm³ (real units).

    ρ = Σm ÷ 0.602214076 ÷ V (amu per ų to g/cm³)

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Fast Fourier transform

    The in-place radix-2 transform used on each axis of the charge mesh.

    Molecular dynamics molecular/pme.js
    • CadCraft
    • BimCraft
    64-bit
  • Cardinal B-spline

    The weight of a charge on a mesh point.

    M₂(u) = 1 − |u − 1|; Mₙ(u) = u ÷ (n−1) × Mₙ₋₁(u) + (n−u) ÷ (n−1) × Mₙ₋₁(u−1)

    Molecular dynamics molecular/pme.js
    • CadCraft
    • BimCraft
    64-bit
  • B-spline moduli

    The correction 1 ÷ |b(m)|² applied to each mesh wave vector.

    Molecular dynamics molecular/pme.js
    • CadCraft
    • BimCraft
    64-bit
  • Particle-mesh Ewald energy and forces

    The reciprocal Coulomb energy and the force on every charge from a mesh instead of the plain sum.

    E = ½ Σ_m G(m) |Q̂(m)|², G = ke ÷ (πV) × exp(−π² m² ÷ α²) ÷ m² × B(m)

    Molecular dynamics molecular/pme.js
    • CadCraft
    • BimCraft
    64-bit
  • Rigid bonds

    Moves atoms after a step so each constrained bond has its set length, and corrects the velocities.

    g = (d² − r²) ÷ (2 (1÷mᵢ + 1÷mⱼ) r·s); stop when |d² − r²| ≤ 2 × tol × d²

    Molecular dynamics molecular/pme.js
    • CadCraft
    • BimCraft
    64-bit
  • Mean and standard error of a run

    The mean of the samples and its standard error by block averaging.

    mean = Σx ÷ n; error = √(Σ(blockᵢ − m)² ÷ (nb − 1) ÷ nb), nb = min(5, n) blocks of ⌊n ÷ nb⌋ samples

    Molecular dynamics molecular/props.js
    • CadCraft
    • BimCraft
    64-bit
  • Run results as component properties

    The liquid density and diffusion coefficient of a run in SI units for a process component.

    ρ (kg/m³) = ρ (g/cm³) × 1000; D (m²/s) = D (Ų/ps) × 1e-8

    Molecular dynamics molecular/props.js
    • CadCraft
    • BimCraft
    64-bit
  • Linear solve

    x from A x = b for a small dense system.

    Gaussian elimination with row exchange on the largest pivot, then back substitution

    Solvers shared by the process engine process/numeric.js
    • CadCraft
    • BimCraft
    64-bit
  • Newton iteration

    The solution of a set of nonlinear equations F(x) = 0.

    J Δx = −F, Jᵢⱼ ≈ (Fᵢ(x + h eⱼ) − Fᵢ(x)) ÷ h, h = 1e-7 × max(|xⱼ|, 1e-6); x ← x + λ Δx, λ halved until |F| falls

    Solvers shared by the process engine process/numeric.js
    • CadCraft
    • BimCraft
    64-bit
  • Adaptive Runge–Kutta integration

    y(x₁) for a system of ordinary differential equations, with the accepted points along the way.

    Dormand–Prince 5(4): error = max |h Σ(b₅ − b₄)k| ÷ (atol + rtol × max(|y|, |y_new|)) ≤ 1; h ← h × clamp(0.9 × error^(−0.2), 0.2, 5)

    Solvers shared by the process engine process/numeric.js
    • CadCraft
    • BimCraft
    64-bit
  • Bracketed root

    A root of one equation between two points where the function changes sign.

    c = (f_a b − f_b a) ÷ (f_a − f_b); the retained end's value is halved when the same side is kept twice

    Solvers shared by the process engine process/numeric.js
    • CadCraft
    • BimCraft
    64-bit
  • Model constants

    The constants of the two equations of state and the correlation for κ(ω).

    PR: Ω_a = 0.45724, Ω_b = 0.07780, σ = 1 + √2, ε = 1 − √2; SRK: Ω_a = 0.42748, Ω_b = 0.08664

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Real roots of a cubic

    The real roots of z³ + c₂z² + c₁z + c₀ = 0 in ascending order.

    p = c₁ − c₂² ÷ 3; q = 2c₂³ ÷ 27 − c₂c₁ ÷ 3 + c₀; disc = q² ÷ 4 + p³ ÷ 27; one root: ∛(−q⁄2 + √disc) + ∛(−q⁄2 − √disc) − c₂⁄3; three: 2√(−p⁄3) cos((acos(arg) − 2πk) ÷ 3) − c₂⁄3

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Attraction parameter of each component

    a(T) and its temperature derivative for every pure component.

    aᵢ = a_c,ᵢ (1 + κᵢ (1 − √(T ÷ T_c,ᵢ)))²; daᵢ/dT = −a_c,ᵢ κᵢ (1 + κᵢ(1 − √(T÷T_c))) ÷ √(T T_c,ᵢ)

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Mixture parameters

    a, da/dT and b of a mixture of given composition.

    a = Σᵢ Σⱼ yᵢ yⱼ √(aᵢ aⱼ) (1 − kᵢⱼ); b = Σ yᵢ bᵢ

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Compressibility roots

    The physical compressibility factors of a mixture at a temperature and pressure.

    β = bP ÷ RT; A = aP ÷ (RT)²; Z³ + c₂Z² + c₁Z + c₀ = 0 with c from β, A, ε, σ; keep Z > β (1 + 1e-12)

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Fugacity coefficients

    ln φ of every component for one compressibility root.

    ln φᵢ = bᵢ⁄b (Z − 1) − ln(Z − β) − a ÷ (bRT) × (2 Σⱼ yⱼ aᵢⱼ ÷ a − bᵢ⁄b) × I, I = ln((Z + σβ) ÷ (Z + εβ)) ÷ (σ − ε)

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Enthalpy and entropy departures

    How far a real phase's enthalpy and entropy are from the ideal gas at the same temperature and pressure.

    H − H_ig = RT (Z − 1) + (T da/dT − a) ÷ b × I; S − S_ig = R ln(Z − β) + (da/dT) ÷ b × I

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Vapor pressure of a pure component

    The pressure at which the liquid and vapor roots of one component have equal fugacity.

    P ← P × exp(ln φ_L − ln φ_V) until |ln φ_L − ln φ_V| < 1e-12

    Cubic equations of state process/eos.js
    • CadCraft
    • BimCraft
    64-bit
  • Ideal-gas enthalpy

    The ideal-gas enthalpy of a component, with its formation enthalpy, at a temperature.

    H = h_f + R (A (T − T₀) + B⁄2 (T² − T₀²) + C⁄3 (T³ − T₀³) − D (1⁄T − 1⁄T₀))

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Ideal-gas entropy

    The ideal-gas entropy of a component at a temperature, relative to 298.15 K.

    S = R (A ln(T ÷ T₀) + B (T − T₀) + C⁄2 (T² − T₀²) − D⁄2 (1⁄T² − 1⁄T₀²))

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Vapor pressure for the ideal and activity models

    The vapor pressure of a component from its Antoine constants, or an estimate when it has none.

    P = exp(A − B ÷ (T + C)); without Antoine: P = P_c exp(5.373 (1 + ω)(1 − T_c ÷ T))

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Heat of vaporization

    The heat of vaporization of a component at a temperature.

    ΔH(T) = ΔH(T_b) × ((1 − T⁄T_c) ÷ (1 − T_b⁄T_c))^0.38

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Liquid molar volume

    The saturated liquid volume of a component for the ideal and activity models.

    V = R T_c ÷ P_c × Z_ra^(1 + (1 − T_r)^(2⁄7)), Z_ra = 0.29056 − 0.08775 ω

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Enthalpy, entropy and volume of one phase

    The molar enthalpy, entropy and volume of a liquid or vapor of given composition.

    EOS: H = Σ xᵢ H_ig,ᵢ + departure; V = ZRT ÷ P. Activity liquid: H = Σ xᵢ (H_ig,ᵢ − ΔH_vap,ᵢ) + H^E, H^E = −RT² Σ xᵢ ∂ln γᵢ⁄∂T

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • K-values

    ln K of every component between a liquid and a vapor composition.

    EOS: ln Kᵢ = ln φᵢ(liquid) − ln φᵢ(vapor); activity: ln Kᵢ = ln γᵢ + ln(P_sat,ᵢ ÷ P), or ln(Hᵢ ÷ P) for a Henry solute

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Vapor fraction (Rachford–Rice)

    The vapor fraction that balances a feed for given K-values.

    Σ zᵢ (Kᵢ − 1) ÷ (1 + V (Kᵢ − 1)) = 0, 0 ≤ V ≤ 1

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Phase stability test

    Whether a mixture at a temperature and pressure stays one phase or splits.

    Yᵢ ← exp(ln zᵢ + ln φᵢ(z) − ln φᵢ(y)); unstable when ΣY > 1 + 1e-8

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Two-phase flash iteration

    The vapor fraction and the two compositions at a temperature and pressure.

    V from Rachford–Rice; xᵢ = zᵢ ÷ (1 + V (Kᵢ − 1)); yᵢ = Kᵢ xᵢ; K ← exp(ln K(x, y)) until max |Δ ln K| < 1e-13

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Liquid–liquid split

    Two liquid phases and their fractions for an activity model.

    trial phases from each component at 0.9; split when the tangent-plane distance < −1e-9; K ← exp(ln γ(x₂) − ln γ(x₁)) until max |Δ ln K| < 1e-12

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Saturation residual

    How far a mixture is from its bubble or dew point at a trial temperature or pressure.

    bubble: Σ Kᵢ zᵢ − 1; dew: 1 − Σ zᵢ ÷ Kᵢ

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Bubble and dew points

    The bubble or dew temperature at a pressure, or pressure at a temperature.

    scan a geometric grid for a sign change of the residual, then bisect on √(a b) until b ÷ a − 1 < 1e-13

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Temperature for a given enthalpy or entropy

    The temperature at which a PT flash has the wanted enthalpy or entropy.

    false position inside a bracket; stop when b − a < 1e-10 K or |f| < 1e-9 (|target| + 1)

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Flash at a vapor fraction

    The state at a pressure and a wanted vapor fraction.

    bisect T between the bubble and dew temperatures until the bracket is below 1e-9 K

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Saturation temperature of a pure component

    The temperature at which a pure component's vapor pressure equals the pressure.

    bisect T on [20 K, T_c − 1e-6] until the bracket is below 1e-11 K

    Property package and flashes process/thermo.js
    • CadCraft
    • BimCraft
    64-bit
  • Gas constant

    R, used by the property package, the equations of state, the reactors and the dynamic simulation.

    R = 8.314462618 J/(mol K)

    Property package and flashes process/data.js
    • CadCraft
    • BimCraft
    64-bit
  • Component data to SI

    A component's critical pressure, molar mass and Antoine constants in the units the engine works in.

    P_c (Pa) = P_c (bar) × 1e5; M (kg/mol) = M ÷ 1000; A′ = A + ln 1000; C′ = C − 273.15

    Property package and flashes process/data.js
    • CadCraft
    • BimCraft
    64-bit
  • 2×2 solve

    The Newton step for the two phase fractions.

    det = a d − b c; x = (r₁ d − b r₂) ÷ det; y = (a r₂ − c r₁) ÷ det

    Three-phase flash process/vlle.js
    • CadCraft
    • BimCraft
    64-bit
  • Phase fractions

    The vapor and second-liquid fractions for the current K-values.

    gⱼ = Σ zᵢ (Kⱼᵢ − 1) ÷ Dᵢ = 0, Dᵢ = 1 + β_v (K_v,ᵢ − 1) + β_l (K_l,ᵢ − 1)

    Three-phase flash process/vlle.js
    • CadCraft
    • BimCraft
    64-bit
  • Composition update

    The liquid compositions and the new K-values after each pass.

    x₁,ᵢ = zᵢ ÷ Dᵢ; x₂,ᵢ = x₁,ᵢ K_l,ᵢ; error = max |ln(K_new ÷ K)|

    Three-phase flash process/vlle.js
    • CadCraft
    • BimCraft
    64-bit
  • Residuals of a result

    The largest iso-fugacity difference between the phases and the largest component-balance error, as the calculator reports them.

    iso = max |ln(xᵢγᵢ)₁ − ln(xᵢγᵢ)₂|, |ln(yᵢP) − ln(xᵢγᵢP_sat,ᵢ)|; balance = max |Σ_phases frac × xᵢ − zᵢ|

    Three-phase flash process/vlle.js
    • CadCraft
    • BimCraft
    64-bit
  • Reference-state offsets

    The shifts that put CoolProp's enthalpy and entropy on the engine's reference state.

    ΔH = h_f − H(298.15 K, 1e-4 mol/m³); ΔS = −(S(298.15 K, 1e-4 mol/m³) − R ln(1e5 ÷ (1e-4 R T₀)))

    Pure-fluid properties from CoolProp process/coolprop.js
    • CadCraft
    • BimCraft
    64-bit
  • Properties at a temperature and pressure

    Enthalpy, entropy, heat capacity, molar density, molar mass and phase of a pure fluid.

    H = H_CoolProp + ΔH; S = S_CoolProp + ΔS; M (g/mol) = M (kg/mol) × 1000

    Pure-fluid properties from CoolProp process/coolprop.js
    • CadCraft
    • BimCraft
    64-bit
  • Saturation values

    Vapor pressure, saturated liquid and vapor densities and heat of vaporization at a temperature.

    ΔH_vap = H(T, vapor) − H(T, liquid)

    Pure-fluid properties from CoolProp process/coolprop.js
    • CadCraft
    • BimCraft
    64-bit
  • Ideal-gas heat-capacity fit

    A quadratic C_p ÷ R = A + B T + C T² fitted to the dilute-gas enthalpy slope over a temperature range.

    C_p(T) ≈ H(T + 0.5) − H(T − 0.5) at 13 temperatures; normal equations M s = v solved by 3×3 determinants

    Pure-fluid properties from CoolProp process/coolprop.js
    • CadCraft
    • BimCraft
    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.