/[ascend]/branches/jacob/models/johnpye/fprops/mixture_test_basic.a4c
ViewVC logotype

Contents of /branches/jacob/models/johnpye/fprops/mixture_test_basic.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3094 - (show annotations) (download) (as text)
Wed Aug 26 05:08:17 2015 UTC (8 years, 9 months ago) by jacob
File MIME type: text/x-ascend
File size: 4013 byte(s)
restored functionality in a test file
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 defines a model, 'mixture_test_basic', which allows simulations of
6 mixtures to be constructed to calculate common properties for the mixture.
7 Whole-mixture and phase-specific properties are calculated. This model
8 illustrates how a user can conveniently obtain properties using the
9 ideal-solution external functions.
10 *)
11 (* Jacob Shealy, August 25 2015 *)
12
13 REQUIRE "atoms.a4l";
14 REQUIRE "johnpye/thermo_types.a4c";
15 IMPORT "johnpye/fprops/mixture";
16 REQUIRE "johnpye/fprops/mixtures.a4l";
17
18
19 (* ---------------------------------------------------------------------
20 Generic mixture testing parametric model *)
21 MODEL mixture_test_basic(
22 (* -----------------------------------------------------------------
23 Declare variables that define the mixture composition and state *)
24 mix "mixture composition" WILL_BE mixture_spec;
25 T "mixture temperature" WILL_BE temperature;
26 p "mixture pressure" WILL_BE pressure;
27 );
28
29 (* -----------------------------------------------------------------
30 Declare variables to hold various mixture properties *)
31 ph[1..3] "number of each phase",
32
33 nphases "number of phases",
34 ncomps[1..3] "number of components in each phase" IS_A phase_count;
35
36 ph_frac[1..3] "mass fraction of each phase" IS_A mass_fraction;
37
38 (* -----------------------------------------------------------------
39 Declare variables to hold overall and by-phase densities *)
40 rho "whole-mixture density",
41 rho_ph[1..3] "phase densities" IS_A mass_density;
42
43 (* -----------------------------------------------------------------
44 Declare variables to hold common properties: internal energy,
45 enthalpy, constant-pressure heat capacity, and entropy. *)
46 (* u, u_ph[1..3] IS_A specific_energy;
47 h, h_ph[1..3] IS_A specific_enthalpy;
48 cp, cp_ph[1..3] IS_A specific_heat_capacity;
49 s, s_ph[1..3] IS_A specific_entropy; *)
50
51 (* -----------------------------------------------------------------
52 Find data for whole mixture: phases, phase fractions, density, and
53 the common properties *)
54 mix_phases : mixture_count_phases(
55 T, p : INPUT;
56 nphases, ph_frac[1], ph_frac[2], ph_frac[3] : OUTPUT;
57 mix : DATA
58 );
59 mix_density : mixture_rho(
60 T, p : INPUT;
61 rho : OUTPUT;
62 mix : DATA
63 );
64 mix_energy : mixture_u(
65 T, p : INPUT;
66 u : OUTPUT;
67 mix : DATA
68 );
69 mix_enthalpy : mixture_h(
70 T, p : INPUT;
71 h : OUTPUT;
72 mix : DATA
73 );
74 mix_cp_heat_capacity : mixture_cp(
75 T, p : INPUT;
76 cp : OUTPUT;
77 mix : DATA
78 );
79 mix_entropy : mixture_s(
80 T, p : INPUT;
81 s : OUTPUT;
82 mix : DATA
83 );
84
85 (* -----------------------------------------------------------------
86 Find data for each phase: number of components in each phase, density,
87 and first-law properties *)
88 FOR i1 IN [1..3] CREATE
89 mix_count_comps[i1] : mixture_count_components(
90 T, p, ph[i1] : INPUT;
91 ncomps[i1] : OUTPUT;
92 mix : DATA
93 );
94 mix_phase_density[i1] : mixture_phase_rho(
95 T, p, ph[i1] : INPUT;
96 rho_ph[i1] : OUTPUT;
97 mix : DATA
98 );
99 mix_phase_energy[i1] : mixture_phase_u(
100 T, p, ph[i1] : INPUT;
101 u_ph[i1] : OUTPUT;
102 mix : DATA
103 );
104 mix_phase_enthalpy[i1] : mixture_phase_h(
105 T, p, ph[i1] : INPUT;
106 h_ph[i1] : OUTPUT;
107 mix : DATA
108 );
109 mix_phase_cp_heat_capacity[i1] : mixture_phase_cp(
110 T, p, ph[i1] : INPUT;
111 cp_ph[i1] : OUTPUT;
112 mix : DATA
113 );
114 mix_phase_entropy[i1] : mixture_phase_s(
115 T, p, ph[i1] : INPUT;
116 s_ph[i1] : OUTPUT;
117 mix : DATA
118 );
119 END FOR;
120
121 METHODS
122 (* ---------------------------------------------------------------------
123 Fix the variables that are to be fixed *)
124 METHOD specify;
125 FIX T;
126 FIX p;
127 FIX ph[1..3];
128 END specify;
129 (* ---------------------------------------------------------------------
130 Set values for the fixed variables *)
131 METHOD values;
132 FOR j1 IN [1..3] DO
133 ph[j1] := j1;
134 END FOR;
135 END values;
136 END mixture_test_basic;

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