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.
Calculations
-
Minimum reflux (Underwood)
The Underwood root between the key volatilities and the minimum reflux ratio from it.
Σ αᵢ z_F,ᵢ ÷ (αᵢ − θ) = 1 − q; R_min = Σ αᵢ x_D,ᵢ ÷ (αᵢ − θ) − 1
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Kremser equation
The fraction of a component absorbed or stripped in N stages.
(A^(N+1) − A) ÷ (A^(N+1) − 1); N ÷ (N + 1) when |A − 1| < 1e-12
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Feed thermal condition
q of a feed: the fraction that joins the liquid below the feed stage.
q = (H_dew − H_feed) ÷ (H_dew − H_bubble)
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Shortcut split of the non-key components
How every component divides between distillate and bottoms, and the volatilities used for it.
dᵢ ÷ bᵢ = (d_HK ÷ b_HK) αᵢ^N_min; αᵢ = √((Kᵢ ÷ K_HK)_top (Kᵢ ÷ K_HK)_bottom)
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Feed stage and duties of the shortcut column
The split of stages above and below the feed (Kirkbride) and the condenser and reboiler duties.
N_R ÷ N_S = ((z_HK ÷ z_LK)(B ÷ D)(x_B,LK ÷ x_D,HK)²)^0.206; Q_c = (R + 1) D (H_liquid − H_vapor); Q_r from the overall enthalpy balance
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Component balances on every stage
The liquid flow of each component on each stage of the rigorous column.
l_{j−1} − (1 + S_j) l_j + S_{j+1} l_{j+1} = −f_j, S_j = K_j V_j ÷ L_j; solved by the Thomas algorithm
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Vapor and liquid flows from the energy balances
The vapor flow leaving each stage and the liquid flow below it, and the test that ends the iteration.
V_{j+1} = (V_j (H_j − h_j) − L_{j−1} (h_{j−1} − h_j) − (H_F,j − F_j h_j)) ÷ (H_{j+1} − h_j); stop when max |ΔT| < tol and max |ΔV| ÷ |V| < 1e-9
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Duties and closure of the rigorous column
The condenser and reboiler duties and how well the component and energy balances close.
Q_c = V₁ (H₁ − h₀); component closure = max |Σf − d − b| ÷ F; energy closure = |in − out| ÷ (|in| + 1)
Distillation and absorption columns process/column.js64-bit- CadCraft
- BimCraft
-
Tridiagonal solve
The solution of a tridiagonal system, used for the component balances.
forward: m = a_j ÷ b_{j−1}; b_j −= m c_{j−1}; r_j −= m r_{j−1}; back: x_j = (r_j − c_j x_{j+1}) ÷ b_j
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Simple models fitted in the outer loop
The local K-value and enthalpy models the inner loop uses in place of the property package.
ln K_b = A + B ÷ T; B = (ln K_b(T + 0.5) − ln K_b(T)) ÷ (1 ÷ (T + 0.5) − 1 ÷ T); h = h_a + h_b T with h_b = (h(T + 0.5) − h(T)) ÷ 0.5
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Stage temperatures in the inner loop
The temperature and vapor composition of each stage from the simple K model.
K_b = 1 ÷ Σ αᵢ xᵢ; T = B ÷ (ln K_b − A); yᵢ = αᵢ xᵢ, normalized
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Inside-out stopping tests
When the inner and outer loops of the inside-out column end.
inner: max |ΔT| < 1e-10 K and max |ΔV| ÷ |V| < 1e-11; outer: max |ΔT| < tol and max |ΔV| ÷ |V| < 1e-8
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Absorber flows by sum-rates
The vapor and liquid flow leaving each stage of an absorber or stripper.
V_j = Σᵢ l_ij K_ij V_j ÷ L_j; L_j = F(1..j) − V₁ + V_{j+1}
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Absorber stage temperatures
The temperature of every stage from the stage energy balances.
E_j = L_{j−1} h_{j−1} + V_{j+1} H_{j+1} + H_F,j + Q_j − L_j h_j − V_j H_j = 0; J ΔT = −E with heat capacities by a 0.5 K difference
Distillation and absorption columns process/column2.js64-bit- CadCraft
- BimCraft
-
Heat of reaction
The enthalpy change per mole of extent at a temperature, on the ideal-gas formation basis.
ΔH = Σ νᵢ H_ig,ᵢ(T)
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Equilibrium constant
ln K of a reaction at a temperature from formation data and heat capacities.
ΔG⁰(T) ÷ RT from ΔH⁰₀, ΔG⁰₀ and the integrated ΔC_p polynomial; ln K = −ΔG⁰ ÷ RT
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Conversion reactor
The outlet molar flows for reactions with a given conversion of a key component.
ξ = X × n_key ÷ |ν_key|; nᵢ ← nᵢ + νᵢ ξ, one reaction after another
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Equilibrium condition
How far a set of extents is from chemical equilibrium.
Σᵢ νᵢⱼ (ln(nᵢ ÷ F) + ln φᵢ + ln(P ÷ P₀)) − ln Kⱼ = 0
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Extent of a single equilibrium reaction
The extent of reaction between the limits where a species runs out.
lo = max over products of −n₀ᵢ ÷ νᵢ; hi = min over reactants of −n₀ᵢ ÷ νᵢ; root of the equilibrium condition on (lo + ε, hi − ε), ε = 1e-12 max(1, F)
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Adiabatic equilibrium temperature
The outlet temperature at which the equilibrium mixture has the feed's enthalpy.
F_out H(T) − F_in H_in = 0 on [250 K, 3500 K]
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Reaction rates
The rate of each reaction from Arrhenius constants and concentrations.
r = k₀ exp(−E_a ÷ RT) Π Cᵢ^order; gas: Cᵢ = (nᵢ ÷ F) P ÷ RT; liquid: Cᵢ = nᵢ ÷ volumetric flow
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Heat capacity of the reacting mixture
The heat capacity flow used in the adiabatic plug-flow balance.
gas: F Σ xᵢ C_p,ig,ᵢ; liquid: F (H(T + d) − H(T − d)) ÷ 2d, d = 0.001 T
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Plug-flow reactor
The molar flows and temperature along the reactor volume.
dnᵢ/dV = Σⱼ νᵢⱼ rⱼ; adiabatic: dT/dV = Σⱼ (−ΔH_j) rⱼ ÷ (F C_p)
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Stirred-tank reactor
The outlet flows and temperature of a continuous stirred tank.
(nᵢ − n₀ᵢ − V Σⱼ νᵢⱼ rⱼ) ÷ F = 0; adiabatic: (H_out − H_in) ÷ (F × 1e5) = 0
Reactors process/reactor.js64-bit- CadCraft
- BimCraft
-
Gas constant
R as used for rate constants, equilibrium constants and species energies in this file.
R = 8.31446261815324 J/(mol K)
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Activation-energy units
The factor that turns the file's activation-energy unit into J/mol.
cal/mol = 4.184; kcal/mol = 4184; K = R; eV = 96485.33212
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Species heat capacity, enthalpy and entropy
C_p ÷ R, H ÷ RT and S ÷ R of a species from its NASA 7 coefficients.
C_p⁄R = a₀ + a₁T + a₂T² + a₃T³ + a₄T⁴; H⁄RT = a₀ + a₁T⁄2 + a₂T²⁄3 + a₃T³⁄4 + a₄T⁴⁄5 + a₅⁄T; S⁄R = a₀ ln T + a₁T + a₂T²⁄2 + a₃T³⁄3 + a₄T⁴⁄4 + a₆
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Pre-exponential factor to SI
The rate constant's pre-exponential factor in m³, mol and s.
A_SI = A × (L³ ÷ Q)^(order − 1); E_a (J/mol) = E_a × unit factor
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Rate constant
The forward rate constant of a reaction at a temperature.
k = A T^b exp(−E_a ÷ RT)
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Equilibrium constant in concentration units
K_c of a reaction, used to get the reverse rate from the forward one.
K_c = exp(−Σ νᵢ gᵢ⁄RT) × (P₀ ÷ RT)^Δν
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Net production rates
The rate at which each species is made or used by all reactions together.
rate = (k_f Π C^ν − k_f ÷ K_c Π C^ν) × third-body sum; ωᵢ = Σ νᵢ × rate
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Closed-vessel reactor
Concentrations, and temperature when adiabatic, over time.
dCᵢ/dt = ωᵢ; adiabatic: dT/dt = −Σ uᵢ ωᵢ ÷ Σ Cᵢ c_v,ᵢ, u = RT (H⁄RT − 1), c_v = R (C_p⁄R − 1)
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Standard gravity
g, used for the liquid head across a valve.
g = 9.80665 m/s²
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Jacobian by differences
The matrix of derivatives of the plant's rates with respect to its states.
Jᵢⱼ = (fᵢ(y + h eⱼ) − fᵢ(y)) ÷ h, h = 1e-7 × max(|yⱼ|, 1e-3)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
One implicit Euler step
The state after one step of size h.
x − y − h f(t + h, x) = 0, (I − hJ) Δx = −residual, repeated
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Stiff integrator
The state at the end time, with every accepted step on the way.
y_new = 2 y_(two half steps) − y_(one full step); error = max |half − full| ÷ (atol + rtol max(|y|, |y_half|)); h ← h × clamp(0.9 ÷ √error, 0.2, 4)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Valve characteristic
The fraction of full flow at a valve opening.
linear: x; equal percentage: R^(x − 1), 0 at x = 0, R = 50 unless given; quick opening: √x
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
PID controller output
The output of a controller between 0 and 1.
e = ±(pv − sp) ÷ span; out = bias + K_c (e + I ÷ T_i + T_d (e − D_f) ÷ t_f), clamped to [0, 1]
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Flow through a valve from a tank
The volume flow through a valve from the liquid heads on its two sides.
Δp = ρ g (h_from − h_to + Δz); q = k × f(x) × √(max(Δp, 0) ÷ ρ)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Tank level and gas pressure rates
How fast a tank level and a gas vessel pressure change.
dh/dt = (q_in − q_out) ÷ A; dP/dt = R T ÷ V × (n_in − n_out)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Stirred reactor balances
The rate of change of each concentration and of the temperature in a constant-volume reactor.
r = k₀ exp(−E ÷ RT) Π C^n; dC/dt = q⁄V (C_in − C) + ν r; dT/dt = q⁄V (T_in − T) − ΔH r ÷ (ρ c_p) − UA (T − T_j) ÷ (ρ c_p V) + Q ÷ (ρ c_p V)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Plant simulation
The trends of every state and controller output from time zero to the end time.
integrate from each output time to the next (end ÷ 200 apart, or the next scripted event) with rtol 1e-6, atol 1e-9
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Process model from a step test
Gain, time constant and dead time of a first-order model fitted to a step response.
K = Δy ÷ Δu; τ = 1.5 (t₆₃ − t₂₈); θ = max(0, t₆₃ − τ)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Controller tuning rules
P, PI or PID settings from the fitted gain, time constant and dead time.
Ziegler–Nichols PI: K_c = 0.9 τ ÷ (K θ), T_i = 3.33 θ; IMC PI: K_c = (τ + θ⁄2) ÷ (K (λ + θ⁄2)), T_i = τ + θ⁄2; SIMC: K_c = τ ÷ (K (τ_c + θ)), T_i = min(τ, 4 (τ_c + θ))
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Tear stream from the iteration vector
A stream rebuilt from the component flows, temperature and pressure the recycle iteration is working on.
nᵢ = max(xᵢ, 0); F = Σ nᵢ; z = n ÷ F; state from a PT flash
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Recycle convergence test
Whether the tear streams have stopped changing from one pass to the next.
error = max |g(x)ᵢ − xᵢ| ÷ (|xᵢ| + scaleᵢ) < tol, scale = 1e-6 F_max (flows), 1 (T), 1000 (P)
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Wegstein acceleration
The next guess of each tear variable from its last two passes.
s = (g − g_prev) ÷ (x − x_prev); q = clamp(s ÷ (s − 1), −5, 0); x_next = q x + (1 − q) g
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Broyden acceleration
The next guess of all tear variables together, from an updated inverse Jacobian.
H ← H + (Δx − H ΔF) (Δxᵀ H) ÷ (Δxᵀ H ΔF); x_next = x − H F, F = x − g(x)
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Design specifications
The value of a unit parameter that makes a stream property hit its target.
residual = (value − target) ÷ (|target| + 1e-6); one bounded spec: scan 48 intervals, then a bracketed root to 1e-12; otherwise Newton to 1e-10
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Property a specification reads
The stream or unit value a design specification is compared with.
flow of a component = F × zᵢ
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
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.