chem.ode 810 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # This example does a chemical kinetics simulation, for the reaction:
  2. #
  3. # A + 2B <==> C --> D
  4. #
  5. # The output displays the concentration of the species `C'
  6. # as a function of time.
  7. #
  8. # You may run this example by doing:
  9. #
  10. # ode < chem.ode | graph -T X -C
  11. #
  12. # or alternatively, to get a real-time plot,
  13. #
  14. # ode < chem.ode | graph -T X -C -x 0 10 -y 0 0.03
  15. #
  16. # To improve the shape of the plotted curve, you may
  17. # wish to spline it, by doing e.g.
  18. #
  19. # ode < chem.ode | spline | graph -T X -C
  20. #
  21. # Alternatively, you could remove the `every 10' clause below.
  22. # The three rate constants are:
  23. # kf : A + 2B --> C
  24. # kb : C --> A + 2B
  25. # kd : C --> D
  26. a' = kb*c - kf*a*b^2
  27. b' = kb*c - kf*a*b^2
  28. c' = kf*a*b^2 - kb*c - kd*c
  29. d' = kd*c
  30. c = 0
  31. d = 0
  32. a = 0.1
  33. b = 1
  34. kf = 1
  35. kb = 1
  36. kd = 1
  37. print t,c every 10
  38. step 0,10