/[ascend]/branches/jacob/models/johnpye/fprops/mixtures.a4l
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/mixtures.a4l

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: 3289 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 REQUIRE "atoms.a4l";
2 REQUIRE "johnpye/thermo_types.a4c";
3 PROVIDE "mixtures.a4l";
4 (*
5 mixtures.a4l, by Jacob Shealy, August 4-August 17, 2015
6
7 Basic types used for mixtures.
8 *)
9
10 (* A constant to represent mass fractions; this cannot be restricted in
11 its range, like the type 'mass_fraction' in atoms.a4l, but at least
12 provides a dedicated type.
13 *)
14 CONSTANT mass_fraction_constant REFINES real_constant DIMENSIONLESS;
15
16 ATOM phase_count REFINES solver_var
17 DIMENSIONLESS
18 DEFAULT 1.0;
19 lower_bound := 0.0;
20 nominal := 1.0;
21 END phase_count;
22
23 (* Specific energy for properties governed by the Second Law of Thermodynamics
24 -- Gibbs energy and Helmholtz energy. These are typically negative, so the
25 'specific_energy' atom from <models/johnpye/thermo_types.a4c> (which can
26 only take positive values) cannot be used. Instead, use this atom, which
27 takes either negative or positive values.
28 *)
29 ATOM specific_secondary_energy REFINES solver_var
30 DIMENSION L^2/T^2
31 DEFAULT -1000{kJ/kg};
32 lower_bound := -1e50{kJ/kg};
33 upper_bound := 1e50{kJ/kg};
34 nominal := 1000{kJ/kg};
35 END specific_secondary_energy;
36
37
38 (* The mixture_spec model specifies the composition of the mixture.
39
40 An instantiation of this model will be passed into the mixture
41 functions as DATA, and must be provided with the following members:
42 npure, an integer
43 components, an array of symbol constants representing the fluids
44 xs, an array of mass fractions
45
46 The following members are optional:
47 eos, a symbol_constant representing the equation of state
48 'ideal' -- ideal-gas
49 'pengrob' -- Peng-Robinson
50 'helmholtz' -- Helmholtz equation of state
51 For now, 'eos' only gives good results when 'pengrob' is used
52
53 source, the source of the correlation type
54 model, a symbol_constant specifying whether the solution is ideal or real
55 *)
56 MODEL mixture_spec;
57 npure IS_A integer_constant; (* number of pures in the mixture *)
58
59 components[1 .. npure] IS_A symbol_constant; (* component names *)
60 xs[1 .. npure] IS_A mass_fraction_constant; (* component mass fractions *)
61 eos IS_A symbol_constant; (* equation of state to model the mixture *)
62 source IS_A symbol_constant; (* source of correlation data (optional) *)
63
64 source :== '';
65 END mixture_spec;
66
67
68 (* The mixture_component model holds data on a single component from a mixture
69 specified in a mixture_spec model.
70 *)
71 MODEL mixture_component(
72 component WILL_BE phase_count; (* index of the component within 'mixt' *)
73 mixt WILL_BE mixture_spec; (* specification of the mixture *)
74 T WILL_BE temperature; (* mixture temperature *)
75 p WILL_BE pressure; (* mixture pressure *)
76 );
77 phases,
78 ph_num[1..3],
79 ph_comps[1..3] IS_A phase_count;
80 (* comp_num[1..3] IS_A phase_count; *)
81 ph_frac[1..3] IS_A mass_fraction;
82
83 mix_phases : mixture_count_phases(
84 T, p : INPUT;
85 phases, ph_frac[1], ph_frac[2], ph_frac[3] : OUTPUT;
86 mixt : DATA
87 );
88
89 FOR i IN [1..3] CREATE
90 mix_phase_comps : mixture_count_components(
91 T, p, ph_num[i] : INPUT;
92 ph_comps[i] : OUTPUT;
93 mixt : DATA
94 );
95 END FOR;
96
97 METHODS
98 METHOD default_self;
99 FIX ph_num[1];
100 FIX ph_num[2];
101 FIX ph_num[3];
102 ph_num[1] := 1.0;
103 ph_num[2] := 2.0;
104 ph_num[3] := 3.0;
105 END default_self;
106 END mixture_component;

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