/[ascend]/trunk/models/steam/thermalequilibrium3.a4c
ViewVC logotype

Contents of /trunk/models/steam/thermalequilibrium3.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1042 - (show annotations) (download) (as text)
Fri Jan 5 04:53:38 2007 UTC (15 years, 11 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1630 byte(s)
Added saturated steam routines (taked from IAPWS 'supsat.pdf')
Added test case TestSteam for evaluating iapwssatprops.a4c documented test cases.
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "johnpye/thermo_types.a4c";
3 REQUIRE "johnpye/steam/iapwssat.a4c";
4
5 IMPORT "johnpye/extpy/extpy";
6 IMPORT "johnpye/listnotes";
7 IMPORT "johnpye/solve";
8
9 (*
10 Enhanced version of johnpye/thermalequilibrium.a4c. This model uses
11 real steam properties from http://freesteam.sf.net/.
12
13 NOTE: set the starting step to 0.1 and the minimum step to 0.01 s, and
14 integrate from 0 to 3000 s.
15 *)
16 ADD NOTES IN thermalequilibrium3;
17 'solver' name {QRSlv}
18 'QRSlv' iterationlimit {50}
19 'QRSlv' singtol {1e-10}
20 (* following are not implemented yet *)
21 'LSODE' minstep {0.01}
22 'LSODE' firststep {0.1}
23 'LSODE' duration {3000}
24 END NOTES;
25
26 MODEL thermalequilibrium3;
27 S[1..2] IS_A iapwssat;
28 m[1..2] IS_A mass;
29 h IS_A heat_transfer_coefficient;
30 A IS_A area;
31
32 p ALIASES S[1].p;
33 S[2].p = S[1].p;
34
35 Q IS_A energy_rate;
36 Q = h*A*(S[1].T - S[2].T); (* rate of heat transfer from 1 to 2 *)
37 m[1]*dhdt[1] = -Q;
38 m[2]*dhdt[2] = +Q;
39
40 dhdt[1..2] IS_A delta_specific_power;
41
42 t IS_A time;
43 METHODS
44 METHOD specify;
45 FIX h, A, m[1..2], S[1..2].h, p;
46 END specify;
47 METHOD values;
48 A := 1 {m^2};
49 h := 10 {W/m^2/K};
50
51 p := 1 {bar};
52
53 m[1] := 2 {kg};
54 S[1].h := 1000 {kJ/kg};
55 m[2] := 10 {kg};
56 S[2].h := 2000 {kJ/kg};
57 END values;
58 METHOD ode_init;
59 FOR i IN [1..2] DO
60 S[i].h.ode_id := i;
61 dhdt[i].ode_id := i;
62 S[i].h.ode_type := 1;
63 dhdt[i].ode_type := 2;
64 END FOR;
65
66 Q.obs_id := 2;
67 S[1].h.obs_id := 3;
68 S[2].h.obs_id := 4;
69
70 t.ode_type := -1;
71 t := 0 {s};
72 END ode_init;
73 METHOD on_load;
74 RUN reset;
75 RUN values;
76 EXTERNAL setup_solver(SELF);
77 EXTERNAL solve(SELF);
78 RUN ode_init;
79 END on_load;
80
81 END thermalequilibrium3;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22