// CLARA / CUBIE PHYSICS — integer kernels with explicit fixed-point scaling. // x and v: milli-units; dt: microseconds. Host divides the result by 1e6. fn advance(x: Int, v: Int, dt: Int): Int { return x * 1000000 + v * dt; } // Damping, restitution and coupling coefficients in parts per million. fn scale(v: Int, coefficient: Int): Int { return v * coefficient; } fn spring(displacement: Int, stiffness: Int, velocity: Int, damping: Int): Int { return displacement * stiffness - velocity * damping; } fn heatFlux(a: Int, b: Int, conductance: Int): Int { return (b - a) * conductance; } fn impactHeat(v: Int, loss: Int): Int { return v * v * loss; } fn elasticContact(relative: Int, restitution: Int): Int { return relative * (1000000 + restitution); }