Changeset 858 for trunk/eml


Ignore:
Timestamp:
Oct 9, 2009, 5:15:23 PM (14 years ago)
Author:
gerson bicca
Message:

updated pfr model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eml/reactors/pfr.mso

    r354 r858  
    2323
    2424ATTRIBUTES
     25
    2526        Pallete         = true;
     27
    2628        Brief           = "Model of a Generic PFR with constant mass holdup";
     29
    2730        Icon            = "icon/pfr";
     31
    2832        Info            =
     33
    2934"== Requires the information of ==
     35
    3036* Reaction values
     37
    3138* Heat of reaction
     39
    3240* Pressure profile
     41
    3342";
    3443
     44
     45
    3546PARAMETERS
    3647
     48
     49
    3750outer PP                                                        as Plugin               (Brief = "External Physical Properties", Type="PP");
     51
    3852outer   NComp                                           as Integer              (Brief="Number of components");
     53
    3954                NReac                                           as Integer              (Brief="Number of reactions");
     55
    4056                stoic(NComp, NReac)     as Real                         (Brief = "Stoichiometric Matrix");
     57
    4158                NDisc                                           as Integer              (Brief="Number of points of discretization", Default=10);
     59
    4260                Mw(NComp)                               as molweight    (Brief="Component Mol Weight");
     61
    4362                L                                                               as length               (Brief="Reactor Length");
     63
    4464                Across                                          as area                 (Brief="Cross section area");
    4565
     66
     67
    4668SET
    47        
     69
     70       
     71
    4872        Mw   = PP.MolecularWeight();
    4973
     74
     75
    5076VARIABLES
    5177
     78
     79
    5280in      Inlet   as stream       (Brief = "Inlet Stream", PosX=0, PosY=0.5076, Symbol="_{in}");
     81
    5382out     Outlet  as stream       (Brief = "Outlet Stream", PosX=1, PosY=0.5236, Symbol="_{out}");
    5483
    55         str(NDisc+1) as streamPH;
    56         vel(NDisc+1) as velocity;
     84
     85
     86        str(NDisc+1) as vapour_stream;
     87
    5788        vol(NDisc+1) as vol_mol;
     89
    5890        rho(NDisc+1) as dens_mass;
    59        
     91
     92       
     93
    6094        q(NDisc)                                as heat_rate;
     95
     96
     97
    6198        M(NComp, NDisc)         as mol                  (Brief = "Molar holdup");
     99
    62100        Mt(NDisc)                       as mol                  (Brief = "Molar holdup");
     101
    63102        C(NComp, NDisc)         as conc_mol     (Brief="Components concentration", Lower=-1e-6);
     103
    64104        E(NDisc)                                as energy               (Brief="Total Energy Holdup on element");
     105
    65106        r(NReac, NDisc)                 as reaction_mol;
     107
    66108        Hr(NReac, NDisc)        as heat_reaction;
    67109
     110        #Hf(NComp, NDisc)       as heat_reaction;
     111
     112
     113
    68114EQUATIONS
    69115
     116
     117
    70118"Inlet boundary"
     119
    71120        str(1).F = Inlet.F;
     121
    72122        str(1).T = Inlet.T;
     123
    73124        str(1).P = Inlet.P;
     125
    74126        str(1).z = Inlet.z;
    75127
     128
     129
    76130"Outlet boundary"
     131
    77132        Outlet.F = str(NDisc+1).F;
     133
    78134        Outlet.T = str(NDisc+1).T;
     135
    79136        Outlet.P = str(NDisc+1).P;
     137
    80138        Outlet.z = str(NDisc+1).z;
     139
    81140        Outlet.h = str(NDisc+1).h;
     141
    82142        Outlet.v = str(NDisc+1).v;
    83        
    84         for z in [1:NDisc]
    85                 for c in [1:NComp-1]
     143
     144       
     145
     146        for z in [1:NDisc]
     147
     148                for c in [1:NComp]
     149
    86150                        "Component Molar Balance"
     151
    87152                        diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c))
     153
    88154                                + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc;
     155
    89156                end
    90157
     158               
     159
    91160                "Energy Balance"
     161
    92162                diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h +
     163
    93164                        sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z);
    94165
     166
     167
    95168                "Energy Holdup"
     169
    96170                E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc;
    97171
     172
     173
    98174                "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        
     175
     176                str(z+1).F*vol(z+1)*rho(z+1) = str(z).F*vol(z)*rho(z);
     177
     178       
     179
    102180                "Molar concentration"
     181
    103182                C(:,z) * Across*L/NDisc = M(:,z);
    104                
    105                 "Sum of M"
    106                 Mt(z) = sum(M(:,z));
    107                
     183
     184               
     185
    108186                "Geometrical constraint"
     187
    109188                Across*L/NDisc = Mt(z) * vol(z);
    110189
     190
     191
    111192                "Molar fraction"
     193
    112194                str(z+1).z * Mt(z) = M(:,z);
     195
     196               
     197
     198                #Hf(:,z) = PP.IdealGasEnthalpyOfFormation(str(z+1).T);
     199
     200                #Hr(:,z) = -sum(stoic*Hf(:, z));
     201
    113202        end
    114203
    115         for z in [1:NDisc+1]
     204
     205
     206        for z in [1:NDisc+1]
     207
    116208                "Specific Volume"
     209
    117210                vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z);
    118                
     211
     212               
     213
    119214                "Specific Mass"
     215
    120216                rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z);
    121217
    122                 "Velocity"
    123                 vel(z)*Across = str(z).F*vol(z);
    124218        end
    125219end
Note: See TracChangeset for help on using the changeset viewer.