ODE45 solving rate too low
Show older comments
I am trying to model a reactor and solving a series of differential equations using ODE45.
The rate of reaction is very low when solved on MATLAB but when I take the equation conditions and put it into excel I am getting a much higher rate, which is the same answer as my hand calculated values.
I think there is an error with the equation itself and how I've written it, but I've looked at it all day and can't seem to locate where it is wrong. Below is the equation from literature and the code snippet shows my implementation.

T = var(1);
P = var(2);
FA = var(3);
FB = var(4);
FC = var(5);
FD = var(6);
F_tot = FA + FB + FC + FD + F_E0 + F_F0 + F_G0; %mol/hr
molA = FA/F_tot;
molB = FB/F_tot;
molC = FC/F_tot;
molD = FD/F_tot;
K = exp((4577.8/T)-4.33);
P_atm = P*0.00986923; %atm
FPress = P_atm^(0.5-(P_atm/250));
r_A = -FPress * (1.69*10^9) * exp(-88000/(R * T)) * (molA^0.9) * (molB ^0.31) * (molC^-0.156) * (molD ^ -0.05) * (1-((molC * molD)/(molA * molB * K)));
The differential equations look like this:
diffeqs = [
(H_rxn*r_A)/(F_A0 * (CO_eng + H20_eng + CO2_eng + H2_eng + Ar_eng +N2_eng + CH4_eng))
- ((alpha/2*p)*(T/T_0))
r_A
(H20/CO)*r_A
-(H2/CO)*r_A
-(CO2/CO)*r_A
Answers (1)
Torsten
on 1 Apr 2022
0 votes
I can't see something wrong in the equation itself, but of course I don't know if the inputs have the correct units etc.
But for reaction engineering simulations, you should use ode15s instead of ode45 for better performance.
1 Comment
BeigeSponge
on 1 Apr 2022
Edited: BeigeSponge
on 1 Apr 2022
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
