Return to Web Labs at ReactorLab.net

Batch Chemical Reactor Simulation

(by Claude Sonnet 4, see prompt below, 6/11/2025)

A → B     Rate = k[A]     k = 0.115 s⁻¹
Time: 0.0 s

Reactant A

10.0 mol/L

Product B

0.0 mol/L

First-order reaction kinetics

90% conversion at t = 20s

Concentration vs Time

Prompt: build a web page using vanilla javascrit that is dynamic simulation of a batch chemical reactor in which reactant A gets converted to reactant B at a rate that is proportional to the concentration of A in the reactor, display a visual that changes color with the concentration of A (color green) and concentration of B (color blue) and plots the concentration of A (starting at 10) and B (starting at zero) vs. time elapsed from user pressing a start button over time of 20 seconds at a rate where the conversion of A to B at 20 seconds is 90%
Revisions: 1) this is good except that no lines for green A nor blue B appear on the plot; 2) there was no change in the simulation artifact - no lines on plot appear for A nor B; 3) still no lines, in the log at the bottom, I am getting messages like this: Time: 0.10s, A: 9.88, B: 0.12, Updating chart with 1 points, No data points to plot >> this time it worked to produce above simulation.
Comment: I was surprised that Claude Sonnet 4 required 3 revisions to get this done!