/[ascend]/branches/jacob/models/johnpye/fprops/mix_test/jacob_mix_test2--whole-mix2.a4c
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/mix_test/jacob_mix_test2--whole-mix2.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3085 - (show annotations) (download) (as text)
Fri Aug 21 19:00:30 2015 UTC (3 years, 9 months ago) by jacob
File MIME type: text/x-ascend
File size: 3916 byte(s)
remove some obsolete functions, and move test functions
1 (* Outline of ASCEND multi-component ideal-solution routine
2
3 To perform the simulation, load the file into ASCEND and run 'setup'.
4
5 This file performs more testing on whole-component properties, and
6 also calculates the mixture bubble pressure.
7 *)
8
9 REQUIRE "atoms.a4l";
10 REQUIRE "johnpye/thermo_types.a4c";
11 IMPORT "johnpye/fprops/mixture";
12 REQUIRE "johnpye/fprops/mixtures.a4l";
13
14 (* The mixture_test model *)
15 MODEL mixture_test;
16 (* -----------------------------------------------------------------
17 Declare variables to hold various mixture properties *)
18 T IS_A temperature; (* mixture temperature *)
19 p IS_A pressure; (* mixture pressure; with 'T' this sets the state*)
20 rho, (* mixture density *)
21 phase_rho[1..3] IS_A mass_density; (* mass density of each phase *)
22 u, (* mixture internal energy *)
23 u_ph1 IS_A specific_energy; (* phase 1 internal energy *)
24 h IS_A specific_enthalpy; (* mixture enthalpy *)
25 s IS_A specific_entropy; (* mixture entropy *)
26 g IS_A specific_secondary_energy; (* mixture Gibbs energy *)
27 a IS_A specific_secondary_energy; (* mixture Helmholtz energy *)
28 p_bubble IS_A pressure; (* mixture bubble pressure *)
29
30 (* -----------------------------------------------------------------
31 Declare variables to hold phase-accounting data *)
32 nphase, (* number of phases *)
33 ph IS_A phase_count; (* first phase *)
34 phase_frac[1..3] IS_A mass_fraction; (* mass fraction of each phase *)
35
36 (* -----------------------------------------------------------------
37 Declare and specify a mixture with its composition *)
38 mixt IS_A mixture_spec;
39 mixt.npure :== 3;
40 mixt.components[1] :== 'ammonia';
41 mixt.components[2] :== 'carbondioxide';
42 mixt.components[3] :== 'cyclohexane';
43 mixt.eos :== 'pengrob';
44 mixt.xs[1] :== 0.4;
45 mixt.xs[2] :== 0.35;
46 mixt.xs[3] :== 0.25;
47
48
49 (* -----------------------------------------------------------------
50 Find the whole-mixture mass density *)
51 mix_density : mixture_rho(
52 T, p : INPUT;
53 rho : OUTPUT;
54 mixt : DATA
55 );
56
57 (* -----------------------------------------------------------------
58 Find the number of phases and phase mass fractions in the mixture *)
59 mix_phase_data : mixture_flash_phases(
60 T, p : INPUT;
61 nphase, phase_frac[1], phase_frac[2], phase_frac[3] : OUTPUT;
62 mixt : DATA
63 );
64
65 (* -----------------------------------------------------------------
66 Find the first-law properties: overall and by-phase internal
67 energy, overall enthalpy *)
68 mix_u : mixture_u(
69 T, p : INPUT;
70 u : OUTPUT;
71 mixt : DATA
72 );
73 mix_phase_u : mixture_phase_u(
74 T, p, ph : INPUT;
75 u_ph1 : OUTPUT;
76 mixt : DATA
77 );
78 mix_h : mixture_h(
79 T, p : INPUT;
80 h : OUTPUT;
81 mixt : DATA
82 );
83
84 (* -----------------------------------------------------------------
85 Find second-law properties: overall entropy, Gibbs energy, and
86 Helmholtz energy *)
87 mix_s : mixture_s(
88 T, p : INPUT;
89 s : OUTPUT;
90 mixt : DATA
91 );
92 mix_g : mixture_g(
93 T, p : INPUT;
94 g : OUTPUT;
95 mixt : DATA
96 );
97 mix_a : mixture_a(
98 T, p : INPUT;
99 a : OUTPUT;
100 mixt : DATA
101 );
102
103 (* -----------------------------------------------------------------
104 Find the mixture bubble pressure *)
105 mix_bubble_p : mixture_bubble_p(
106 T : INPUT;
107 p_bubble : OUTPUT;
108 mixt : DATA
109 );
110
111 METHODS
112 (* Fix the variables that are to be fixed *)
113 METHOD specify;
114 FIX T;
115 FIX p;
116 FIX ph;
117 END specify;
118 (* Set values of the fixed variables *)
119 METHOD values;
120 T := 300 {K} + 273.15 {K};
121 p := 2 {bar};
122 ph := 1;
123 END values;
124 (* Set solver and other options *)
125 METHOD options;
126 SOLVER QRSlv;
127 OPTION convopt 'RELNOM_SCALE';
128 END options;
129 (* Quick alias for all preceeding methods; readies the model for solving *)
130 METHOD setup;
131 RUN specify;
132 RUN values;
133 RUN options;
134 END setup;
135 END mixture_test;

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