/[ascend]/branches/jacob/models/johnpye/fprops/jacob_mix_test1--whole-mix1.a4c
ViewVC logotype

Annotation of /branches/jacob/models/johnpye/fprops/jacob_mix_test1--whole-mix1.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3079 - (hide annotations) (download) (as text)
Thu Aug 20 02:17:28 2015 UTC (3 years, 10 months ago) by jacob
File MIME type: text/x-ascend
File size: 3823 byte(s)
Review format of comments used to create doxygen documentaion.  Begin ammending erroneous formatting in previously written doxygen comments in the mixture code.

Added further commentary and documentation to .a4c test files

1 jacob 3079 (* ASCEND multi-component ideal-solution routine
2 jacob 2980
3 jacob 3079 To perform the simulation, load the file into ASCEND and run 'setup'.
4    
5     This file performs a general test of (mostly) whole-mixture
6     properties as calculated with the ideal-solution functions.
7     *)
8    
9 jacob 2980 REQUIRE "atoms.a4l";
10     REQUIRE "johnpye/thermo_types.a4c";
11 jacob 2988 IMPORT "johnpye/fprops/mixture";
12 jacob 3049 REQUIRE "johnpye/fprops/mixtures.a4l";
13 jacob 2980
14 jacob 3079 (* ---------------------------------------------------------------------
15     The mixture_test model *)
16 jacob 3058 MODEL mixture_test;
17 jacob 3079 (* 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 jacob 2980
29 jacob 3079 (* Declare variables to hold phase-accounting data *)
30     nphase, (* number of phases *)
31     ph, (* first phase *)
32     num_comps IS_A phase_count; (* mass fraction of each phase *)
33     phase_frac[1..3] IS_A mass_fraction; (* mass fraction of each phase *)
34 jacob 3058
35 jacob 3079 (* Declare and specify a mixture with its composition *)
36 jacob 2988 mixt IS_A mixture_spec;
37     mixt.npure :== 3;
38     mixt.components[1] :== 'ammonia';
39     mixt.components[2] :== 'carbondioxide';
40     mixt.components[3] :== 'cyclohexane';
41 jacob 3034 mixt.eos :== 'pengrob';
42 jacob 3040 mixt.xs[1] :== 0.4;
43     mixt.xs[2] :== 0.35;
44     mixt.xs[3] :== 0.25;
45 jacob 2980
46 jacob 3079 (* -----------------------------------------------------------------
47     Find the number of phases and phase mass fractions in the mixture *)
48     mix_phase_data : mixture_flash_phases(
49     T, p : INPUT;
50     nphase, phase_frac[1], phase_frac[2], phase_frac[3] : OUTPUT;
51     mixt : DATA
52     );
53 jacob 3062
54 jacob 3079 (* -----------------------------------------------------------------
55     Find the number of components in the first phase *)
56 jacob 3058 mix_phase_components : mixture_phase_components(
57 jacob 3079 T, p, ph : INPUT;
58 jacob 3058 num_comps : OUTPUT;
59     mixt : DATA
60 jacob 3062 );
61 jacob 3049
62 jacob 3079 (* -----------------------------------------------------------------
63     Find the whole-mixture mass density *)
64 jacob 2980 mix_density : mixture_rho(
65     T, p : INPUT;
66     rho : OUTPUT;
67 jacob 2988 mixt : DATA
68     );
69 jacob 2980
70 jacob 3079 (* -----------------------------------------------------------------
71     Find the first-law properties: overall and by-phase internal
72     energy, overall enthalpy *)
73 jacob 3053 mix_u : mixture_u(
74     T, p : INPUT;
75     u : OUTPUT;
76     mixt : DATA
77     );
78 jacob 3058 mix_phase_u : mixture_phase_u(
79 jacob 3079 T, p, ph : INPUT;
80 jacob 3058 u_ph1 : OUTPUT;
81     mixt : DATA
82     );
83 jacob 3062 mix_h : mixture_h(
84 jacob 3053 T, p : INPUT;
85     h : OUTPUT;
86     mixt : DATA
87     );
88    
89 jacob 3079 (* -----------------------------------------------------------------
90     Find second-law properties: overall entropy, Gibbs energy, and
91     Helmholtz energy *)
92 jacob 3053 mix_s : mixture_s(
93     T, p : INPUT;
94     s : OUTPUT;
95     mixt : DATA
96     );
97     mix_g : mixture_g(
98     T, p : INPUT;
99     g : OUTPUT;
100     mixt : DATA
101     );
102     mix_a : mixture_a(
103     T, p : INPUT;
104     a : OUTPUT;
105     mixt : DATA
106     );
107 jacob 3061
108 jacob 2980 METHODS
109 jacob 3079 (* Fix the variables that are to be fixed *)
110 jacob 3053 METHOD specify;
111 jacob 2988 FIX T;
112     FIX p;
113 jacob 3079 FIX ph;
114 jacob 2988 END specify;
115 jacob 3079 (* Set values of the fixed variables *)
116 jacob 3053 METHOD values;
117 jacob 2988 T := 300 {K} + 273.15 {K};
118     p := 2 {bar};
119 jacob 3079 ph := 1;
120 jacob 2988 END values;
121 jacob 3079 (* Set solver and other options *)
122 jacob 3053 METHOD options;
123 jacob 2988 SOLVER QRSlv;
124     OPTION convopt 'RELNOM_SCALE';
125     END options;
126 jacob 3079 (* Quick alias for all preceeding methods; readies the model for solving *)
127 jacob 3053 METHOD setup;
128 jacob 2988 RUN specify;
129     RUN values;
130     RUN options;
131     END setup;
132 jacob 3053 END mixture_test;
133 jacob 3058

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