You are on page 1of 40

Batch reactor ( Simple Reactions)

K1 A + B C K2 C + B D

dC A dt dC B dt dC C dt dC D dt

= k 1C A C B = k 1C A C B k 2 C c C B = k 1C A C B k 2 C c C B = k 2C cC B

Initial Conditions CA0 =CB0=1, CC0 =CD0=0

clc clear all cA0 = 1; cB0 = 2; x0 = [cA0; cB0; 0; 0]; k1 = 1; k2 = 0.5; % set fixed parameters % tend = 10; % set end time % call ode45 to perform simulation [t x] = ode45(@batchreactor,[0 [t,x] ode45(@batchreactor [0 10] 10], x0); % plot results figure plot(t,x(:,1),'+r') hold on; plot(t,x(:,2),'Og') plot(t,x(:,3),'*b') plot(t,x(:,4),'xm') xlabel('time xlabel( time t') t) ylabel('concentration c(t)');

function f = batchreactor(t,x); % f = zeros(size(x)); f = zeros(4,1); % extract concentrations from state vector cA = x(1); cB = x(2); cC = x(3); cD = x(4); % compute rates of each reaction k1 = 1; k2 = 0.5; % set fixed parameters r1 = k1*cA*cB; r2 = k2*cC*cB; f(1) = -r1; % mole balance on A f(2) = -r1 -r2; % mole balance on B f(3) = r1 - r2; % mole balance on C f(4) = r2; % mole balance on D

Coupled chemical reactions


The system of highly coupled chemical reaction takes place in a batch reactor The chemical reaction starts with the following initial conditions. Initial p concentration of components A0 =1, E0=1, and B0= C0=D0=F0=0 mol/litre. y state compositions p of all Calculate the steady components , assume all reactions are first order.

Coupled chemical reactions


K12= 0.1, K21= 0.2, K13= 0.05, K31= 0.1, K32= 0.1, K23= 0.05, K34= 0.1, K43= 0.2, K45= 0.1, K54= 0.05, K64= 0.2, K46= 0.2, K65= 0.1, K56= 0.1, A0= 1.0 mol/L, B0 =0, C0 =0, D0 =0, E0= 1 0 mol/L 1.0 mol/L, F0 =0

dC A dt dC B dt dC c dt dC D dt dC E dt dC F dt

= k 21C A + k12 C B + k13 C C k 31C A = k 21C A k12 C B k 32 C B + k 23C c = k 43 C C + k 34 C D k13C C + k 31C A + k 32 C B k 23C c = + k 46 C F k 64 C D + k 45 C E k 54 C D + k 43C C k 34 C D = k 45 C E + k 54 C D + k 56 C F k 65 C E = k 46 C F + k 64 C D + k 65 C E k 56 C F

Initial Conditions : A0= 1.0 mol/L, B0 =0, C0 =0, D0 =0, E0= 1.0 1 0 mol/L, l/L F0 =0 0

clc clear all cA0 = 1; % Giving intial condtions cB0 = 0; cC0 = 0; cD0 D0 = 0 0; cE0 = 1; cF0 = 0; x0 = [ [cA0; ; cB0; ; cC0; ; cD0; ; cE0; ; cF0]; ]; [t,x] = ode45(@reaction,[0 20], x0);

function f = reaction(t,x); % this is to define function (which we'll call later) f = zeros(6,1); %our answer/ question has 6 components cA = x(1); cB = x(2); cC = x(3); cD = x(4); cE=x(5); cF=x(6); % allocating space for different components k12=0.1; k13=0.05; %definining constanct variable k21=0.2; k23=0.05; k31=0.1; k32=0.1; k34=0.1; k43=0.2; k45=0.1; k46=0.2; k54=0.05; k56=0.1; k64=0.2; k65=0.1; f(1) = -k21*cA + k12*cB - k31*cA + k13*cC; %since we have 6 unknown 6 efollowing equation to solve them(dcA/ct ; dcB/dt.. till dcF/dt) f(2) = -(k12+k32)*cB + k21*cA + k23*cC; f(3) = -(k13+k23+k43)*cC+ k31*cA +k32*cB +k34*cD; f(4) = -(k34+k54+k64)*cD + k43*cC+k45*cE+k46*cF; f(5) = -(k45+k65)*cE + k54*cD +k56*cF f(6) = -(k46+k56)*cF + k64*cD+ k65*cE

Two Tank in Series Reactor

Consider a series of 2 tanks, where the levels interact. Assuming that the flow rate of 1st tank is linearly proportional to the difference in the tank heights,F1 = 1(h1 h2) ; the flow rate from tank 2 is proportional to the height in tank 2, 2 F2 = 2h2 ; and the tanks are of constant cross sectional area (A1,A A2), ) show that the modelling equation

