[302] | 1 | #*------------------------------------------------------------------- |
---|
| 2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
| 3 | * |
---|
| 4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
| 5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
| 6 | * http://www.enq.ufrgs.br/alsoc. |
---|
| 7 | * |
---|
| 8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
| 9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
| 10 | * All rights reserved. |
---|
| 11 | * |
---|
| 12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
| 13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
| 14 | * |
---|
| 15 | *---------------------------------------------------------------------- |
---|
| 16 | * Author: Rafael de P. Soares and Paula B. Staudt |
---|
| 17 | * $Id: pfr.mso 354 2007-08-30 17:17:16Z arge $ |
---|
| 18 | *--------------------------------------------------------------------*# |
---|
| 19 | |
---|
| 20 | using "streams"; |
---|
| 21 | |
---|
| 22 | Model pfr |
---|
| 23 | |
---|
| 24 | ATTRIBUTES |
---|
| 25 | Pallete = true; |
---|
| 26 | Brief = "Model of a Generic PFR with constant mass holdup"; |
---|
| 27 | Icon = "icon/pfr"; |
---|
[354] | 28 | Info = |
---|
| 29 | "== Requires the information of == |
---|
| 30 | * Reaction values |
---|
| 31 | * Heat of reaction |
---|
| 32 | * Pressure profile |
---|
| 33 | "; |
---|
[302] | 34 | |
---|
| 35 | PARAMETERS |
---|
| 36 | |
---|
| 37 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 38 | outer NComp as Integer (Brief="Number of components"); |
---|
| 39 | NReac as Integer (Brief="Number of reactions"); |
---|
| 40 | stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); |
---|
| 41 | NDisc as Integer (Brief="Number of points of discretization", Default=10); |
---|
| 42 | Mw(NComp) as molweight (Brief="Component Mol Weight"); |
---|
| 43 | L as length (Brief="Reactor Length"); |
---|
| 44 | Across as area (Brief="Cross section area"); |
---|
| 45 | |
---|
| 46 | SET |
---|
| 47 | |
---|
| 48 | Mw = PP.MolecularWeight(); |
---|
| 49 | |
---|
| 50 | VARIABLES |
---|
| 51 | |
---|
[352] | 52 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5076, Symbol="_{in}"); |
---|
| 53 | out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.5236, Symbol="_{out}"); |
---|
[302] | 54 | |
---|
| 55 | str(NDisc+1) as streamPH; |
---|
| 56 | vel(NDisc+1) as velocity; |
---|
| 57 | vol(NDisc+1) as vol_mol; |
---|
| 58 | rho(NDisc+1) as dens_mass; |
---|
| 59 | |
---|
| 60 | q(NDisc) as heat_rate; |
---|
| 61 | M(NComp, NDisc) as mol (Brief = "Molar holdup"); |
---|
| 62 | Mt(NDisc) as mol (Brief = "Molar holdup"); |
---|
| 63 | C(NComp, NDisc) as conc_mol (Brief="Components concentration", Lower=-1e-6); |
---|
| 64 | E(NDisc) as energy (Brief="Total Energy Holdup on element"); |
---|
| 65 | r(NReac, NDisc) as reaction_mol; |
---|
| 66 | Hr(NReac, NDisc) as heat_reaction; |
---|
| 67 | |
---|
| 68 | EQUATIONS |
---|
| 69 | |
---|
| 70 | "Inlet boundary" |
---|
| 71 | str(1).F = Inlet.F; |
---|
| 72 | str(1).T = Inlet.T; |
---|
| 73 | str(1).P = Inlet.P; |
---|
| 74 | str(1).z = Inlet.z; |
---|
| 75 | |
---|
| 76 | "Outlet boundary" |
---|
| 77 | Outlet.F = str(NDisc+1).F; |
---|
| 78 | Outlet.T = str(NDisc+1).T; |
---|
| 79 | Outlet.P = str(NDisc+1).P; |
---|
| 80 | Outlet.z = str(NDisc+1).z; |
---|
| 81 | Outlet.h = str(NDisc+1).h; |
---|
| 82 | Outlet.v = str(NDisc+1).v; |
---|
| 83 | |
---|
| 84 | for z in [1:NDisc] |
---|
| 85 | for c in [1:NComp-1] |
---|
| 86 | "Component Molar Balance" |
---|
| 87 | diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c)) |
---|
| 88 | + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc; |
---|
| 89 | end |
---|
| 90 | |
---|
| 91 | "Energy Balance" |
---|
| 92 | diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h + |
---|
| 93 | sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z); |
---|
| 94 | |
---|
| 95 | "Energy Holdup" |
---|
| 96 | E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc; |
---|
| 97 | |
---|
| 98 | "mass flow is considered constant" |
---|
| 99 | str(z+1).F*vol(z+1) = str(z).F*vol(z); # FIXME: is this correct? No (constant velocity: only for equimolar) |
---|
| 100 | #rho(z+1)*vel(z+1) = rho(z)*vel(z); # FIXME: this is correct! But does not converge. |
---|
| 101 | |
---|
| 102 | "Molar concentration" |
---|
| 103 | C(:,z) * Across*L/NDisc = M(:,z); |
---|
| 104 | |
---|
| 105 | "Sum of M" |
---|
| 106 | Mt(z) = sum(M(:,z)); |
---|
| 107 | |
---|
| 108 | "Geometrical constraint" |
---|
| 109 | Across*L/NDisc = Mt(z) * vol(z); |
---|
| 110 | |
---|
| 111 | "Molar fraction" |
---|
| 112 | str(z+1).z * Mt(z) = M(:,z); |
---|
| 113 | end |
---|
| 114 | |
---|
| 115 | for z in [1:NDisc+1] |
---|
| 116 | "Specific Volume" |
---|
| 117 | vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z); |
---|
| 118 | |
---|
| 119 | "Specific Mass" |
---|
| 120 | rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z); |
---|
| 121 | |
---|
| 122 | "Velocity" |
---|
| 123 | vel(z)*Across = str(z).F*vol(z); |
---|
| 124 | end |
---|
| 125 | end |
---|