Question#3:
To study the liquid level response, a tank with a cross-sectional area (A) of 2m 2 is filled with
water until the height of a liquid level (h) is 1.5 m. At t=0, a valve below the tank is opened and
the outlet flow rate Fo. At the same time, 0.1m 3/min of water (Fi) enter the tank. If the outlet
flow rate is linear function of the liquid level:
F o=α .h α is constant =0.2 m 2 /min
Plot the height of a liquid in a tank as a function of time(t).
Say t=0 to t=60min
The Mass balance yields:
     dh
A.      =F i−F o
     dt
Solution:
Given Data:
Area of tank=A=2 m2
Height of tank = h =1.5
Outlet flow rate can be obtained from this relation:
F o=α .h Inlet flow rate = Fi = 0.1 m3/mint
Time limits are from 0 to 60 minutes.
To Find:
Plot the height of a liquid in a tank as a function of time (t) =?
Procedure:
      Apply Mass Balance
       dh F i−F o
           =
        dt      A
      The above relation can be used to determine concentration distribution. Concentration
       distribution can be determined out by applying method of solving ordinary differential
       equation on the above given Equation using MAT LAB.
      Create an M-file
      Input the data
      Take a temperature range
      Apply Ode45 function solve differential equation obtained from mass balance.
      Plot command is applied with grid on and results will come out.
M File:
% tutorial #06
close all
clc
% Group#6
% Created by Mr. Mubashar Husain
% Problem#03
% Statement
% Given Data
A=2; %area of the tank
h=1.5; % height of tank
alpha=0.2; %in m2/min
Fo=alpha*h; % outflowrate
Fi=0.1; % entrance flowrate (m3/min)
% Time Limits
Tspan=[0 60];
 [T h]=ode45(@(T,h)(Fi-alpha*h)/A ,Tspan,h);
plot(T,h,'o--')
grid on
xlabel('Time')
ylabel('heigth')
title('Time vs Height')
Results:
Question#4:
M-Xylene is produced in a plug flow reactor at 1500 R and 35 atm from mesitylene. Two
reactions occur in the reactor.
Reaction 1: Mesitylene + Hydrogen                 m-xylene+methane
Reaction 2: m-xylene+ hydrogen                   Toulene+methane
The second reaction is not desirable because it will further convert m-xylene (the desired
product) to toluene. The following system of ODEs can be set up from mol balance:
d CH            0.5           0.5
     =−k 1C H .C M −k 2C H .C x
 dt
d CM            0.5
     =−k 1C H .C M
  dt
dCX         0.5           0.5
     =k 1 C H . C M −k 2C H .C x
 dt
Initial concentration of Hydrogen = C H = CH (o) =0.021
Initial concentration of Hydrogen = C M = CM (o) =0.015
Initial concentration of Hydrogen = C X = CX (o) =0
Where T is the space time (residence time), k1 is the reaction constant of reaction 1, K2 is the
reaction constant of reaction 2, CH, CM, and Cx are the concentrations of hydrogen, mesitylene,
and m-xylene at a specified T in the reactor, respectively.
Solution:
Given Data:
k1 = 55.2 (ft3/lb mol) 0.5 hour-1
k2 = 30.2 (ft3/lb mol)
Residence time limits are from 0 to 0.5
Initial concentration of Hydrogen = C H = CH (o) =0.021
Initial concentration of Hydrogen = C M = CM (o) =0.015
Initial concentration of Hydrogen = C X = CX (o) =0
To Find:
Plot the concentration of hydrogen, mesitylene, and m-xylene as a function of t =?
Mole Balance gives:
d CH        0.5          0.5
     =−k 1C H .C M −k 2C H .C x
 dt
d CM            0.5
     =−k 1C H .C M
  dt
dCX         0.5           0.5
     =k 1 C H . C M −k 2C H .C x
 dt
Above relations can be solved by Method of ordinary differential equations using Mat Lab.
Procedure:
      Create an M-file
      Input the data
   
      Apply Ode45 function solve differential equation obtained from mass balance.
      Plot command is applied having multiple values of both axes and results will come out in
       form of graph.
M File:
% Tutorial#06
clear all
clc
% Group#6
% Author Muhammad Mehtab
% Problem#4
% Statement
% Given Data
C0=[0.02 0.015 0];
%Ch= C0(1);
%Cm= C0(2);
%Cx=C0(3);
k1=55.2; % reaction constant of first reaction in ft3/lbmol)0.5 hour-1
k2=30.3; % reaction constant of second reaction in ft3/lbmol)0.5 hour-1
Tspan=[0 0.5];
F=@(T,C) [-k1*C(1)^0.5*C(2)-k2*C(1)^0.5*C(3);            -k1*C(1)^0.5*C(2); k1*C(1)^0.5*C(2)-
k2*C(1)^0.5*C(3) ]
[T C]=ode45(F,Tspan,C0)
plot(T,C(:,1),'s-',T,C(:,2),'o--',T,C(:,3))
grid on
xlabel('Time')
ylabel('Concentration')
legend('hydrogen','mesitylene','xylene methane')
title('Concentration vs Time')
Results: