% Function used to analyze the two parallel reactor networks in Example
% 29.3 of "A First Course on Kinetics and Reaction Engineering."
function Example_29_3
    VR1 = 60.0; % L
    VR2 = 40.0; % L
    VFRa = 0.55; % L/min
    CAa = 1.0; % mol/L
    
    % Case 1 where the feed is split equally
    display('Case 1: Equally split feed')
    VFRin = VFRa/2.;
    % Calculate the outlet molar flows and temperature for the reactors
    [nAoutR1,nYoutR1,nZoutR1,ToutR1] = Example_29_3_pfr(VR1,VFRin);
    [nAoutR2,nYoutR2,nZoutR2,ToutR2] = Example_29_3_pfr(VR2,VFRin);
    conversion = (VFRa*CAa - nAoutR1 - nAoutR2)/VFRa/CAa
    
    % Case 2 where the space times are equal
    display('Case 2: Equal space times')
    VFRb = VFRa*VR1/(VR1 + VR2);
    VFRd = VFRa - VFRb;
    % Calculate the outlet molar flows and temperature for the reactors
    [nAoutR1,nYoutR1,nZoutR1,ToutR1] = Example_29_3_pfr(VR1,VFRb);
    [nAoutR2,nYoutR2,nZoutR2,ToutR2] = Example_29_3_pfr(VR2,VFRd);
    conversion = (VFRa*CAa - nAoutR1 - nAoutR2)/VFRa/CAa

end % of Example_29_3.m

