/[ascend]/branches/jacob/models/johnpye/fprops/jacob_mix_test3--bubble-dew.a4c
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/jacob_mix_test3--bubble-dew.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3079 - (show annotations) (download) (as text)
Thu Aug 20 02:17:28 2015 UTC (3 years, 8 months ago) by jacob
File MIME type: text/x-ascend
File size: 3403 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 (* Outline of ASCEND multi-component ideal-solution routine
2
3 To perform the simulation, load the file into ASCEND and run 'setup'.
4 *)
5
6 REQUIRE "atoms.a4l";
7 REQUIRE "johnpye/thermo_types.a4c";
8 IMPORT "johnpye/fprops/mixture";
9 REQUIRE "johnpye/fprops/mixtures.a4l";
10
11 (* ---------------------------------------------------------------------
12 The mixture_test model *)
13 MODEL mixture_test;
14 (* -----------------------------------------------------------------
15 Declare variables to hold various mixture properties *)
16 T, (* fixed mixture temperature *)
17 T_bubble, (* mixture bubble temperature at p *)
18 T_dew IS_A temperature; (* mixture dew temperature at p *)
19
20 p, (* fixed mixture pressure *)
21 p_bubble, (* mixture bubble pressure at T *)
22 p_dew IS_A pressure; (* mixture dew pressure at T *)
23
24 rho, (* mixture density at fixed (T,p) *)
25 rho_dewT, (* mixture density at (T_dew,p) *)
26 rho_bubbleP IS_A mass_density; (* mixture density at (T,p_bubble) *)
27
28 u, (* mixture enthalpy at (T,p) *)
29 u_ph1 IS_A specific_energy; (* phase 1 enthalpy *)
30
31 ph IS_A phase_count; (* number of phase 1 *)
32
33 (* -----------------------------------------------------------------
34 Declare and specify a mixture with its composition *)
35 mixt IS_A mixture_spec;
36 mixt.npure :== 4;
37 mixt.components[1] :== 'ammonia';
38 mixt.components[2] :== 'carbonmonoxide';
39 mixt.components[3] :== 'cyclohexane';
40 mixt.components[4] :== 'benzene';
41 mixt.eos :== 'pengrob';
42 mixt.xs[1] :== 0.3;
43 mixt.xs[2] :== 0.35;
44 mixt.xs[3] :== 0.20;
45 mixt.xs[4] :== 0.15;
46
47 (* -----------------------------------------------------------------
48 Calculate bubble, dew temperatures and pressures *)
49 mix_bubble_temperature : mixture_bubble_T(
50 p : INPUT;
51 T_bubble : OUTPUT;
52 mixt : DATA
53 );
54 mix_dew_temperature : mixture_dew_T(
55 p : INPUT;
56 T_dew : OUTPUT;
57 mixt : DATA
58 );
59 mix_bubble_pressure : mixture_bubble_p(
60 T : INPUT;
61 p_bubble : OUTPUT;
62 mixt : DATA
63 );
64 mix_dew_pressure : mixture_dew_p(
65 T : INPUT;
66 p_dew : OUTPUT;
67 mixt : DATA
68 );
69
70 (* -----------------------------------------------------------------
71 Calculate density at several conditions *)
72 mix_density : mixture_rho(
73 T, p : INPUT;
74 rho : OUTPUT;
75 mixt : DATA
76 );
77 mix_density_dew_T : mixture_rho(
78 T_dew, p : INPUT;
79 rho_dewT : OUTPUT;
80 mixt : DATA
81 );
82 mix_density_bubble_p : mixture_rho(
83 T, p_bubble : INPUT;
84 rho_bubbleP : OUTPUT;
85 mixt : DATA
86 );
87
88 (* -----------------------------------------------------------------
89 Calculate internal energy for whole mixture, one phase *)
90 mix_u : mixture_u(
91 T, p : INPUT;
92 u : OUTPUT;
93 mixt : DATA
94 );
95 mix_phase_u : mixture_phase_u(
96 T, p, ph : INPUT;
97 u_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 := 100 {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