Assuming g that the flow rate of 1st tank is linearly y proportional to the height in tank 1,F1 = 1h1 ; the flow rate from tank 2 is proportional to the height in tank 2, F2 = 2h2 ; and the tanks are of constant cross sectional area (A1,A2), show that the modelling equation

Assume that the steady state flow rate is 3ft3/min and the steady state tank heights of tank1 and tank 2 as h1s = 7ft, h2s = 3ft The constant cross sectional area, A1 = A2 = 5ft2 for each tank. The initial conditions for h1, h2 :h10 = 6ft, 6ft h20 = 5ft Solve for heights of tank1 and tank2 as a function of time time. Plot the tank heights as a function of time time. Write a MATLAB program and use ode45 to integrate the 2 equations shown above above.

Matlab Programme for Interacting T k Tanks


%interacting tank problem (TANKHYT) function f= tankhyt(t,h) f zeros(2,1); f=zeros(2,1); hA=h(1); hB=h(2); fi=5;%constant inlet flow b=0.3;%beta value assumed a=5;%area of cross section of tank f(1)=(fi/a)-((b/a)*(hA-hB));%ordinary differential equation,(dh1/dt)=f(1) ( ) (( ) ( )) (( ) ) f(2)=((b/a)*(hA-hB))-((b/a)*hB); end

clc clear all %using ode to solve function tankhyt hAi=6;hBi=6;%initial values declared hi=[hAi ;hBi]; t d [0 200] tend=[0 200]; %time %ti i interval t ld declared l d [t,h]=ode45(@tankhyt,tend,hi); figure; plot(t,h(:,1),'.-r'); hold on; ;

Matlab Programme for Non I Interacting i T Tanks k


%noninteracting g tank p problem(TANKHYT) ( ) function f= nitankhyt(t,h) f=zeros(2,1); hA=h(1);hB=h(2); f0=5;%constant inlet flow b=0.3;%beta % value assumed a1=5;a2=5;%area of cross section of tank f(1)=(f0/a1) ((b/a2)*(hA)); f(1)=(f0/a1)-((b/a2) (hA)); %ordinary differential equation,(dh1/dt)=f(1) ( ) (( ) ( )) (( ) ) f(2)=((b/a2)*(hA))-((b/a2)*hB); end

%using ode to solve function tankhyt hAi=6;hBi=6;%initial values declared hi=[hAi hBi]; t d [0 200] tend=[0 200]; %time %ti i interval t ld declared l d [t,h]=ode45(@nitankhyt,tend,hi); figure; plot(t,h(:,1),'.-r'); odo on; ; hold plot(t,h(:,2),'b'); xlabel('time t'); ylabel('height h'); title('height-time variation'); grid;

Continuous Stirred Tank Reactor

Problem statement
A chemical reaction takes place in a series of four continuous stirred tank reactors arranged d as shown h i in Fi Fig

100 lit/hr 100 lit/hr 1000 lit/hr CA0=1 mol/lit


V1 CA
1

V2 CA
2

V3 CA
3

V4 CA
4

1000 lit/hr

K1

K2

K3

K4

CA1

CA2

CA3

CA4

The chemical reaction is a first order irreversible reaction of the typeA k B The value of the rate constant ki, is different in each reactor. Also, the volume of each reactor Vi is different

Assumptions:
The system is steady state and unsteady state. The reactions are in liquid phase. There is no change in volume or density of the liquid.
Reactor
1 2 3 4

Vi(L)
1000 1500 100 500

Ki(h-1)
0.3 0.4 0.1 0.2

Solution

Material balance continued:

Using MATLAB for steady state results


function f=fourcstrsteady(x) f=zeros(4,1); %defining constants CA0=1; V1=1000; K1=0.1; %data from table V2=1500; K2=0 K2=0.2; 2; V3=100; K3=0.4; V4=500; K4=0.3; xa=x(1);xb=x(2);xc=x(3);xd=x(4); (1) b (2) (3) d (4) %material balance equations: f(1)=(1000*CA0)-(1000*xa)-(V1*K1*xa); f(2) (1000* ) (100* ) (1100* b) (V2*K2* b) f(2)=(1000*xa)+(100*xc)-(1100*xb)-(V2*K2*xb); f(3)=(1100*xb)+(100*xd)-(1200*xc)-(V3*K3*xc); f(4)=(1100*xc)-(1100*xd)-(V4*K4*xd);

