POLYMATH Report          DEQ 
 Ordinary Differential Equations       2016-May-31 

Calculated values of DEQ variables
  Variable Initial value Final value Minimal value Maximal value
1 CA 0.271 0.035086 0.035086 0.271
2 CC 0 0.04625 0 0.051066
3 CPA 40 40 40 40
4 delH -4.0E+04 -4.0E+04 -4.0E+04 -4.0E+04
5 FA0 5 5 5 5
6 k 0.5 451.194 0.5 478.974
7 Kc 2.5E+04 37.3464 35.2727 2.5E+04
8 rA -0.036721 0.003342 -0.974124 0.003342
9 T 450 1149.6 450 1165.5
10 Ta 500 500 500 500
11 W 0 20 0 20
12 x 0 0.725004 0 0.72718
13 y 1 0.766736 0.766736 1

Differential equations
1 d(T)/d(W) = (.8*(Ta-T)+rA*delH)/(CPA*FA0)
2 d(x)/d(W) = -rA/FA0
3 d(y)/d(W) = -0.015*(1-.5*x)*(T/450)/(2*y)

Explicit equations
1 FA0 = 5
2 Ta = 500
3 delH = -40000
4 CPA = 40
5 k = .5*exp(5032*(1/450-1/T))
6 CA = .271*(1-x)*(450/T)/(1-.5*x)*y
7 CC = .271*.5*x*(450/T)/(1-.5*x)*y
8 Kc = 25000*exp(delH/8.314*(1/450-1/T))
9 rA = -k*(CA^2-CC/Kc)

Problem source text
# S. 22 - ODE System
# Reversible Reaction in a PBR
# Verified Final Values: T = 1149.6, x = 0.725004, y = 0.766736
# Ref.: Comput. Appl. Eng. Educ. 6: 176-178, 1998
d(T)/d(W)=(.8*(Ta-T)+rA*delH)/(CPA*FA0)
d(x)/d(W)=-rA/FA0
d(y)/d(W)=-0.015*(1-.5*x)*(T/450)/(2*y)
FA0=5
Ta=500
delH=-40000
CPA=40
k=.5*exp(5032*(1/450-1/T))
CA=.271*(1-x)*(450/T)/(1-.5*x)*y
CC=.271*.5*x*(450/T)/(1-.5*x)*y
Kc=25000*exp(delH/8.314*(1/450-1/T))
rA=-k*(CA^2-CC/Kc)
W(0)=0
T(0)=450
x(0)=0
y(0)=1
W(f)=20

Matlab formatted problem
Create m file called PolyOde.m and paste the following text into it.
% S. 22 - ODE System
% Reversible Reaction in a PBR
% Verified Final Values: T = 1149.6, x = 0.725004, y = 0.766736
% Ref.: Comput. Appl. Eng. Educ. 6: 176-178, 1998
function PolyOde
   tspan = [0 20]; % Range for the independent variable
   y0 = [450; 0; 1]; % Initial values for the dependent variables
   [W,y]=ode45(@ODEfun,tspan, y0);
   plot (W,y);
   xlabel('W');
   legend('T','x','y');
   fprintf('T = %16.6f \n',y(length(y),1));
   fprintf('x = %16.6f \n',y(length(y),2));
   fprintf('y = %16.6f \n',y(length(y),3));
end

function dYfuncvecdW = ODEfun(W,Yfuncvec)
   T = Yfuncvec(1);
   x = Yfuncvec(2);
   y = Yfuncvec(3);
   FA0 = 5;
   Ta = 500;
   delH = -40000;
   CPA = 40;
   k = 0.5 * exp(5032 * (1 / 450 - (1 / T)));
   CA = 0.271 * (1 - x) * 450 / T / (1 - (0.5 * x)) * y;
   CC = 0.271 * 0.5 * x * 450 / T / (1 - (0.5 * x)) * y;
   Kc = 25000 * exp(delH / 8.314 * (1 / 450 - (1 / T)));
   rA = 0 - (k * (CA ^ 2 - (CC / Kc)));
   dTdW = (0.8 * (Ta - T) + rA * delH) / (CPA * FA0);
   dxdW = 0 - (rA / FA0);
   dydW = -0.015 * (1 - (0.5 * x)) * T / 450 / (2 * y);
   dYfuncvecdW = [dTdW; dxdW; dydW];
end

General Settings
Total number of equations 12
Number of differential equations 3
Number of explicit equations 9
Reporting digits 8
Elapsed time 0.19 sec
Solution method RKF_45
Step size guess. h 1E-06
Truncation error tolerance. eps 1E-06
Calculated Intermediate data points 50

Calculated data points
    W T x y k CA CC Kc rA
