# Diff of /branches/jacob/models/johnpye/fprops/mixtures.a4l

revision 3078 by jacob, Mon Aug 17 22:02:06 2015 UTC revision 3079 by jacob, Thu Aug 20 02:17:28 2015 UTC
# Line 23  END phase_count; Line 23  END phase_count;
23  (*  Specific energy for properties governed by the Second Law of Thermodynamics  (*  Specific energy for properties governed by the Second Law of Thermodynamics
24      -- Gibbs energy and Helmholtz energy.  These are typically negative, so the      -- Gibbs energy and Helmholtz energy.  These are typically negative, so the
25      'specific_energy' atom from <models/johnpye/thermo_types.a4c> (which can      'specific_energy' atom from <models/johnpye/thermo_types.a4c> (which can
26      only take positive values) cannot be used.  Instead, use this atom,      only take positive values) cannot be used.  Instead, use this atom, which
27      which can assume either negative or positive values.      takes either negative or positive values.
28   *)   *)
29  ATOM specific_secondary_energy REFINES solver_var  ATOM specific_secondary_energy REFINES solver_var
30          DIMENSION L^2/T^2          DIMENSION L^2/T^2
# Line 34  ATOM specific_secondary_energy REFINES s Line 34  ATOM specific_secondary_energy REFINES s
34      nominal := 1000{kJ/kg};      nominal := 1000{kJ/kg};
35  END specific_secondary_energy;  END specific_secondary_energy;
36
37
38  (*  The mixture_spec model specifies the composition of the mixture.    (*  The mixture_spec model specifies the composition of the mixture.
39
40      An instantiation of this model will be passed into the mixture      An instantiation of this model will be passed into the mixture
# Line 51  END specific_secondary_energy; Line 52  END specific_secondary_energy;
52
53          source, the source of the correlation type          source, the source of the correlation type
54          model, a symbol_constant specifying whether the solution is ideal or real          model, a symbol_constant specifying whether the solution is ideal or real
55  *)   *)
56  MODEL mixture_spec;  MODEL mixture_spec;
57      npure IS_A integer_constant;      npure IS_A integer_constant;                 (* number of pures in the mixture *)
58
59      components[1 .. npure] IS_A symbol_constant;      components[1 .. npure] IS_A symbol_constant; (* component names *)
60      xs[1 .. npure] IS_A mass_fraction_constant;      xs[1 .. npure] IS_A mass_fraction_constant;  (* component mass fractions *)
61      eos IS_A symbol_constant;      eos IS_A symbol_constant;                    (* equation of state to model the mixture *)
62      source IS_A symbol_constant;      source IS_A symbol_constant;                 (* source of correlation data (optional) *)
63
64      source :== '';      source :== '';
65  END mixture_spec;  END mixture_spec;
66
(*  Model of a single component, which can be used to extract component-specific
mixture properties.
*)
MODEL mixture_component;
grandparent IS_A mixture_spec;
phase_num IS_A phase_count; (* x *)
comp_num IS_A phase_count; (* x *)
T IS_A temperature;
p IS_A pressure;

mix_comp_num IS_A phase_count;
name IS_A symbol;

mix_component_numbers : mixture_component_cnum(
T, p, phase_num, comp_num : INPUT;
mix_comp_num : OUTPUT;
grandparent : DATA
);
METHODS
METHOD default_self;
name := grandparent.components[mix_comp_num];
END default_self;
END mixture_component;
67
68  (*  Model of a single phase, which can be used to extract phase-specific mixture  (* The mixture_component model holds data on a single component from a mixture
69      properties.     specified in a mixture_spec model.
70   *)   *)
71  MODEL mixture_phase(  MODEL mixture_component(
72      parent WILL_BE mixture_spec;   (* the mixture_spec in which the phase exists *)      component WILL_BE phase_count; (* index of the component within 'mixt' *)
73      phase_num WILL_BE phase_count; (* phase is the first, second,... in the mixture *)      mixt WILL_BE mixture_spec;     (* specification of the mixture *)
74      T WILL_BE temperature;         (* the mixture temperature *)      T WILL_BE temperature;         (* mixture temperature *)
75      p WILL_BE pressure;            (* the mixture pressure *)      p WILL_BE pressure;            (* mixture pressure *)
76  );  );
77        phases,
78      num_comps IS_A phase_count;    (* the number of components in that phase *)      ph_num[1..3],
79      phase_components : mixture_phase_components(      ph_comps[1..3] IS_A phase_count;
80          T, p, phase_num : INPUT;      (* comp_num[1..3] IS_A phase_count; *)
81          num_comps : OUTPUT;      ph_frac[1..3] IS_A mass_fraction;
82          parent : DATA
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      components[1..num_comps] IS_A mixture_component;      FOR i IN [1..3] CREATE
90      i IS_A phase_count;          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  METHODS
98  METHOD default_self;  METHOD default_self;
99      i := 1;      FIX ph_num[1];
100      WHILE i < num_comps+1 DO      FIX ph_num[2];
101          components[i].grandparent := parent;      FIX ph_num[3];
102          components[i].phase_num := phase_num;      ph_num[1] := 1.0;
103          components[i].comp_num := i;      ph_num[2] := 2.0;
104          components[i].T := T;      ph_num[3] := 3.0;
components[i].p := p;
END WHILE;
105  END default_self;  END default_self;
106  END mixture_phase;  END mixture_component;

Legend:
 Removed from v.3078 changed lines Added in v.3079

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