Changeset 170 for branches/newlanguage


Ignore:
Timestamp:
Mar 1, 2007, 3:35:36 PM (17 years ago)
Author:
gerson bicca
Message:

updated pfr reactor model for the new language

Location:
branches/newlanguage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/newlanguage/eml/reactors/pfr.mso

    r77 r170  
    3030
    3131Model pfr
    32         PARAMETERS
    33 ext PP   as CalcObject (Brief = "External Physical Properties");
    34 ext     NComp as Integer(Brief="Number of components");
    35         NReac as Integer(Brief="Number of reactions");
    36         stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix");
    37         NDisc as Integer(Brief="Number of points of discretization", Default=10);
    38         Mw(NComp)  as molweight (Brief="Component Mol Weight");
     32
     33ATTRIBUTES
     34        Pallete         = true;
     35        Brief           = "Brief";
     36        Info            =
     37        "write some information";
     38
     39PARAMETERS
     40
     41outer PP                                                        as Plugin               (Brief = "External Physical Properties");
     42outer   NComp                                           as Integer              (Brief="Number of components");
     43                NReac                                           as Integer              (Brief="Number of reactions");
     44                stoic(NComp, NReac)     as Real                         (Brief = "Stoichiometric Matrix");
     45                NDisc                                           as Integer              (Brief="Number of points of discretization", Default=10);
     46                Mw(NComp)                               as molweight    (Brief="Component Mol Weight");
     47                L                                                               as length               (Brief="Reactor Length");
     48                Across                                          as area                 (Brief="Cross section area");
     49
     50SET
    3951       
    40         L as length(Brief="Reactor Length");
    41         Across as area(Brief="Cross section area");
    42 
    43         SET
    4452        Mw   = PP.MolecularWeight();
    4553
    46         VARIABLES
    47 in      Inlet  as stream;
    48 out     Outlet as stream;
    49         str(NDisc+1) as stream_therm;
     54VARIABLES
     55
     56in              Inlet   as stream       (Brief = "Inlet Stream");
     57out     Outlet  as stream       (Brief = "Outlet Stream");
     58
     59        str(NDisc+1) as streamPH;
    5060        vel(NDisc+1) as velocity;
    5161        vol(NDisc+1) as vol_mol;
    5262        rho(NDisc+1) as dens_mass;
    5363       
    54         q(NDisc)    as heat_rate;
    55         M(NComp, NDisc)    as mol (Brief = "Molar holdup");
    56         Mt(NDisc)    as mol (Brief = "Molar holdup");
    57         C(NComp, NDisc)  as conc_mol(Brief="Components concentration", Lower=-1e-6);
    58         E(NDisc) as energy (Brief="Total Energy Holdup on element");
    59        
    60         r(NReac, NDisc) as reaction_mol;
    61         Hr(NReac, NDisc) as heat_reaction;
     64        q(NDisc)                                as heat_rate;
     65        M(NComp, NDisc)         as mol                  (Brief = "Molar holdup");
     66        Mt(NDisc)                       as mol                  (Brief = "Molar holdup");
     67        C(NComp, NDisc)         as conc_mol     (Brief="Components concentration", Lower=-1e-6);
     68        E(NDisc)                                as energy               (Brief="Total Energy Holdup on element");
     69        r(NReac, NDisc)                 as reaction_mol;
     70        Hr(NReac, NDisc)        as heat_reaction;
    6271
    63         EQUATIONS
    64         "Vapourisation Fraction"
     72EQUATIONS
     73
     74"Vapourisation Fraction"
    6575        str.v = Inlet.v;
    6676
    67         "Inlet boundary"
     77"Inlet boundary"
    6878        str(1).F = Inlet.F;
    6979        str(1).T = Inlet.T;
     
    7181        str(1).z = Inlet.z;
    7282
    73         "Outlet boundary"
     83"Outlet boundary"
    7484        Outlet.F = str(NDisc+1).F;
    7585        Outlet.T = str(NDisc+1).T;
  • branches/newlanguage/sample/reactors/sample_pfr.mso

    r82 r170  
    3636
    3737FlowSheet PFR_AceticAnhydride
    38         PARAMETERS
    39         PP   as CalcObject(Brief="Physical Properties",File="vrpp");
    40         NComp as Integer;
     38       
     39PARAMETERS
    4140
    42         DEVICES
    43         s1   as streamTP;
     41        PP              as Plugin (Brief="Physical Properties",File="vrpp");
     42        NComp   as Integer;
     43
     44DEVICES
     45
     46        s1      as source;
    4447        Reac as pfr;
    4548
    46         SET
    47         PP.Components = ["acetone", "acetic anhydride", "methane" ];
    48         PP.LiquidModel = "PR";
    49         PP.VapourModel = "PR";
     49SET
     50
     51        PP.Components   = ["acetone", "acetic anhydride", "methane" ];
     52        PP.LiquidModel  = "PR";
     53        PP.VapourModel  = "PR";
    5054       
    5155        NComp = PP.NumberOfComponents;
    5256       
    53         Reac.NDisc = 10;
    54         Reac.Across = 0.7 * "in^2";
    55         Reac.L = 2.28 * "m";
    56         Reac.NReac = 1;
     57        Reac.NDisc      = 10;
     58        Reac.Across     = 0.7 * 'in^2';
     59        Reac.L                  = 2.28 * 'm';
     60        Reac.NReac      = 1;
    5761
    5862        # Reaction 1: A -> B + C
    5963        Reac.stoic(:,1) = [-1, 1, 1];
    6064       
    61         EQUATIONS
     65EQUATIONS
    6266
    63         for z in [1:Reac.NDisc]
    64                 "Reaction Rate = k*C(1)"
    65                 Reac.r(1,z)  = exp(34.34 - (34222 * "K") / Reac.str(z).T)*"1/s" * Reac.C(1,z);
     67for z in [1:Reac.NDisc]
     68       
     69"Reaction Rate = k*C(1)"
     70        Reac.r(1,z)  = exp(34.34 - (34222 * 'K') / Reac.str(z).T)*'1/s' * Reac.C(1,z);
    6671
    67                 "Heat of reaction"
    68                 Reac.Hr(1,z) = -80.77 * "kJ/mol";
     72"Heat of reaction"
     73        Reac.Hr(1,z) = -80.77 * 'kJ/mol';
    6974
    70                 "Pressure Drop (no pressure drop)"
    71                 Reac.str(z+1).P = Reac.str(z).P;
    72         end
     75"Pressure Drop (no pressure drop)"
     76        Reac.str(z+1).P = Reac.str(z).P;
    7377
    74         SPECIFY
    75         s1.F = 138/1000 * "kmol/h";
    76         s1.T = 1035 * "K";
    77         s1.P = 1.6  * "atm";
    78         s1.z = [1, 0, 0];
     78end
    7979
    80         "Adiabatic"
    81         Reac.q     = 0     * "J/s";
     80SPECIFY
     81        s1.Outlet.F = 138/1000 * 'kmol/h';
     82        s1.Outlet.T = 1035 * 'K';
     83        s1.Outlet.P = 1.6  * 'atm';
     84        s1.Outlet.z = [1, 0, 0];
     85
     86"Adiabatic"
     87        Reac.q     = 0     * 'J/s';
    8288       
    83         CONNECTIONS
    84         s1  to  Reac.Inlet;
     89CONNECTIONS
     90
     91        s1.Outlet  to  Reac.Inlet;
    8592       
    86         INITIAL
    87         for z in [2:Reac.NDisc+1]
    88                 Reac.str(z).T = Reac.Inlet.T;
    89                 Reac.str(z).z(1:NComp-1) = Reac.Inlet.z(1:NComp-1);
    90         end
     93INITIAL
     94
     95for z in [2:Reac.NDisc+1]
    9196       
    92         OPTIONS
     97        Reac.str(z).T = Reac.Inlet.T;
     98        Reac.str(z).z(1:NComp-1) = Reac.Inlet.z(1:NComp-1);
     99
     100end
     101       
     102OPTIONS
    93103        # This model can be solved in both steady or dynamic
    94         #mode = "steady";
    95         time = [0:0.05:3] * "s";
    96         NLASolver = "sundials";
     104        Dynamic         = true;
     105        TimeStep        = 0.05;
     106        TimeEnd         = 3;
     107        NLASolver       = "sundials";
    97108        #DAESolver = "dassl";
    98109end
Note: See TracChangeset for help on using the changeset viewer.