0% found this document useful (0 votes)
3 views

SOLOSOLOSOLO

The document is a MATLAB script for simulating the concentration changes of two reactants, Ethyl acetate and Sodium hydroxide, in a Continuous Stirred Tank Reactor (CSTR). It calculates the rate constant using the Arrhenius equation based on user inputs for flow rate, concentrations, and temperature. The script also includes a steady-state solution and plots the concentration of both reactants over time.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SOLOSOLOSOLO

The document is a MATLAB script for simulating the concentration changes of two reactants, Ethyl acetate and Sodium hydroxide, in a Continuous Stirred Tank Reactor (CSTR). It calculates the rate constant using the Arrhenius equation based on user inputs for flow rate, concentrations, and temperature. The script also includes a steady-state solution and plots the concentration of both reactants over time.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

clear;

clc;

% Define global variables and constants


global Fi V CAi CBi k

% Set initial data


Fi = input('Enter Inlet flow rate, Fi (m^3/min): '); % Inlet flow rate (m^3/min)
V = 1; % Volume of the reactor (m^3)
CAi = input('Enter inlet concentration of A (Ethyl acetate), CAi (kg/m^3): '); %
Inlet concentration of A (kg/m^3)
CBi = input('Enter inlet concentration of B (Sodium hydroxide), CBi (kg/m^3): '); %
Inlet concentration of B (kg/m^3)
k0 = 2.314e10; % Pre-exponential factor (min^-1)
T0 = input('Enter Temperature , T (C): '); % Temperature (C)
E = 43.094e3; % Activation energy (J/mol)
R = 8.314; % Universal gas constant (J/(mol*K))

% C to K
T = T0 +273.15;

% Calculate rate constant k using Arrhenius equation


k = k0 * exp(-E / (R * T));

% Initial concentrations (in molar terms)


CA0 = [CAi; CBi];

% Steady-state solution using fsolve


[CAss, fv, ex] = fsolve(@fCSTR_ss, CA0);

% Time interval for unsteady-state simulation (0 to 100 minutes)


time = [0, 0.00050];
[t, CA] = ode45(@fCSTR_uss, time, CAss);

% Plotting the results


figure;
plot(t, CA(:,1), '-', 'LineWidth', 2); hold on;
plot(t, CA(:,2), '-', 'LineWidth', 2);
xlabel('Time (min)');
ylabel('Concentration (kg/m^3)');
legend('Concentration of A', 'Concentration of B');
title('Concentration of A and B over Time in CSTR');
grid on;

You might also like