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

  • Rail heights from cant

    Each rail's height above the profile for an applied cant and a pivot rule.

    center: ∓E ÷ 2; inner rail fixed: 0 and E; low rail fixed: max(0, ±E)

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Cant ramp gradient and rate

    The steepest cant gradient of each ramp in mm per meter and the rate of change of cant in mm per second.

    gradient = |E| ÷ length (m) × peak factor; rate = gradient × v; ramp on a straight: length = |E| ÷ gradient limit

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Cant, deficiency and excess checks

    Compares the applied cant, the cant deficiency and the cant excess with the limits.

    deficiency = E_eq − E; excess = E − E_eq(slowest train); flagged when over the limit + 1e-9

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Cant segments along the alignment

    The cant layout as constant and ramp segments, with each rail's height at both ends of each.

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Cant at a station

    The applied cant and each rail's height at any station.

    u = (sta − ramp start) ÷ ramp length; E = cant × g(u) on the way in, cant × (1 − g(u)) on the way out

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Track cross section

    The rails, sleeper, ballast and sub-ballast outline square to the alignment, and the ballast and sub-ballast areas.

    slope = (h_R − h_L) ÷ base; toe distance d = (z_shoulder − z₀ + |o|·fall) ÷ (1 ÷ ballast slope − fall)

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Area of a section polygon

    The area of the ballast or sub-ballast outline in the cross section.

    A = Σ (o_i·z_j − o_j·z_i) ÷ 2

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Track quantities

    Track and rail lengths, sleeper count and volume, and gross and net ballast and sub-ballast volumes.

    volume = Σ (A_i + A_(i+1)) ÷ 2 × Δsta; sleepers = ⌊length ÷ spacing + 1e-9⌋ + 1; net ballast = gross − sleepers × L × W × (depth − crib)

    Railway cant, cant ramps and track quantities rail.js
    • CivilCraft
    64-bit
  • Section prepared for the solver

    Splits a cross section at the banks, roughness changes and ineffective areas, and adds a point at each split.

    z(o) = z_p + (z_q − z_p) × (o − o_p) ÷ (o_q − o_p)

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Area, wetted perimeter, conveyance and velocity coefficient

    The hydraulic properties of a section at a water level.

    A = Σ (d_a + d_b) ÷ 2 × Δo; P = Σ hypot(Δo, Δz); K = (k ÷ n) × A × (A ÷ P)^(2/3); n_c = (Σ P_i·n_i^1.5 ÷ P)^(2/3); α = max(1, A²·Σ(K_i³ ÷ A_i²) ÷ K³)

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Root finding

    Solves the energy balance for the water level between two bracketing levels.

    stop when |bracket ÷ 2| ≤ 2ε|x| + tol ÷ 2, tol = 1e-6

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Minimum search

    Refines the level of least specific energy.

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Specific energy

    The energy level at a section for a water level and a flow.

    E = WS + α·Q² ÷ (2g·A²)

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Critical water surface

    The water level of least specific energy at a section.

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Normal depth boundary

    The water level at which the section carries the flow at a given energy slope.

    K(WS) = Q ÷ √S

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Velocity head and flow split

    The velocity head, energy level and the flow in the left overbank, channel and right overbank.

    h_v = α·Q² ÷ (2g·A²); Q_part = Q × K_part ÷ K

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Energy loss between two sections

    The friction loss and the contraction or expansion loss over a reach.

    L = (L_lob·Q_lob + L_ch·Q_ch + L_rob·Q_rob) ÷ Q; S_f = ((Q₁ + Q₂) ÷ (K₁ + K₂))²; h_e = L·S_f + C·|h_v2 − h_v1|

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Results at a section

    Depth, velocities, Froude numbers, energy slope and specific force for the results table.

    Fr = V ÷ √(g·A ÷ T); S_f = (Q ÷ K)²; specific force = Q² ÷ (g·A) + A·ȳ

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Subcritical run

    Steps upstream from the downstream boundary, solving each section's water level.

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Supercritical run

    Steps downstream from the upstream boundary, solving each section's water level below critical depth.

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Mixed regime

    Keeps, at each section, the subcritical or supercritical answer with the larger specific force, and marks hydraulic jumps.

    River water surface profiles by the standard step method river-solve.js
    • CivilCraft
    64-bit
  • Decimals in the results table

    The number of decimals each result is shown with in the table, the text report and the CSV.

    River water surface profiles by the standard step method river-report.js
    • CivilCraft
    64-bit
  • Table rows

    Formats each section's results for the table and the CSV.

    text = v.toFixed(d)

    River water surface profiles by the standard step method river-report.js
    • CivilCraft
    64-bit
  • Water surface at a plan point

    The water level at any point from the results at the sections either side.

    rs = centerline length − distance along; WS = WS_a + (WS_b − WS_a) × (rs − rs_a) ÷ (rs_b − rs_a)

    Flood extent on the ground surface river-extent.js
    • CivilCraft
    64-bit
  • Behind a levee

    Whether a point is kept dry by a levee the water does not top.

    offset and crest interpolated between the two sections; dry when beyond the levee and WS < crest

    Flood extent on the ground surface river-extent.js
    • CivilCraft
    64-bit
  • Depth at a point

    The depth of water at a plan point.

    depth = WS − ground

    Flood extent on the ground surface river-extent.js
    • CivilCraft
    64-bit
  • Waterline point on a triangle edge

    Where the depth is zero along an edge between a wet corner and a dry corner.

    u = d_a ÷ (d_a − d_b); point = a + u × (b − a)

    Flood extent on the ground surface river-extent.js
    • CivilCraft
    64-bit
  • Flooded area and greatest depth

    Adds up the wet part of each triangle and tracks the greatest depth at a corner.

    piece area = |Σ (x_i·y_j − x_j·y_i)| ÷ 2; area = Σ piece areas

    Flood extent on the ground surface river-extent.js
    • CivilCraft
    64-bit
  • Barrel flow area and top width

    The flow area, water surface width and full-barrel hydraulic radius of one culvert barrel at a given depth.

    circle: θ = 2·acos((r − y) ÷ r); A = r²(θ − sin θ) ÷ 2; T = 2√(y(D − y)); R = D ÷ 4. box: A = B·y; R = B·D ÷ (2(B + D))

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Critical depth in a barrel

    The depth at which the flow in one barrel is critical, capped at the rise.

    Q²·T(y) − g·A(y)³ = 0

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Headwater for one barrel's flow

    The inlet-control and outlet-control headwater depths for a flow in one barrel, and which one governs.

    HWw = (Q ÷ (Cw·B))^(2/3); HWo = Q² ÷ (Cd²·A²·2g) + D ÷ 2; φ = clamp((HWo ÷ D − 1) ÷ 0.5, 0, 1); HWin = (1 − φ)·HWw + φ·HWo; Kf = 2g·n²·L ÷ (k²·R^(4/3)); HWout = (1 + Ke + Kf)·V² ÷ 2g + ho − L·S₀

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Culvert headwater with road overtopping

    The headwater at which the flow through the barrels plus the flow over the road equals the total flow.

    n·Qbarrel(HW) + Cr·Lr·(HW − crest)^1.5 = Q

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Bridge opening section

    The downstream cross-section clipped to the abutments, with each pier as a strip that carries no flow.

    z(o) = z₀ + (o − o₀) ÷ (o₁ − o₀) × (z₁ − z₀)

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Water surface above a bridge

    The water surface in the opening and at the section above the bridge, in low flow, pressure flow or flow over the deck.

    WS + α·Q² ÷ (2g·A²) = E₀ + L·(Q ÷ ((K₁ + K₂) ÷ 2))² + c·|Δ velocity head|; pressure: Q = Cd·An·√(2g·head); deck: Q = Cw·L·(EGL − deck)^1.5

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Stepping a profile across a structure

    Takes the water surface below a structure, works out the level above it and uses that as the start of the next reach upstream.

    TW = max(0, WSd − invert down); WSu = invert up + HW

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Flows and water levels at a junction

    Adds the flows of the reaches that join and carries the water surface at the head of the downstream reach up to them.

    Q = Σ Q of the joining reaches; WS of each joining reach's downstream end = WS at the head of the reach below

    Culverts, bridges and junctions in a river model river-structures.js
    • CivilCraft
    64-bit
  • Area and conveyance table of a section

    Flow area and conveyance of one cross-section as functions of water level, read from a table.

    levels hᵢ = h₀ + (hi − h₀)·(i ÷ 200)²; between levels: linear interpolation; below h₀: A·f, K·f^1.6667 with f = depth ÷ (h₀ − bed)

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • Banded linear solve

    Solves the Newton step for all sections at once.

    L·U·x = b with row pivoting inside the band

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • Continuity and momentum residuals of one interval

    The two equations that must be zero between a pair of neighboring sections for one time step.

    continuity: Δ(Aᵢ + Aⱼ) ÷ (2Δt) + (θ·ΔQ_new + (1 − θ)·ΔQ_old) ÷ Δx; momentum: Δ(Qᵢ + Qⱼ) ÷ (2Δt) + Δ(Q|Q| ÷ A) ÷ Δx + g·Ā·Δh ÷ Δx + g·Ā·S̄f, Sf = Q|Q| ÷ K²

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • Newton iteration for one time step

    Finds the water levels and flows at the end of a time step.

    J·Δu = −F; J by forward differences with steps 1e-6·Href and 1e-6·Qref; stop when max(|Δh| ÷ Href, |ΔQ| ÷ Qref) < 1e-8

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • Time stepping, peaks and Froude check

    Advances the run step by step, records the peak level and flow at each section and flags supercritical flow.

    V_in += Δt·(θ·Q_new + (1 − θ)·Q_old); T ≈ (A(h + 0.001·Href) − A(h)) ÷ (0.001·Href); flag when |Q| ÷ A > √(g·A ÷ T)

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • Volume balance error

    The share of water not accounted for between inflow, outflow and the change of storage in the reach.

    storage = Σ ½(Aᵢ + Aᵢ₊₁)·Δxᵢ; error = (V_in − V_out − (S₁ − S₀)) ÷ max(V_in, V_out, |S₁ − S₀|, 1e-12)

    Unsteady flow routing down a river river-unsteady.js
    • CivilCraft
    64-bit
  • US gallon in cubic feet

    The factor that turns gallons into cubic feet in feet projects.

    1 gal = 0.133680556 ft³

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Peaking factor

    The ratio of peak to average sanitary flow for a population.

    Harmon: 1 + 14 ÷ (4 + √P); Babbitt: 5 ÷ P^0.2; P in thousands; held between pfMin and pfMax

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Average flow from people

    People times per-person daily flow, in project flow units.

    m: P × L/day ÷ 1000 ÷ 86400; ft: P × gal/day × 0.133680556 ÷ 86400

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Infiltration flow

    Tributary area times the infiltration allowance, in project flow units.

    m: ha × L/s per ha ÷ 1000; ft: ac × gal/day per ac × 0.133680556 ÷ 86400

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Design flow, slope and velocity per pipe

    For each pipe in flow order: the people and area above it, the peak flow, the slope, the full capacity, the normal depth and the velocity.

    S = (inv up − inv down) ÷ length; Q = q_dom × pf + q_inf; ratio = Q ÷ Q_full; V = Q ÷ A(yn)

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Pipe size for the design flow

    The smallest listed pipe size whose allowed share of full capacity carries the design flow.

    first size with Q_full(size) × maxFull ≥ Q

    Sanitary sewer design flows and pipe sizes sewer.js
    • CivilCraft
    64-bit
  • Catchment runoff hydrograph

    The runoff from one catchment at each time step for a constant storm.

    q(t) = k·C·A·(depth(t) − depth(t − w)) ÷ w; depth(τ) = i·clamp(τ, 0, duration); k = 1 ÷ 360 (m), 1 (ft)

    Storm hydrographs routed through the pipe network storm-route.js
    • CivilCraft
    64-bit
  • Muskingum coefficients

    The three weights of the routing equation for a reach.

    d = K(1 − X) + Δt ÷ 2; c₀ = (−KX + Δt ÷ 2) ÷ d; c₁ = (KX + Δt ÷ 2) ÷ d; c₂ = (K(1 − X) − Δt ÷ 2) ÷ d

    Storm hydrographs routed through the pipe network storm-route.js
    • CivilCraft
    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.