|
brusselator.xmds
Script source: brusselator.xmds.gz
<?xml version="1.0"?>
<simulation>
<!-- $Id: brusselator_body.part 995 2004-08-03 05:32:05Z cochrane $ -->
<!-- Copyright (C) 2000-2004 -->
<!-- -->
<!-- Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane -->
<!-- -->
<!-- This file is part of xmds. -->
<!-- -->
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License -->
<!-- as published by the Free Software Foundation; either version 2 -->
<!-- of the License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
<!-- MA 02111-1307, USA. -->
<name> brusselator </name> <!-- the name of the simulation -->
<author> Paul Cochrane </author> <!-- the author of the simulation -->
<description>
<!-- a description of what the simulation is supposed to do -->
Example simulation of the Brusslator model oscillating chemical
kinetics equations.
Calculates concentrations of components participating
in the autocatalytic Brusselator model. The reaction scheme is
A ----> X (1)
B + X ----> R + Y (2)
Y + 2 X ----> 3 X (3)
X ----> S. (4)
Rate equations for the intermediates X and Y are
d[X]/dt = k1[A] - k2 [B] [X] + k3 [X]^2 [Y] - k4 [X]
d[Y]/dt = k2 [B] [X] - k3 [X]^2 [Y],
which are transformed in the program to
d[X]/d(tau) = (k1[A] - k2 [B] [X] + k3 [X]^2 [Y] - k4 [X])/k4
d[Y]/d(tau) = (k2 [B] [X] - k3[X]^2 [Y])/k4,
with tau = k4 t a unitless time-related variable.
Adapted for xmds from "Mathematica computer programs for physical
chemistry", William H. Cropper, Springer Verlag (1998)
Equations are:
d[X]_d(tau) = (k1[A] - k2[B][X] + k3[X]^2 [Y] - k4[X])/k4
d[Y]_d(tau) = (k2[B][X] - k3[X]^2 [Y])/k4
</description>
<!-- Global system parameters and functionality -->
<prop_dim> tau </prop_dim> <!-- name of main propagation dim -->
<error_check> yes </error_check> <!-- defaults to yes -->
<use_wisdom> yes </use_wisdom> <!-- defaults to no -->
<benchmark> yes </benchmark> <!-- defaults to no -->
<use_prefs> yes </use_prefs> <!-- defaults to yes -->
<!-- Global variables for the simulation -->
<globals>
<![CDATA[
// rate constants
// Units are s^-1 for first-order reactions,
// L mol^-1 s^-1 for second-order reactions, and L^2
// mol^-2 s^-1 for third-order reactions.
const double k1 = 0.025;
const double k2 = 1.0;
const double k3 = 1.0;
const double k4 = 0.01;
// the constant concentrations of the components A and B
// in mol L^-1
const double a = 0.02;
const double b = 0.02;
// the initial concentrations of the components X and Y
const double CX0 = 0.5;
const double CY0 = 0.0;
]]>
</globals>
<!-- Field to be integrated over -->
<field>
<name> main </name>
<samples> 1 </samples> <!-- sample 1st point of dim? -->
<vector>
<name> main </name>
<type> double </type> <!-- data type of vector -->
<components> CX CY </components> <!-- names of components -->
<![CDATA[
CX = CX0;
CY = CY0;
]]>
</vector>
</field>
<!-- The sequence of integrations to perform -->
<sequence>
<integrate>
<algorithm> RK4IP </algorithm> <!-- RK4EX, RK4IP, SIEX, SIIP -->
<interval> 250 </interval> <!-- how far in main dim? -->
<lattice> 5000 </lattice> <!-- no. points in main dim -->
<samples> 500 </samples> <!-- no. pts in output moment group -->
<![CDATA[
dCX_dtau = (k1*a - k2*b*CX + k3*CX*CX*CY - k4*CX)/k4;
dCY_dtau = (k2*b*CX - k3*CX*CX*CY)/k4;
]]>
</integrate>
</sequence>
<!-- The output to generate -->
<output format="ascii">
<group>
<sampling>
<lattice> 500 </lattice> <!-- no. points to sample -->
<moments> X Y </moments> <!-- names of moments -->
<![CDATA[
X = CX;
Y = CY;
]]>
</sampling>
</group>
</output>
</simulation>
Generated by GNU enscript 1.6.3.
|