source: branches/gui/sample/miscellaneous/tenprobs/prob01.mso @ 697

Last change on this file since 697 was 228, checked in by Rodolfo Rodrigues, 16 years ago

Add more detailed header

File size: 4.5 KB
Line 
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* 1. Thermodynamic properties from van der Waals equation
17*----------------------------------------------------------------------
18*
19*   Description:
20*      This problem is part of a collection of 10 representative
21*       problems in Chemical Engineering for solution by numerical methods
22*       developed for Cutlip (1998).
23*
24*   Subject:
25*       * Introduction to Chemical Engineering
26*               * Thermodynamics
27*
28*       Concepts utilized:
29*               Use of the van der Waals equation of state to calculate molar
30*       volume and compressibility factor for a gas.
31*
32*       Numerical method:
33*               * Single nonlinear algebraic equation
34*
35*   Reference:
36*       * CUTLIP et al. A collection of 10 numerical problems in
37*       chemical engineering solved by various mathematical software
38*       packages. Comp. Appl. in Eng. Education. v. 6, 169-180, 1998.
39*       * More informations and a detailed description of all problems
40*       is available online in http://www.polymath-software.com/ASEE
41*
42*----------------------------------------------------------------------
43* Author: Rodolfo Rodrigues
44* GIMSCOP/UFRGS - Group of Integration, Modeling, Simulation,
45*                                       Control, and Optimization of Processes
46* $Id$
47*--------------------------------------------------------------------*#
48using "types";
49
50
51
52#*---------------------------------------------------------------------
53*       Equation of state
54*--------------------------------------------------------------------*#
55
56Model van_der_waals
57        PARAMETERS
58outer Pc                as pressure             (Brief="Critical pressure");
59outer Tc                as temperature  (Brief="Critical temperature");
60        R                       as Real                 (Brief="Gas constant", Default=0.08206, Unit='atm*l/mol/K');
61       
62       
63        VARIABLES
64        P                       as pressure             (Brief="Pressure");
65        V                       as volume_mol   (Brief="Molar volume", DisplayUnit='l/mol');
66        T                       as temperature  (Brief="Temperature");
67       
68        a                       as Real                 (Brief="Parameter a of van der Waals equation", Unit='atm*(l/mol)^2');
69        b                       as volume_mol   (Brief="Parameter b of van der Waals equation", DisplayUnit='l/mol');
70       
71       
72        EQUATIONS
73        "Van der Waals equation"
74        (P + a/V^2)*(V - b) = R*T;
75       
76        "Parameter a"
77        a = (27/64)*(R^2*Tc^2)/Pc;
78       
79        "Parameter b"
80        b = R*Tc/(8*Pc);
81end
82
83
84
85#*---------------------------------------------------------------------
86*       Thermodynamic properties calculation (question a)
87*--------------------------------------------------------------------*#
88
89FlowSheet properties
90        PARAMETERS
91        Pc                                      as pressure;
92        Tc                                      as temperature;
93       
94       
95        VARIABLES
96        equation_of_state       as van_der_waals;
97        Pr                                      as Real (Brief="Reduced pressure");
98        Z                                       as Real (Brief="Compressibility factor");
99       
100       
101        EQUATIONS
102        # Thermodynamic properties
103        "Reduced pressure"
104        Pr = equation_of_state.P/Pc;
105       
106        "Compressibility factor"
107        Z = equation_of_state.P*equation_of_state.V/(equation_of_state.R*equation_of_state.T);
108       
109       
110        SET
111        Pc = 111.3*'atm'; # for ammonia
112        Tc = 405.5*'K'; # for ammonia
113
114       
115        SPECIFY
116        equation_of_state.P = 56*'atm';
117        equation_of_state.T = 450*'K';
118       
119       
120        OPTIONS
121        Dynamic = false;
122end
123
124
125
126#*---------------------------------------------------------------------
127*       Variation of properties with Pr (question b and c)
128*--------------------------------------------------------------------*#
129
130FlowSheet variation_of_properties
131        PARAMETERS
132        Pc                                      as pressure;
133        Tc                                      as temperature;
134       
135       
136        VARIABLES
137        equation_of_state       as van_der_waals;
138        Pr                                      as Real (Brief="Reduced pressure");
139        Z                                       as Real (Brief="Compressibility factor");
140       
141       
142        EQUATIONS
143        "Change time in Pr"
144        Pr = time/'s';
145       
146        # Thermodynamic properties
147        "Reduced pressure"
148        Pr = equation_of_state.P/Pc;
149       
150        "Compressibility factor"
151        Z = equation_of_state.P*equation_of_state.V/(equation_of_state.R*equation_of_state.T);
152       
153       
154        SET
155        Pc = 111.3*'atm'; # for ammonia
156        Tc = 405.5*'K'; # for ammonia
157
158       
159        SPECIFY
160        equation_of_state.T = 450*'K';
161       
162       
163        OPTIONS
164        TimeStart = 1;
165        TimeStep = 0.5;
166        TimeEnd = 20;
167end
Note: See TracBrowser for help on using the repository browser.