1 0 450 0 1 0.5 0.271 0 2.5E+04 -0.036721
2 0.977996 457.861 0.007681 0.992589 0.586362 0.26464 0.000846 2.15E+04 -0.041065
3 1.298 460.667 0.010434 0.990129 0.626273 0.262053 0.001195 2.02E+04 -0.043007
4 1.618 463.603 0.013321 0.987652 0.67036 0.259406 0.001557 1.89E+04 -0.04511
5 2.258 469.914 0.019548 0.98264 0.773593 0.253912 0.002318 1.65E+04 -0.049875
6 2.578 473.317 0.022914 0.980104 0.834307 0.251056 0.00272 1.53E+04 -0.052585
7 2.898 476.905 0.02647 0.977547 0.902398 0.248119 0.003137 1.42E+04 -0.055554
8 3.218 480.697 0.030235 0.974969 0.979103 0.245095 0.003572 1.31E+04 -0.058816
9 3.858 488.982 0.038481 0.969742 1.16473 0.238757 0.004499 1.11E+04 -0.066394
10 4.178 493.527 0.043015 0.967092 1.27778 0.235426 0.004995 1.02E+04 -0.070821
11 4.498 498.383 0.047866 0.964415 1.40794 0.231974 0.005516 9290.92 -0.075763
12 4.818 503.587 0.053071 0.961711 1.55878 0.228389 0.006063 8429.39 -0.081308
13 5.458 515.231 0.064738 0.956213 1.94207 0.220768 0.007252 6831.36 -0.094651
14 5.778 521.786 0.071317 0.953416 2.18798 0.216699 0.0079 6095.38 -0.102741
15 6.098 528.927 0.078491 0.950583 2.48264 0.212431 0.00859 5401.8 -0.112031
16 6.418 536.748 0.086354 0.947712 2.83944 0.207943 0.009327 4750.94 -0.122773
17 7.058 554.904 0.104626 0.941847 3.81896 0.19819 0.010972 3578.62 -0.149994
18 7.378 565.552 0.115351 0.938844 4.50179 0.192856 0.011897 3057.81 -0.167419
19 7.698 577.522 0.127413 0.93579 5.37522 0.187161 0.012905 2580.95 -0.188263
20 8.018 591.091 0.141089 0.932679 6.51247 0.181053 0.014009 2148.26 -0.213438
21 8.658 624.538 0.17481 0.926261 10.073 0.167345 0.016584 1415.75 -0.281972
22 8.978 645.455 0.195899 0.922938 12.9234 0.159593 0.018102 1115.63 -0.328949
23 9.28388 668.929 0.219565 0.919681 16.8831 0.151319 0.019776 864.047 -0.386194
24 9.83291 722.272 0.273335 0.913601 29.3686 0.134231 0.023431 508.931 -0.527812
25 10.0827 752.55 0.30385 0.910721 38.8593 0.125569 0.025399 389.39 -0.610179
26 10.5535 821.869 0.373707 0.905078 68.3198 0.10794 0.029692 227.032 -0.787068
27 11.0244 906.41 0.458933 0.899131 120.941 0.089625 0.034657 131.506 -0.939601
28 11.2959 958.677 0.511669 0.89557 162.848 0.079761 0.037594 98.9481 -0.974124
29 11.6159 1017.78 0.5714 0.891268 221.582 0.069193 0.04098 73.7097 -0.937655
30 12.1068 1090.17 0.644876 0.884508 333.996 0.054248 0.04621 49.7896 -0.672933
31 12.4345 1122.01 0.677519 0.879922 394.828 0.047693 0.048614 42.4288 -0.445714
32 12.8802 1147.26 0.703904 0.873629 441.946 0.042957 0.050268 38.0933 -0.232331
33 13.344 1159.4 0.717252 0.867025 465.715 0.040487 0.050942 36.2323 -0.108608
34 13.6827 1163.32 0.72207 0.86217 473.77 0.039504 0.051066 35.6431 -0.060579
35 14.058 1165.13 0.724878 0.856762 477.772 0.038831 0.051012 35.3576 -0.031095
36 14.483 1165.5 0.726378 0.850601 478.974 0.038344 0.050823 35.2727 -0.014088
37 14.9751 1164.86 0.72705 0.843418 478.231 0.037955 0.050521 35.3251 -0.004979
38 15.2536 1164.25 0.72718 0.839328 477.307 0.037776 0.05033 35.3906 -0.002322
39 15.8792 1162.58 0.727168 0.830081 474.589 0.037417 0.04987 35.5843 0.000672
40 16.1992 1161.64 0.727078 0.825315 472.972 0.03724 0.049617 35.7006 0.001408
41 16.5192 1160.68 0.726959 0.820525 471.295 0.037067 0.04936 35.8221 0.001866
42 16.8392 1159.69 0.72682 0.815711 469.581 0.036895 0.049099 35.9471 0.002165
43 17.4792 1157.69 0.726507 0.806006 466.095 0.036553 0.04857 36.2041 0.002526
44 17.7992 1156.68 0.726337 0.801116 464.335 0.036382 0.048302 36.3353 0.00265
45 18.1192 1155.67 0.726161 0.796198 462.568 0.036209 0.048031 36.468 0.002756
46 18.4392 1154.65 0.725978 0.791254 460.796 0.036036 0.047758 36.6021 0.002854
47 19.0792 1152.59 0.725595 0.781284 457.238 0.035686 0.047205 36.8743 0.003036
48 19.3992 1151.55 0.725395 0.776256 455.453 0.03551 0.046925 37.0125 0.003126
49 19.7192 1150.52 0.725189 0.771199 453.664 0.035332 0.046643 37.152 0.003216
50 20 1149.6 0.725004 0.766736 451.194 0.035086 0.04625 37.3464 0.003342