1 |
REQUIRE "atoms.a4l"; |
2 |
(* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
PROVIDE "sonic.a4c"; |
4 |
(* |
5 |
* This file is part of the ASCEND Modeling Library and is released |
6 |
* under the GNU Public License as described at the end of this file. |
7 |
* |
8 |
* Use of this module is demonstrated by the associated script file |
9 |
* sonic.a4s. |
10 |
*) |
11 |
|
12 |
(* |
13 |
Ascend model of the Adiabatic compressible flow example presented by |
14 |
Zaher -- Conditional Modeling. Ph.D. Thesis, Carnegie Mellon University, |
15 |
Pittsburgh, PA, 15213. 1995 --. The problem represents the flow of a |
16 |
compressible gas in a circular pipe of constant diameter. There is a |
17 |
disjunctive statement which represents whether the flow is sonic or |
18 |
subsonic. It represent a problem which we can represent as a conditional |
19 |
model and solve with the ascend conditional solver CMSlv. |
20 |
|
21 |
This model requires: |
22 |
"system.a4l" |
23 |
"atoms.a4l" |
24 |
*) |
25 |
|
26 |
(* ************************************************* *) |
27 |
|
28 |
MODEL sonic; |
29 |
|
30 |
Pi IS_A pressure; |
31 |
Pf IS_A pressure; |
32 |
Pd IS_A pressure; |
33 |
Ti IS_A temperature; |
34 |
Tf IS_A temperature; |
35 |
Mi IS_A fraction; |
36 |
Mf IS_A fraction; |
37 |
D IS_A distance; |
38 |
F IS_A molar_rate; |
39 |
friction IS_A factor; |
40 |
gamma IS_A factor; |
41 |
mw IS_A molar_mass; |
42 |
L IS_A distance; |
43 |
R IS_A gas_constant; |
44 |
Pifac IS_A factor; |
45 |
sonic_flow IS_A boolean_var; |
46 |
|
47 |
(* boundary *) |
48 |
CONDITIONAL |
49 |
cond: (Pd - Pf) * 1.0 {atm^-1} <= Mf - 1.0; |
50 |
END CONDITIONAL; |
51 |
|
52 |
sonic_flow == SATISFIED(cond,1e-08); |
53 |
|
54 |
(* Variant Equations *) |
55 |
|
56 |
not_sonic: Pf = Pd; |
57 |
sonic: Mf = 1.0; |
58 |
|
59 |
(* Disjunctive statement *) |
60 |
|
61 |
WHEN (sonic_flow) |
62 |
CASE TRUE: |
63 |
USE sonic; |
64 |
CASE FALSE: |
65 |
USE not_sonic; |
66 |
END WHEN; |
67 |
|
68 |
(* Invariant Equations *) |
69 |
|
70 |
R * F * Ti / Pi = Pifac * (D^2) * Mi/4.0 * (gamma * R *Ti/mw)^(1/2); |
71 |
R * F * Tf / Pf = Pifac * (D^2) * Mf/4.0 * (gamma * R *Tf/mw)^(1/2); |
72 |
Tf/Ti = (1 + 0.5*(gamma-1)*(Mi^2))/(1 + 0.5*(gamma-1)*(Mf^2)); |
73 |
|
74 |
1/(Mi^2) - 1/(Mf^2) - 4*gamma*friction*L/D = 0.5*(gamma+1)* |
75 |
ln( ((Mf^2)*(1 + 0.5*(gamma-1)*(Mi^2)))/ |
76 |
((Mi^2)*(1 + 0.5*(gamma-1)*(Mf^2))) ); |
77 |
|
78 |
METHODS |
79 |
|
80 |
METHOD default_self; |
81 |
END default_self; |
82 |
|
83 |
METHOD specify; |
84 |
friction.fixed := TRUE; |
85 |
gamma.fixed := TRUE; |
86 |
mw.fixed := TRUE; |
87 |
L.fixed := TRUE; |
88 |
Ti.fixed := TRUE; |
89 |
Pi.fixed := TRUE; |
90 |
Pd.fixed := TRUE; |
91 |
D.fixed := TRUE; |
92 |
Pifac.fixed := TRUE; |
93 |
END specify; |
94 |
|
95 |
METHOD values; |
96 |
(* fixed values*) |
97 |
friction := 0.01; |
98 |
gamma := 1.292; |
99 |
mw := 16 {g/g_mole}; |
100 |
L := 1 {m}; |
101 |
Ti := 300.0 {K}; |
102 |
Pi := 10.0 {atm}; |
103 |
Pd := 5.0 {atm}; |
104 |
D := 5.0 {cm}; (* boundary is 4.08844 {cm} *) |
105 |
Pifac := 3.14159; |
106 |
(* initial values *) |
107 |
Mi := 0.5; |
108 |
Mf := 0.5; |
109 |
Tf := 300.0 {K}; |
110 |
Pf := 5.0 {atm}; |
111 |
F := 200.0 {g_mole/s}; |
112 |
|
113 |
(* initial boolean value *) |
114 |
sonic_flow := SATISFIED(cond,1e-08); |
115 |
END values; |
116 |
|
117 |
END sonic; |
118 |
|
119 |
|
120 |
(* |
121 |
* sonic.a4c |
122 |
* by Vicente Rico-Ramirez |
123 |
* April 10, 1998 |
124 |
* Part of the ASCEND Library |
125 |
* $Date: 1998/06/17 19:15:06 $ |
126 |
* $Revision: 1.3 $ |
127 |
* $Author: mthomas $ |
128 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/sonic.a4c,v $ |
129 |
* |
130 |
* This file is part of the ASCEND Modeling Library. |
131 |
* |
132 |
* Copyright (C) 1998 Carnegie Mellon University |
133 |
* |
134 |
* The ASCEND Modeling Library is free software; you can redistribute |
135 |
* it and/or modify it under the terms of the GNU General Public |
136 |
* License as published by the Free Software Foundation; either |
137 |
* version 2 of the License, or (at your option) any later version. |
138 |
* |
139 |
* The ASCEND Modeling Library is distributed in hope that it will be |
140 |
* useful, but WITHOUT ANY WARRANTY; without even the implied |
141 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
142 |
* See the GNU General Public License for more details. |
143 |
* |
144 |
* You should have received a copy of the GNU General Public License |
145 |
* along with the program; if not, write to the Free Software |
146 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
147 |
* the file named COPYING. |
148 |
*) |