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