#*---------------------------------------------------------------------
* Series of CSTR and PFR
*----------------------------------------------------------------------
* Solved problem from Fogler (1999)
* Problem number: 2-2 at 2-7
* Page: 38-49 (Brazilian edition, 2002)
*----------------------------------------------------------------------
*
* Description:
* Sample to comparative between volumes to specific outlet molar
* conversion of CSTR and PFR by means of several different
* configurations
*
* Assumptions:
* * steady-state
* * isotermic and isobaric system
* * gaseous phase
*
* Specify:
* * the inlet stream (F,X)
* * the expression of rate of reaction
* * the initial volume
* * the outlet conversion
*
* Configurations:
* * only one CSTR
* * only one PFR
* * 2 CSTRs in series
* * 2 PFRs in series
* * one PFR followed for one CSTR
* * one CSTR followed for one PFR
*
*----------------------------------------------------------------------
* Author: Rodolfo Rodrigues and Argimiro R. Secchi
* GIMSCOP/UFRGS - Group of Integration, Modeling, Simulation, Control,
* and Optimization of Processes
* $Id$
*--------------------------------------------------------------------*#
using "types";
#*---------------------------------------------------------------------
* Model of a stream
*--------------------------------------------------------------------*#
Model stream
PARAMETERS
NComp as Integer (Brief="Number of components", Default=1);
VARIABLES
F(NComp)as flow_mol (Brief="Molar flow", Unit="mol/s");
X(NComp)as fraction (Brief="Molar conversion");
end
#*---------------------------------------------------------------------
* Model of a steady-state, isotermic, and isobaric CSTR
*--------------------------------------------------------------------*#
Model cstr
VARIABLES
in Inlet as stream; # Inlet stream
out Outlet as stream; # Outlet stream
r as reaction_mol(Brief="Rate of reaction", Unit="mol/l/s");
V as volume (Brief="Volume", Unit="l");
EQUATIONS
"Component molar balance"
Inlet.F - Outlet.F = (-r)*V;
"Outlet molar flow"
Outlet.F = Inlet.F*(1 - Outlet.X);
end
#*---------------------------------------------------------------------
* Model of a steady-state, isotermic, and isobaric PFR
*--------------------------------------------------------------------*#
Model pfr
VARIABLES
in Inlet as stream; # Inlet stream
out Outlet as stream; # Outlet stream
V as volume (Brief="Volume", Unit="l");
r as reaction_mol(Brief="Rate of reaction", Unit="mol/l/s");
EQUATIONS
"Molar balance"
diff(V) = Inlet.F/(-r)*"1/s";
"Change time in X"
Outlet.X = time*"1/s";
"Molar flow"
Outlet.F = Inlet.F*(1 - Outlet.X);
end
#*---------------------------------------------------------------------
* Model of a discreted steady-state, isotermic, and isobaric PFR
*--------------------------------------------------------------------*#
Model pfr_d
PARAMETERS
N as Integer (Brief="Number of descrete points", Default=200);
VARIABLES
in Inlet as stream; # Inlet stream
out Outlet as stream; # Outlet stream
V(N) as volume (Brief="Volume", Unit="l");
X(N) as fraction (Brief="Molar conversion");
dx as fraction (Brief="Conversion increment");
r(N) as reaction_mol (Brief="Rate of reaction", Unit="mol/l/s");
F(N) as flow_mol (Brief="Molar flow", Unit="mol/s");
EQUATIONS
"Discrete interval"
dx = X(N)/N;
for i in [2:N]
"Molar balance"
V(i) - V(i-1) = Inlet.F*dx/(-r(i));
"Discrete molar conversion"
X(i-1) = X(i) - dx;
end
"Molar flow"
F = Inlet.F*(1 - X);
"Outlet molar flow"
Outlet.F = F(N);
"Outlet molar conversion"
Outlet.X = X(N);
end
#*---------------------------------------------------------------------
* Example 2-2: Scale-up an isotermic CSTR in gaseous phase
*--------------------------------------------------------------------*#
FlowSheet cstr_sample
PARAMETERS
R as Real (Brief="Universal gas constant", Unit="atm*l/mol/K", Default=0.082);
T as temperature (Brief="Temperatura in the reactor", Unit="K");
P as pressure (Brief="Pressure in the reactor", Unit="atm");
zin as fraction (Brief="Inlet molar fraction");
v0 as flow_vol (Brief="Volumetric flow");
VARIABLES
Vt as volume (Brief="Total reactor volume", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as cstr;
CONNECTIONS
Inlet to R1.Inlet;
EQUATIONS
"Inlet molar flow"
Inlet.F = (zin*P/(R*T))*v0;
"Rate of reaction"
(-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*"mol/l/s";
"Total reactor volume"
Vt = R1.V;
SPECIFY
"Inlet conversion"
Inlet.X = 0.0;
"Required conversion"
R1.Outlet.X = 0.8;
SET
v0 = 6.0*"l/s";
T = 422.2*"K";
P = 10*"atm";
zin = 0.5;
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-3: Scale-up an isotermic PFR in gaseous phase
*--------------------------------------------------------------------*#
FlowSheet pfr_sample
DEVICES
Inlet as stream; # Inlet stream
R1 as pfr;
CONNECTIONS
Inlet to R1.Inlet;
EQUATIONS
"Rate of reaction"
(-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*"mol/l/s";
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
INITIAL
"Reactor volume"
R1.V = 0.0*"l";
OPTIONS
time = [0:0.004:0.8];
end
#*---------------------------------------------------------------------
* Example 2-3: (discreted)
*--------------------------------------------------------------------*#
FlowSheet pfr_d_sample
VARIABLES
Vt as volume (Brief="Total reactor volume", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as pfr_d;
CONNECTIONS
Inlet to R1.Inlet;
EQUATIONS
"Rate of reaction"
(-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*"mol/l/s";
"Total reactor volume"
Vt = R1.V(R1.N);
# SET
# R1.N = 100;
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required conversion"
R1.Outlet.X = 0.8;
"Initial volume"
R1.V(1) = 0.0*"l";
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-4: Comparing volumes between one CSTR and one PFR
*--------------------------------------------------------------------*#
FlowSheet comparative
VARIABLES
V_cstr as volume (Brief="CSTR volume", Unit="l");
V_pfr as volume (Brief="PFR volume", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
CSTR as cstr;
PFR as pfr_d;
CONNECTIONS
Inlet to CSTR.Inlet;
Inlet to PFR.Inlet;
EQUATIONS
"Rate of reaction in CSTR"
(-CSTR.r) = (0.0092*CSTR.Outlet.X^3 - 0.0153*CSTR.Outlet.X^2 + 0.0013*CSTR.Outlet.X + 0.0053)*"mol/l/s";
"Rate of reaction in PFR"
(-PFR.r) = (0.0092*PFR.X^3 - 0.0153*PFR.X^2 + 0.0013*PFR.X + 0.0053)*"mol/l/s";
"CSTR volume"
V_cstr = CSTR.V;
"PFR volume"
V_pfr = PFR.V(PFR.N);
# SET
# PFR.N = 100;
SPECIFY
"Inlet molar flow"
Inlet.F = 5.0*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required CSTR conversion"
CSTR.Outlet.X = 0.6;
"Required PFR conversion"
PFR.Outlet.X = 0.6;
"Initial volume in PFR"
PFR.V(1) = 0.0*"l";
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-5: two CSTRs in serie
*--------------------------------------------------------------------*#
FlowSheet cstr_cstr
VARIABLES
V1 as volume (Brief="1st reactor volume", Unit="l");
V2 as volume (Brief="2nd reactor volume", Unit="l");
Vt as volume (Brief="Total reactor volumes", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as cstr;
R2 as cstr;
CONNECTIONS
Inlet to R1.Inlet;
R1.Outlet to R2.Inlet;
EQUATIONS
"Rate of reaction in 1st reactor"
(-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*"mol/l/s";
"Rate of reaction in 2nd reactor"
(-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*"mol/l/s";
"1st volume reactor"
V1 = R1.V;
"1st volume reactor"
V2 = R2.V;
"Total volume of reactors"
Vt = V1 + V2;
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required 1st reactor conversion"
R1.Outlet.X = 0.4;
"Required 2nd reactor conversion"
R2.Outlet.X = 0.8;
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-6: two PFRs in series (descreted)
*--------------------------------------------------------------------*#
FlowSheet pfr_pfr
VARIABLES
V1 as volume (Brief="1st reactor volume", Unit="l");
V2 as volume (Brief="2nd reactor volume", Unit="l");
Vt as volume (Brief="Total reactor volumes", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as pfr_d;
R2 as pfr_d;
CONNECTIONS
Inlet to R1.Inlet;
R1.Outlet to R2.Inlet;
EQUATIONS
"Rate of reaction in 1st reactor"
(-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*"mol/l/s";
"Rate of reaction in 2nd reactor"
(-R2.r) = (0.0092*R2.X^3 - 0.0153*R2.X^2 + 0.0013*R2.X + 0.0053)*"mol/l/s";
"1st reactor volume"
V1 = R1.V(R1.N);
"1st reactor volume"
V2 = R2.V(R2.N);
"Total reactor volumes"
Vt = V1 + V2;
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required 1st reactor conversion"
R1.Outlet.X = 0.4;
"Required 2nd reactor conversion"
R2.Outlet.X = 0.8;
"Initial 1st reactor volume"
R1.V(1) = 0.0*"l";
"Initial 2nd reactor volume"
R2.V(1) = 0.0*"l";
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-7a: one PFR and one CSTR in series
*--------------------------------------------------------------------*#
FlowSheet pfr_cstr
VARIABLES
V1 as volume (Brief="1st reactor volume", Unit="l");
V2 as volume (Brief="2nd reactor volume", Unit="l");
Vt as volume (Brief="Total reactor volumes", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as pfr_d;
R2 as cstr;
CONNECTIONS
Inlet to R1.Inlet;
R1.Outlet to R2.Inlet;
EQUATIONS
"Rate of reaction in 1st reactor"
(-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*"mol/l/s";
"Rate of reaction in 2nd reactor"
(-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*"mol/l/s";
"1st reactor volume"
V1 = R1.V(R1.N);
"1st reactor volume"
V2 = R2.V;
"Total reactor volumes"
Vt = V1 + V2;
# SET
# R1.N = 100;
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required 1st reactor conversion"
R1.Outlet.X = 0.5;
"Required 2nd reactor conversion"
R2.Outlet.X = 0.8;
"Initial 1st reactor volume"
R1.V(1) = 0.0*"l";
OPTIONS
mode = "steady";
end
#*---------------------------------------------------------------------
* Example 2-7b: one CSTR and one PFR in series
*--------------------------------------------------------------------*#
FlowSheet cstr_pfr
VARIABLES
V1 as volume (Brief="1st reactor volume", Unit="l");
V2 as volume (Brief="2nd reactor volume", Unit="l");
Vt as volume (Brief="Total reactor volumes", Unit="l");
DEVICES
Inlet as stream; # Inlet stream
R1 as cstr;
R2 as pfr_d;
CONNECTIONS
Inlet to R1.Inlet;
R1.Outlet to R2.Inlet;
EQUATIONS
"Rate of reaction in 1st reactor"
(-R1.r) = (9.2*R1.Outlet.X^3 - 15.3*R1.Outlet.X^2 + 1.3*R1.Outlet.X + 5.3)*1e-3*"mol/l/s";
"Rate of reaction in 2nd reactor"
(-R2.r) = (9.2*R2.X^3 - 15.3*R2.X^2 + 1.3*R2.X + 5.3)*1e-3*"mol/l/s";
"1st reactor volume"
V1 = R1.V;
"1st reactor volume"
V2 = R2.V(R2.N);
"Total reactor volumes"
Vt = V1 + V2;
# SET
# R2.N = 100;
SPECIFY
"Inlet molar flow"
Inlet.F = 0.866541*"mol/s";
"Inlet conversion"
Inlet.X = 0.0;
"Required 1st reactor conversion"
R1.Outlet.X = 0.5;
"Required 2nd reactor conversion"
R2.Outlet.X = 0.8;
"Initial 2nd reactor volume"
R2.V(1) = 0.0*"l";
OPTIONS
mode = "steady";
end