I am trying to solve a chemical equilibrium ODE with NDSolve where one function is the argument to another.
I.E. My equations look like:
A'[t] == B[t] + f[A[t]] C[t],
B'[t] == ...,
C'[t] == ...
This is the actual code:
sol = NDSolve[{
T'[t] == -((uCO[T[t]] nCO'[t] + uO[T[t]] nO'[t] + uO2[T[t]] nO2'[t] + uCO2[T[t]] nCO2'[t])/(CvCO[T[t]] nCO[t] + CvO[T[t]] nO[t] + CvO2[T[t]] nO2[t] + CvCO2[T[t]] nCO2[t])),
nCO'[t] == -nCO[t] nO[t] m[t] r1[T[t]] - nCO[t] nO2[t] r2[T[t]] + nCO2[t] m[t] r1b[T[t]] + nCO2[t] nO[t] r2b[T[t]],
nO'[t] == -nCO[t] nO[t] m[t] r1[T[t]] + nCO[t] nO2[t] r2[T[t]] - 2 nO[t] nO[t] m[t] r3[T[t]] + nCO2[t] m[t] r1b[T[t]] - nCO2[t] nO[t] r2b[T[t]] + 2 nO2[t] m[t] r3b[T[t]],
nO2'[t] == -nCO[t] nO2[t] r2[T[t]] + nO[t] nO[t] m[t] r3[T[t]] + nCO2[t] nO[t] r2b[T[t]] - nO2[t] m[t] r3b[T[t]],
nCO2'[t] == nCO[t] nO[t] m[t] r1[T[t]] + nCO[t] nO2[t] r2[T[t]] - nCO2[t] m[t] r1b[T[t]] - nCO2[t] nO[t] r2b[T[t]],
m'[t] == nCO'[t] + nO'[t] + nO2'[t] + nCO2'[t],
T[0] == 1500,
nCO[0] == nCOinit,
nO[0] == 0.,
nO2[0] == nO2init,
nCO2[0] == 0.,
m[0] == nCOinit + nO2init
},
{T, nCO, nO, nO2, nCO2, m},
{t, 0.00, 1.00},
MaxSteps -> 300000
]
The problem is that my functions:
CvCO2, CvCO, CvO, CvO2, uCO2, uCO, uO2, uO, r1, r2, r3, r1b, r2b, r3b
can only take a numeric value argument.
Mma spits our many errors due to that...
Any idea how to solve this problem?