Running the following displays the steady state concentrations in the tanks:
clc clear all x0=[0,0,0,0]; %initial values x=fsolve(@fourcstrsteady x0) %fsolve to solve x=fsolve(@fourcstrsteady, the steadystate

MATLAB for unsteady state results


function f=fourcstr(t,x) f=zeros(4,1); %defining constants CA0=1; V1=1000; V1 1000; K1=0 K1 0.1;%data 1;%data from the table given V2=1500; K2=0.2;%data from the table given V3=100; K3=0.4;%data from the table given V4 500 K4 V4=500; K4=0.3;%data 0 3 %d t f from th the t table bl given i xa=x(1);xb=x(2);xc=x(3);xd=x(4); %defining the differential equations %material balance equations assuming unsteady state f(1)=(1000*CA0)-(1000*xa)-(V1*K1*xa); f(2) (1000 xa) (100 xc) (1100 xb) (V2 K2 xb); f(2)=(1000*xa)+(100*xc)-(1100*xb)-(V2*K2*xb); f(3)=(1100*xb)+(100*xd)-(1200*xc)-(V3*K3*xc); f(4)=(1100*xc)-(1100*xd)-(V4*K4*xd);

Running the following code in MATLAB yields the plot depicting the variation of Concentration in each tank:
clc clear all x0=[1;0;0;0]; x0 [1;0;0;0]; %defining the initial values. [t,x]=ode45(@fourcstr, [0 0.1], x0); %ode45 to solve the unsteady state figure; plot(t,x); %plot function %labelling x and y axes xlabel('time l b l(' i t(hrs)'); (h )') ylabel('concentration c(t)');

Steady state result predicted :


At steady state, the concentration in tanks 1,2,3 and 4 as predicted by the programme: [CA1 CA2 CA3 CA4] [ ]= [0.9091 [ 0.6969 0.6654 0.5856]

Unsteady y state results The following variation is predicted with i h respected d to time i

HEAT EXCHANGE IN SERIES OF REACTOR TANKS

HEAT EXCHANGE IN SERIES OF REACTOR TANKS

Problem Description
For the reaction tanks above, heat transfer in the fluid stream takes k place l b two methods, by h d 1) Heat transfer through fluid already in the tanks, Equation for this can be written as, Q=(w/m)(Tin-Tout)where, Q = rate t of f heat h t transfer t f in i kJ/sec kJ/ W = rate of mass flow of fluid in Kg/min Tin = input p temperature p of the stream Tout = output temperature of the stream when it leaves the reaction tank 2) Other source of heat transfer is that from the coil which is provided to heat the fluid Equation used for the heat transfer in that case is Q = UA (Tsteam- T)

UA = is the final heat transfer coefficient Tsteam T = gives the temperature difference between steam used to heat and th the fl fluid id i inside id th the t tank. k Therefore total heat transferred to the liquid can be written as the sum of the above two heat transfer. Now as the heat is transferred to the fluid inside the tank its temperature rises. This rise in temperature can be expressed in terms of the rate of change of temperature or

dT/dt also l the h above b equation i h heat can b be obtained b i d lik like accumulation = input output therefore, final equation for the unsteady state can be written as,

dT/dt = (w/m)*(T0-T1)+(UA/mCp)*(Tstream-T1) dT/dt = (w/m)*(T0-T2)+(UA/mCp)*(Tstream-T2) dT/dt = (w/m) (w/m)*(T0-T3)+(UA/mCp)*(Tstream-T3) (T0 T3)+(UA/mCp) (Tstream T3)

now for the steady state rate of chane of temperature becomes 0 Therefore dT/dt = 0 Hence in matlab we use fsolve to find this temperature. To heat the fluid evenly impellers are used.

MATLAB CODE
function function f = tank (t,x) f = zeros (3,1); t1=x(1);t2=x(2);t3=x(3); t 250 ts=250;ua=10;cp=2;t0=20; 10 2 t0 20 w=100;m=10; f(1)=(w/m) (t0-t1)+(ua/m cp) (ts-t1); f(1)=(w/m)*(t0-t1)+(ua/m*cp)*(ts-t1); f(2)=(w/m)*(t1-t2)+(ua/m*cp)*(ts-t2); f(3)=(w/m)*(t2-t3)+(ua/m*cp)*(ts-t3); ( ) ( )( ) ( p) ( );

Main
clc;clf; clearall; x0=[1 1 1]; [t ] d 45(@ t [0 10] 0) [t,x]=ode45(@vmt,[0,10],x0); % [x]=fsolve(@vmt,x0); plot (t,x(:,1)); holdon; plot (t,x(:,2),'r'); plot (t,x(:,3),'b'); (t,x(:,3), b );

plot

You might also like