Changeset 407 for trunk


Ignore:
Timestamp:
Nov 19, 2007, 11:52:18 AM (15 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Better naming conventions for gibbs simple examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sample/miscellaneous/sample_gibbs_reactor_simple.mso

    r402 r407  
    4343outer NComp     as Integer (Brief="Number of components", Default=1);
    4444
    45         stoic(NComp) as Real;
     45        nu(NComp) as Real;
    4646
    4747        R  as Real(Brief="Universal gas constant", Unit='J/mol/K', Default=8.314);
     
    5858        T as temperature;
    5959        P as pressure;
    60         ni(NComp) as positive(Brief="Initial number of mols", Unit='mol');
    61         n(NComp)  as positive(Brief="Number of mols at equilibrium", Unit='mol', Upper=10);
    62         advance   as Real(Unit='mol', Lower=-10, Upper=10);
    63 
    64         K  as Real(Brief="Reaction equilibrium constant at T");
    65         K0 as Real(Brief="Reaction equilibrium constant at T0");
    66         K1 as Real(Brief="Reaction equilibrium constant correction from T0 to T");
     60        n0(NComp) as positive(Brief="Initial number of mols", Unit='mol');
     61        n(NComp)  as positive(Brief="Number of mols at equilibrium", Unit='mol');
     62        advance   as Real(Unit='mol');
     63
     64        K  as positive(Brief="Reaction equilibrium constant at T");
     65        K0 as positive(Brief="Reaction equilibrium constant at T0");
    6766       
    6867        phi(NComp)      as fugacity(Brief="Fugacity coefficient", Default=1);
     
    7069        EQUATIONS
    7170        "Equilibrium constant at 298 K"
    72         K0 = exp(-sum(stoic*G0)/(R*T0));
    73         "Equilibrium constant temperature correction"
    74         K1 = exp(sum(stoic*H0)/(R*T0) * (1- T0/T));
     71        K0 = exp(-sum(nu*G0)/(R*T0));
    7572        "Equilibrium constant at T"
    76         K = K1*K0;
    77        
     73        K = K0 * exp(-sum(nu*H0)/R*(1/T - 1/T0));
     74
    7875        "Equilibrium rule"
    79         K = prod( (n/sum(n)*phi*P/P0) ^ stoic);
     76        K = prod( (n/sum(n)*phi*P/P0) ^ nu);
    8077
    8178        "Reaction advance"
    82         n = ni + stoic * advance;
     79        n = n0 + nu * advance;
    8380       
    8481        "Fugacity coefficient"
     
    9996        SET
    10097        NComp = PP.NumberOfComponents;
    101         stoic = [-1, 1, 1];
     98        nu = [-1, 1, 1];
    10299
    103100        SPECIFY
    104101        T = (1000 + 273.15) * 'K';
    105102        P = 1 * 'atm';
    106         ni = [1, 0, 0] * 'mol';
     103        n0 = [1, 0, 0] * 'mol';
    107104       
    108105        # Expected results:
     
    128125        SET
    129126        NComp = PP.NumberOfComponents;
    130         stoic = [-1, -1, 1];
     127        nu = [-1, -1, 1];
    131128
    132129        SPECIFY
    133130        T = (250 + 273.15) * 'K';
    134131        P = 35 * 'atm';
    135         ni = [1, 5, 0] * 'mol';
     132        n0 = [1, 5, 0] * 'mol';
    136133       
    137134        # Expected results:
     
    155152        SET
    156153        NComp = PP.NumberOfComponents;
    157         stoic = [-1, -1, 1, 1];
     154        nu = [-1, -1, 1, 1];
    158155
    159156        SPECIFY
    160157        T = 1100 * 'K';
    161158        P = 1 * 'bar';
    162         ni = [1, 1, 0, 0] * 'mol';
     159        n0 = [1, 1, 0, 0] * 'mol';
    163160       
    164161        # Expected results:
     
    183180        SET
    184181        NComp = PP.NumberOfComponents;
    185         stoic = [-1, -1, 1, 1];
     182        nu = [-1, -1, 1, 1];
    186183
    187184        SPECIFY
    188185        T = 1100 * 'K';
    189186        P = 1 * 'bar';
    190         ni = [1, 1, 0, 0] * 'mol';
     187        n0 = [1, 1, 0, 0] * 'mol';
    191188       
    192189        # Expected results:
     
    211208        SET
    212209        NComp = PP.NumberOfComponents;
    213         stoic = [-1, -1, 1, 1];
     210        nu = [-1, -1, 1, 1];
    214211
    215212        SPECIFY
    216213        T = 1100 * 'K';
    217214        P = 1 * 'bar';
    218         ni = [1, 2, 0, 0] * 'mol';
     215        n0 = [1, 2, 0, 0] * 'mol';
    219216       
    220217        # Expected results:
     
    238235        SET
    239236        NComp = PP.NumberOfComponents;
    240         stoic = [-1, -1, 2];
     237        nu = [-1, -1, 2];
    241238
    242239        SPECIFY
    243240        T = (500 + 273.15) * 'K';
    244241        P = 1 * 'bar';
    245         ni = [1, 3, 0] * 'mol';
     242        n0 = [1, 3, 0] * 'mol';
    246243       
    247244        # Expected results:
     
    265262        SET
    266263        NComp = PP.NumberOfComponents;
    267         stoic = [-1, -3, 2];
     264        nu = [-1, -3, 2];
    268265
    269266        SPECIFY
    270267        T = (500 + 273.15) * 'K';
    271268        P = 300 * 'bar';
    272         ni = [1, 3, 0] * 'mol';
     269        n0 = [1, 3, 0] * 'mol';
    273270       
    274271        # Expected results:
Note: See TracChangeset for help on using the changeset viewer.