/[ascend]/branches/jacob/models/johnpye/fprops/jacob_mix_test7--reverse-density.a4c
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/jacob_mix_test7--reverse-density.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, 3 months ago) by jacob
File MIME type: text/x-ascend
File size: 3003 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 (* ASCEND multi-component ideal-solution routine
2
3 To perform the simulation, load the file into ASCEND and run 'setup'.
4
5 This file finds pressure from density, the reverse of the usual
6 order. The pressure is found purely in ASCEND.
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; (* pressure calculated from density *)
20 rho IS_A mass_density; (* mixture density *)
21 rho_ph1, rho_ph2 IS_A mass_density; (* density of phases 1 and 2 *)
22 h IS_A specific_enthalpy; (* mixture enthalpy *)
23
24 (* -----------------------------------------------------------------
25 Declare variables to hold phase-accounting data *)
26 phases, (* number of phases *)
27 ph1, ph2 IS_A phase_count; (* phases 1 and 2 *)
28 ph_frac[1..3] IS_A mass_fraction; (* mass fraction of each phase *)
29
30 (* -----------------------------------------------------------------
31 Declare and specify a mixture with its composition *)
32 mixt IS_A mixture_spec;
33 mixt.npure :== 4;
34 mixt.components[1] :== 'ammonia';
35 mixt.components[2] :== 'cyclohexane';
36 mixt.components[3] :== 'water';
37 mixt.components[4] :== 'toluene';
38 mixt.eos :== 'pengrob';
39 mixt.xs[1] :== 0.30;
40 mixt.xs[2] :== 0.25;
41 mixt.xs[3] :== 0.35;
42 mixt.xs[4] :== 0.10;
43
44 (* -----------------------------------------------------------------
45 Find pressure from overall density, phase densities from pressure *)
46 mix_density : mixture_rho(
47 T, p : INPUT;
48 rho : OUTPUT;
49 mixt : DATA
50 );
51 mix_phase1_density : mixture_phase_rho(
52 T, p, ph1 : INPUT;
53 rho_ph1 : OUTPUT;
54 mixt : DATA
55 );
56 mix_phase2_density : mixture_phase_rho(
57 T, p, ph2 : INPUT;
58 rho_ph2 : OUTPUT;
59 mixt : DATA
60 );
61
62 (* -----------------------------------------------------------------
63 Find enthalpy from temperature *)
64 mix_temperature : mixture_h(
65 T, p : INPUT;
66 h : OUTPUT;
67 mixt : DATA
68 );
69
70 (* -----------------------------------------------------------------
71 Find number of phases, mass fractions of phases *)
72 mix_phases : mixture_count_phases(
73 T, p : INPUT;
74 phases, ph_frac[1], ph_frac[2], ph_frac[3] : OUTPUT;
75 mixt : DATA
76 );
77
78 METHODS
79 (* Fix the variables that are to be fixed *)
80 METHOD specify;
81 FIX T;
82 FIX rho;
83 FIX ph1;
84 FIX ph2;
85 END specify;
86 (* Set values of the fixed variables *)
87 METHOD values;
88 T := 510 {K};
89 rho := 2.055 {kg/m^3};
90 ph1 := 1;
91 ph2 := 2;
92 END values;
93 (* Set solver and other options *)
94 METHOD options;
95 SOLVER QRSlv;
96 OPTION convopt 'RELNOM_SCALE';
97 END options;
98 (* Quick alias for all preceeding methods; readies the model for solving *)
99 METHOD setup;
100 RUN specify;
101 RUN values;
102 RUN options;
103 END setup;
104 END mixture_test;

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