#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *--------------------------------------------------------------------- * 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 * $Id: series_reactors.mso 574 2008-07-25 14:18:50Z rafael $ *--------------------------------------------------------------------*# using "types"; #*--------------------------------------------------------------------- * Estimation of rate of reaction *--------------------------------------------------------------------*# FlowSheet rate PARAMETERS a1 as Real (Brief="Parameter to estimate", Default=0.01); a2 as Real (Brief="Parameter to estimate", Default=0.01); a3 as Real (Brief="Parameter to estimate", Default=0.01); a4 as Real (Brief="Parameter to estimate", Default=0.01); VARIABLES r as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/m^3/s'); X as fraction (Brief="Molar conversion", Unit='mol/mol'); EQUATIONS "Rate of reaction" # Attributed expression (-r) = (a4*X^3 + a3*X^2 + a2*X + a1)*'mol/l/s'; SPECIFY X = 0.5; OPTIONS Dynamic = false; end Estimation rate_of_reaction as rate ESTIMATE # PAR START LOWER UPPER a1 0.01 -1 1; a2 0.01 -1 1; a3 -0.01 -1 1; a4 0.01 -1 1; EXPERIMENTS # FILE WEIGTH "raw_data.dat" 1; # Table 2-1 (Fogler,1999) OPTIONS Dynamic = false; NLPSolver(File = "ipopt_emso", ObjTol = 1e-8 ); end #*--------------------------------------------------------------------- * Model of a simple stream *--------------------------------------------------------------------*# Model simple_stream VARIABLES F as flow_mol (Brief="Molar flow", DisplayUnit='mol/s'); X as fraction (Brief="Molar conversion"); end Model reactor_source ATTRIBUTES Pallete = true; Brief = "Simple inlet stream"; Icon = "icon/inlet"; VARIABLES out Outlet as simple_stream (Brief="Outlet stream", PosX=1, PosY=0.5); end Model reactor_sink ATTRIBUTES Pallete = true; Brief = "Simple outlet stream"; Icon = "icon/outlet"; VARIABLES in Inlet as simple_stream (Brief="Inlet stream", PosX=0, PosY=0.5); end #*--------------------------------------------------------------------- * Model of a steady-state, isotermic, and isobaric CSTR *--------------------------------------------------------------------*# Model simple_cstr ATTRIBUTES Pallete = true; Brief = "Simple model of a steady-state CSTR"; Icon = "icon/simple_cstr"; PARAMETERS NT as Integer (Brief="Number of terms of reaction rate expression", Default=4); a(NT) as reaction_mol (Brief="Parameter of reaction rate expression", DisplayUnit='mol/l/s'); VARIABLES in Inlet as simple_stream(Brief="Inlet stream", Symbol="_{in}", PosX=0, PosY=0); out Outlet as simple_stream(Brief="Outlet stream", Symbol="_{out}", PosX=1, PosY=1); r as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s'); V as volume (Brief="Volume", DisplayUnit='l', Upper=2e3); SET a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated EQUATIONS "Component molar balance" Inlet.F*(Outlet.X - Inlet.X) = (-r)*V; "Molar flow" Outlet.F = Inlet.F; "Rate of reaction" (-r) = sum(a*Outlet.X^[0:(NT-1)]); end #*--------------------------------------------------------------------- * Model of a steady-state, isotermic, and isobaric PFR *--------------------------------------------------------------------*# Model simple_pfr PARAMETERS NT as Integer (Brief="Number of terms of reaction rate expression", Default=4); a(NT) as reaction_mol (Brief="Parameter of reaction rate expression", DisplayUnit='mol/l/s'); VARIABLES in Inlet as simple_stream(Brief="Inlet stream", Symbol="_{in}"); out Outlet as simple_stream(Brief="Outlet stream", Symbol="_{out}"); V as volume (Brief="Volume", DisplayUnit='l', Upper=2e3); r as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s'); SET a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated EQUATIONS "Molar balance" diff(V) = Inlet.F/(-r)/'s'; "Change time in X" Outlet.X = time/'s'; "Molar flow" Outlet.F = Inlet.F; "Rate of reaction" (-r) = sum(a*Outlet.X^[0:(NT-1)]); INITIAL "Reactor volume" V = 0.0*'l'; end #*--------------------------------------------------------------------- * Model of a discreted steady-state, isotermic, and isobaric PFR *--------------------------------------------------------------------*# Model simple_pfr_d ATTRIBUTES Pallete = true; Brief = "Simple model of a steady-state PFR"; Icon = "icon/simple_pfr"; PARAMETERS N as Integer (Brief="Number of discrete points", Lower=2, Default=150); NT as Integer (Brief="Number of terms of reaction rate expression", Default=4); a(NT) as reaction_mol (Brief="Parameter of reaction rate expression",DisplayUnit='mol/l/s'); VARIABLES in Inlet as simple_stream(Brief="Inlet stream", Symbol="_{in}", PosX=0, PosY=0.5); out Outlet as simple_stream(Brief="Outlet stream", Symbol="_{out}", PosX=1, PosY=0.5); V(N) as volume (Brief="Volume", DisplayUnit='l', Upper=2e3); r(N) as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s'); X(N) as fraction (Brief="Molar conversion"); dx as fraction (Brief="Conversion increment"); SET a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated EQUATIONS "Outlet molar conversion" Outlet.X = X(N); "Discrete interval" dx = (Outlet.X - Inlet.X)/(N-1); "Initial reactor volume" V(1) = 0.0*'l'; for i in [2:N] do "Molar balance" V(i) - V(i-1) = -0.5*Inlet.F*dx*(1/r(i-1) + 1/r(i)); # second order # V(i) - V(i-1) = Inlet.F*dx/(-r(i)); # first order "Discrete molar conversion" X(i-1) = X(i) - dx; end "Molar flow" Outlet.F = Inlet.F; for i in [1:N] do "Rate of reaction" (-r(i)) = sum(a*X(i)^[0:(NT-1)]); end 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"); P as pressure (Brief="Pressure in the reactor"); zin as fraction (Brief="Inlet molar fraction"); v0 as flow_vol (Brief="Volumetric flow"); VARIABLES Vt as volume (Brief="Total reactor volume", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_cstr; CONNECTIONS Inlet to R1.Inlet; EQUATIONS "Inlet molar flow" Inlet.F = (zin*P/(R*T))*v0; "Total reactor volume" Vt = R1.V; SET v0 = 6.0*'l/s'; T = 422.2*'K'; P = 10*'atm'; zin = 0.5; SPECIFY Inlet.X = 0.0; R1.Outlet.X = 0.8; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-3: Scale-up an isotermic PFR in gaseous phase *--------------------------------------------------------------------*# FlowSheet pfr_sample DEVICES Inlet as simple_stream; R1 as simple_pfr; CONNECTIONS Inlet to R1.Inlet; SPECIFY Inlet.F = 0.866541*'mol/s'; Inlet.X = 0.0; OPTIONS TimeStep = 0.008; TimeEnd = 0.8; end #*--------------------------------------------------------------------- * Example 2-3: (discreted) *--------------------------------------------------------------------*# FlowSheet pfr_d_sample VARIABLES Vt as volume (Brief="Total reactor volume", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_pfr_d; CONNECTIONS Inlet to R1.Inlet; EQUATIONS "Total reactor volume" Vt = R1.V(R1.N); SET R1.N = 150; SPECIFY Inlet.F = 0.866541*'mol/s'; Inlet.X = 0.0; R1.Outlet.X = 0.8; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-4: Comparing volumes between one CSTR and one PFR *--------------------------------------------------------------------*# FlowSheet comparative VARIABLES V_cstr as volume (Brief="CSTR volume", DisplayUnit='l'); V_pfr as volume (Brief="PFR volume", DisplayUnit='l'); DEVICES Inlet as simple_stream; CSTR as simple_cstr; PFR as simple_pfr_d; CONNECTIONS Inlet to CSTR.Inlet; Inlet to PFR.Inlet; EQUATIONS "CSTR volume" V_cstr = CSTR.V; "PFR volume" V_pfr = PFR.V(PFR.N); SET PFR.N = 100; SPECIFY Inlet.F = 5.0*'mol/s'; Inlet.X = 0.0; CSTR.Outlet.X = 0.6; PFR.Outlet.X = 0.6; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-5: two CSTRs in serie *--------------------------------------------------------------------*# FlowSheet cstr_cstr VARIABLES V1 as volume (Brief="1st reactor volume", DisplayUnit='l'); V2 as volume (Brief="2nd reactor volume", DisplayUnit='l'); Vt as volume (Brief="Total reactor volumes", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_cstr; R2 as simple_cstr; CONNECTIONS Inlet to R1.Inlet; R1.Outlet to R2.Inlet; EQUATIONS "1st volume reactor" V1 = R1.V; "1st volume reactor" V2 = R2.V; "Total volume of reactors" Vt = V1 + V2; SPECIFY Inlet.F = 0.866541*'mol/s'; Inlet.X = 0.0; R1.Outlet.X = 0.4; R2.Outlet.X = 0.8; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-6: two PFRs in series (discreted) *--------------------------------------------------------------------*# FlowSheet pfr_pfr VARIABLES V1 as volume (Brief="1st reactor volume", DisplayUnit='l'); V2 as volume (Brief="2nd reactor volume", DisplayUnit='l'); Vt as volume (Brief="Total reactor volumes", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_pfr_d; R2 as simple_pfr_d; CONNECTIONS Inlet to R1.Inlet; R1.Outlet to R2.Inlet; EQUATIONS "1st reactor volume" V1 = R1.V(R1.N); "1st reactor volume" V2 = R2.V(R2.N); "Total reactor volumes" Vt = V1 + V2; SPECIFY Inlet.F = 0.866541*'mol/s'; Inlet.X = 0.0; R1.Outlet.X = 0.4; R2.Outlet.X = 0.8; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-7a: one PFR and one CSTR in series *--------------------------------------------------------------------*# FlowSheet pfr_cstr VARIABLES V1 as volume (Brief="1st reactor volume", DisplayUnit='l'); V2 as volume (Brief="2nd reactor volume", DisplayUnit='l'); Vt as volume (Brief="Total reactor volumes", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_pfr_d; R2 as simple_cstr; CONNECTIONS Inlet to R1.Inlet; R1.Outlet to R2.Inlet; EQUATIONS "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.F = 0.866541*'mol/s'; Inlet.X = 0.0; R1.Outlet.X = 0.5; R2.Outlet.X = 0.8; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Example 2-7b: one CSTR and one PFR in series *--------------------------------------------------------------------*# FlowSheet cstr_pfr VARIABLES V1 as volume (Brief="1st reactor volume", DisplayUnit='l'); V2 as volume (Brief="2nd reactor volume", DisplayUnit='l'); Vt as volume (Brief="Total reactor volumes", DisplayUnit='l'); DEVICES Inlet as simple_stream; R1 as simple_cstr; R2 as simple_pfr_d; CONNECTIONS Inlet to R1.Inlet; R1.Outlet to R2.Inlet; EQUATIONS "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.F = 0.866541*'mol/s'; Inlet.X = 0.0; R1.Outlet.X = 0.5; R2.Outlet.X = 0.8; OPTIONS Dynamic = false; end