/[ascend]/branches/jacob/models/johnpye/fprops/mix_test/jacob_mix_test4--phases.a4c
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/mix_test/jacob_mix_test4--phases.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, 10 months ago) by jacob
File MIME type: text/x-ascend
File size: 3565 byte(s)
remove some obsolete functions, and move test functions
1 (* ASCEND multi-component ideal-solution routine
2
3 To perform the simulation, load the file into ASCEND and run 'setup'.
4
5 This file tests the functions that calculate properties for
6 individual phases within the solution.
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 (* Declare variables to hold various mixture properties *)
17 T IS_A temperature; (* mixture temperature *)
18 p IS_A pressure; (* mixture pressure; with 'T' this sets the state *)
19 rho IS_A mass_density; (* mixture density *)
20 u_ph1 IS_A specific_energy; (* phase 1 internal energy *)
21 h_ph1 IS_A specific_enthalpy; (* phase 1 enthalpy *)
22 cp_ph1 IS_A heat_capacity; (* phase 1 heat capacity (isobaric) *)
23 cv_ph1 IS_A heat_capacity; (* phase 1 heat capacity (isometric) *)
24 s_ph1 IS_A specific_entropy; (* phase 1 entropy *)
25 g_ph1 IS_A specific_secondary_energy; (* phase 1 Gibbs energy *)
26 a_ph1 IS_A specific_secondary_energy; (* phase 1 Helmholtz energy *)
27
28 (* Declare variables to hold phase-accounting data *)
29 nphase, (* number of phases *)
30 ph IS_A phase_count; (* first phase *)
31 phase_frac[1..3] IS_A mass_fraction; (* mass fraction of each phase *)
32
33 (* Declare and specify a mixture with its composition *)
34 mixt IS_A mixture_spec;
35 mixt.npure :== 3;
36 mixt.components[1] :== 'ammonia';
37 mixt.components[2] :== 'carbondioxide';
38 mixt.components[3] :== 'cyclohexane';
39 mixt.eos :== 'pengrob';
40 mixt.xs[1] :== 0.4;
41 mixt.xs[2] :== 0.35;
42 mixt.xs[3] :== 0.25;
43
44 (* -----------------------------------------------------------------
45 Find the number of phases and phase mass fractions in the mixture *)
46 mix_phase_data : mixture_flash_phases(
47 T, p : INPUT;
48 nphase, phase_frac[1], phase_frac[2], phase_frac[3] : OUTPUT;
49 mixt : DATA
50 );
51
52 (* -----------------------------------------------------------------
53 Find the whole-mixture mass density *)
54 mix_density : mixture_rho(
55 T, p : INPUT;
56 rho : OUTPUT;
57 mixt : DATA
58 );
59
60 (* -----------------------------------------------------------------
61 Find first-law by-phase properties *)
62 mix_phase_u : mixture_phase_u(
63 T, p, ph : INPUT;
64 u_ph1 : OUTPUT;
65 mixt : DATA
66 );
67 mix_phase_h : mixture_phase_h(
68 T, p, ph : INPUT;
69 h_ph1 : OUTPUT;
70 mixt : DATA
71 );
72 mix_phase_cv : mixture_phase_cv(
73 T, p, ph : INPUT;
74 cv_ph1 : OUTPUT;
75 mixt : DATA
76 );
77 mix_phase_cp : mixture_phase_cp(
78 T, p, ph : INPUT;
79 cp_ph1 : OUTPUT;
80 mixt : DATA
81 );
82
83 (* -----------------------------------------------------------------
84 Find second-law by-phase properties *)
85 mix_phase_s : mixture_phase_s(
86 T, p, ph : INPUT;
87 s_ph1 : OUTPUT;
88 mixt : DATA
89 );
90 mix_phase_g : mixture_phase_g(
91 T, p, ph : INPUT;
92 g_ph1 : OUTPUT;
93 mixt : DATA
94 );
95 mix_phase_a : mixture_phase_a(
96 T, p, ph : INPUT;
97 a_ph1 : OUTPUT;
98 mixt : DATA
99 );
100
101 METHODS
102 (* Fix the variables that are to be fixed *)
103 METHOD specify;
104 FIX T;
105 FIX p;
106 FIX ph;
107 END specify;
108 (* Set values of the fixed variables *)
109 METHOD values;
110 T := 300 {K} + 273.15 {K};
111 p := 2 {bar};
112 ph := 1;
113 END values;
114 (* Set solver and other options *)
115 METHOD options;
116 SOLVER QRSlv;
117 OPTION convopt 'RELNOM_SCALE';
118 END options;
119 (* Quick alias for all preceeding methods; readies the model for solving *)
120 METHOD setup;
121 RUN specify;
122 RUN values;
123 RUN options;
124 END setup;
125 END mixture_test;

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