%ChE 642 Catalytic Reactor Analysis and Design
%Project 1: Kinetic study of the catalytic carbon dioxide reforming of
%methane to synthesis gas over Ni-K/CeO2-Al2O3 catalyst
%Dennis Moskov and Amin Delparish

clc;
clear all;

%Initial temperature for the system, (K)
T_i=873; 

% Catalyst weight, (kg)
w_i=0;
w_f=5E-3;
 
% Initial molar flow rates, (mol/s)
F0_CH4=(3.33E-4)/(0.0821*T_i);
F0_CO2=(3.33E-4)/(0.0821*T_i);
F0_N2=(1E-3)/(0.0821*T_i);
 
% ode45 solver (w and y represents catalyst weight and flow rates, temperature and CH4 conversion)
[w,y] = ode15s(@pr1fct, [w_i w_f], [F0_CH4 F0_CO2 0 0 0 F0_N2 T_i 0]);

% Graph of flow rates and temperature with respect to catalyst weight
plot(w,y(:,1),w,y(:,2),w,y(:,3),w,y(:,4),w,y(:,5),'linewidth',2)
legend('CH4','CO2','H2','H2O','CO')
xlabel('Catalyst Weight (Kg)')
ylabel('Flow Rate (mol/s)')
figure
plot(w,y(:,7),w,y(:,8), 'linewidth',2) 
xlabel('Catalyst Weight (Kg)','FontSize',14) 
ylabel(hAx(1),'Temperature (K)','FontSize',14) 
ylabel(hAx(2),'CH4 Conversion (-)','FontSize',14) 
