Professional Documents
Culture Documents
Formulation
Explicit Runge-Kutta methods are popular as each stage
can be calculated with one function evaluation. In
contrast, implicit Runge-Kutta methods usually involves
solving a non-linear system of equations in order to
evaluate the stages. As a result, explicit schemes are
much less expensive to implement than implicit schemes.
However, there are cases in which implicit schemes are
necessary and that is in the case of stiff sets of equations.
The higher-order Runge-Kutta methods can be derived by
in manner similar to the midpoint formula. An s-stage
method is compared to a Taylor method and the terms are
matched up to the desired order.
Methods of order M > 4 require M + 1 or M + 2 function
evaluations or stages, in the case of explicit Runge-Kutta
methods. As a result, fourth-order Runge-Kutta methods
have achieved great popularity over the years as they
require only four function evaluations per step. In
particular, there is the classic fourth-order Runge-Kutta
formula:
k1 =hf(yn,tn)
k2 = hf (yn + k1 , tn + h )
k3 = hf (yn + k2 , tn + h ) 22
k4 =hf(yn +k3,tn +h)
yn+1 =yn+k1 +k2 +k3 +k4
Advantages of CSTR
Continuous operation
Good temperature control
Easily adapts to two phase runs
Good control
Simplicity of construction
Low operating (labor) cost
Easy to clean
Disadvantages of CSTR
Lowest conversion per unit volume
By-passing and channeling possible with poor
agitation
CODE :
clear
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% global Parameter
global
global
global
global
cA0 cP0 T0
VR Aw Uw rho cp TC
dh E stoss T_B
cA_zu cP_zu T_zu Vpunkt_zu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Temperature
TC = 55 % [C] Cooler temp
T0 = TC % [C] Initial temp of reactor
T_zu = 10 % [C] Inlet temp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Material constants
VR = 4
% [m3]
Volume of reactor
Aw = 15;
% [m2]
Heat transfer surface area
Uw = 1000;
% [W/m2/K] Heat transfer coefficient
rho = 1000;
% [kg/m3] Density
cp = 4000;
% [J/kgK] Heat capacity
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Reaction parameter
dh = -7.0e5;
% [J/mol] Enthalpy of reaction
E
= 21000;
% [K] Activation energy
T_B = 350;
% [K] Base temp
stoss = 0.15;
% [1/s] Shock factor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Inflow values
cA_zu = 300;
% [mol/m3] Inlet conc of A
cP_zu = 0;
% [mol/m3] Inlet conc of Product
Vpunkt_zu= 2.22222e-3; % [m3/s] Feed flow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Strating values
cA0 = 300 % [mol/m3]
cP0 = 0
% [mol/m3]
y0(1) = cA0;
y0(2) = cP0;
y0(3) = T0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% ODE45 call
[t,y] = ode23s('cstr_func',[0 36000],y0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% Graph output
time = t/3600.0; % seconds to hours
subplot(2,2,1);
plot(time,y(:,1),'-k','LineWidth',2,...
'MarkerFaceColor','k');
grid on;
axis([0 10 0 400]);
xlabel('t [h]');
ylabel('c_A [mol/m^3]');
subplot(2,2,3);
plot(time,y(:,2),'-k','LineWidth',2,...
'MarkerFaceColor','k');
grid on;
axis([0 10 0 400]);
xlabel('t [h]');
ylabel('c_P [mol/m^3]');
subplot(2,2,2);
plot(y(:,3),y(:,1),'-k','LineWidth',2,...
'MarkerFaceColor','k');
grid on;
axis([0 120 0 400]);
xlabel('T [^oC]');
ylabel('c_A [mol/m^3]');
subplot(2,2,4);
plot(time,y(:,3),'-k','LineWidth',2,...
'MarkerFaceColor','k');
grid on;
axis([0 10 0 120]);
xlabel('t [h]');
ylabel('T [^oC]');
FUNCTION :
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
function f = semi_func(t,y)
% Global parameters
global cA0 cP0 T0
global VR Aw Uw rho cp TC
global dh E stoss T_B
global cA_zu cP_zu T_zu Vpunkt_zu
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Variable names
cA
= y(1);
cP
= y(2);
= y(3);
time = t;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Reaction rate formula
rate = stoss * cA * exp(E*(1/T_B-1/(273+T)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% Equations of conc and temp change
%-------------------------------------------------% dcA/dt =
f(1) = Vpunkt_zu/VR * (cA_zu - cA) - rate;
%-------------------------------------------------% dcP/dt =
f = f';