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

Contents of /branches/jacob/models/johnpye/fprops/mix_test/jacob_mix_test4--bubble-dew2.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, 11 months ago) by jacob
File MIME type: text/x-ascend
File size: 3201 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 performs further dew-point calculations, with the goal of
6 confirming that a user can simply set the temperature equal to the
7 dew or bubble temperature, and find other properties normally.
8
9 Since temperature is set at the dew temperature, there should be no
10 liquid, or only a negligible amount.
11 *)
12
13 REQUIRE "atoms.a4l";
14 REQUIRE "johnpye/thermo_types.a4c";
15 IMPORT "johnpye/fprops/mixture";
16 REQUIRE "johnpye/fprops/mixtures.a4l";
17
18 (* The mixture_test model *)
19 MODEL mixture_test;
20 (* Declare variables to hold various mixture properties *)
21 T IS_A temperature; (* mixture (dew) temperature *)
22 p IS_A pressure; (* mixture pressure; with 'T' this sets the state *)
23 rho IS_A mass_density; (* mixture density *)
24 u, (* mixture internal energy *)
25 u_ph1 IS_A specific_energy; (* phase 1 internal energy *)
26 h IS_A specific_enthalpy; (* mixture enthalpy *)
27 s IS_A specific_entropy; (* mixture entropy *)
28
29 (* Declare variables to hold phase-accounting data *)
30 nphase, (* number of phases *)
31 ph IS_A phase_count; (* first phase *)
32 phase_frac[1..3] IS_A mass_fraction; (* mass fraction of each phase *)
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_temperature : mixture_dew_T(
50 p : INPUT;
51 T : OUTPUT;
52 mixt : DATA
53 );
54 mix_phase_data : mixture_flash_phases(
55 T, p : INPUT;
56 nphase, phase_frac[1], phase_frac[2], phase_frac[3] : OUTPUT;
57 mixt : DATA
58 );
59
60 (* -----------------------------------------------------------------
61 Calculate density at several conditions *)
62 mix_density : mixture_rho(
63 T, p : INPUT;
64 rho : OUTPUT;
65 mixt : DATA
66 );
67
68 (* -----------------------------------------------------------------
69 Calculate internal energy for whole mixture and one phase, and other
70 properties for the whole mixture.
71 *)
72 mix_u : mixture_u(
73 T, p : INPUT;
74 u : OUTPUT;
75 mixt : DATA
76 );
77 mix_phase_u : mixture_phase_u(
78 T, p, ph : INPUT;
79 u_ph1 : OUTPUT;
80 mixt : DATA
81 );
82 mix_h : mixture_h(
83 T, p : INPUT;
84 h : OUTPUT;
85 mixt : DATA
86 );
87 mix_s : mixture_s(
88 T, p : INPUT;
89 s : OUTPUT;
90 mixt : DATA
91 );
92
93 METHODS
94 (* Fix the variables that are to be fixed *)
95 METHOD specify;
96 FIX p;
97 FIX ph;
98 END specify;
99 (* Set values of the fixed variables *)
100 METHOD values;
101 p := 2 {bar};
102 ph := 1;
103 END values;
104 (* Set solver and other options *)
105 METHOD options;
106 SOLVER QRSlv;
107 OPTION convopt 'RELNOM_SCALE';
108 END options;
109 (* Quick alias for all preceeding methods; readies the model for solving *)
110 METHOD setup;
111 RUN specify;
112 RUN values;
113 RUN options;
114 END setup;
115 END mixture_test;

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