/[ascend]/branches/jacob/models/johnpye/fprops/jacob_mix_test3--bubble-dew.a4c
ViewVC logotype

Diff of /branches/jacob/models/johnpye/fprops/jacob_mix_test3--bubble-dew.a4c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3078 by jacob, Fri Aug 14 00:03:58 2015 UTC revision 3079 by jacob, Thu Aug 20 02:17:28 2015 UTC
# Line 1  Line 1 
1  (* Outline of ASCEND multi-component ideal-solution routine *)  (* Outline of ASCEND multi-component ideal-solution routine
2  (* To perform the simulation, load the file into ASCEND and run 'setup'. *)  
3       To perform the simulation, load the file into ASCEND and run 'setup'.
4     *)
5    
6  REQUIRE "atoms.a4l";  REQUIRE "atoms.a4l";
7  REQUIRE "johnpye/thermo_types.a4c";  REQUIRE "johnpye/thermo_types.a4c";
8  IMPORT "johnpye/fprops/mixture";  IMPORT "johnpye/fprops/mixture";
9  REQUIRE "johnpye/fprops/mixtures.a4l";  REQUIRE "johnpye/fprops/mixtures.a4l";
10    
11  (* The mixture_test model *)  (* ---------------------------------------------------------------------
12       The mixture_test model *)
13  MODEL mixture_test;  MODEL mixture_test;
14      T,      (* -----------------------------------------------------------------
15      T_bubble,         Declare variables to hold various mixture properties *)
16      T_dew     IS_A temperature;      T,                             (* fixed mixture temperature *)
17      p,      T_bubble,                      (* mixture bubble temperature at p *)
18      p_bubble,      T_dew     IS_A temperature;    (* mixture dew temperature at p *)
19      p_dew     IS_A pressure;  
20        p,                             (* fixed mixture pressure *)
21      rho,      p_bubble,                      (* mixture bubble pressure at T *)
22      rho_dewT,      p_dew     IS_A pressure;       (* mixture dew pressure at T *)
23      rho_bubbleP IS_A mass_density;  
24        rho,                           (* mixture density at fixed (T,p) *)
25        rho_dewT,                      (* mixture density at (T_dew,p) *)
26        rho_bubbleP IS_A mass_density; (* mixture density at (T,p_bubble) *)
27    
28      u,      u,                             (* mixture enthalpy at (T,p) *)
29      u_ph1 IS_A specific_energy;      u_ph1 IS_A specific_energy;    (* phase 1 enthalpy *)
30    
31      ii IS_A phase_count;      ph IS_A phase_count;           (* number of phase 1 *)
32    
33        (* -----------------------------------------------------------------
34           Declare and specify a mixture with its composition *)
35      mixt IS_A mixture_spec;      mixt IS_A mixture_spec;
36      mixt.npure :== 4;      mixt.npure :== 4;
37      mixt.components[1] :== 'ammonia';      mixt.components[1] :== 'ammonia';
# Line 59  MODEL mixture_test; Line 67  MODEL mixture_test;
67          mixt : DATA          mixt : DATA
68      );      );
69    
   
70      (* -----------------------------------------------------------------      (* -----------------------------------------------------------------
71         Calculate density at several conditions *)         Calculate density at several conditions *)
72      mix_density : mixture_rho(      mix_density : mixture_rho(
# Line 78  MODEL mixture_test; Line 85  MODEL mixture_test;
85          mixt : DATA          mixt : DATA
86      );      );
87    
   
88      (* -----------------------------------------------------------------      (* -----------------------------------------------------------------
89         Calculate internal energy for whole mixture, one phase *)         Calculate internal energy for whole mixture, one phase *)
90      mix_u : mixture_u(      mix_u : mixture_u(
# Line 86  MODEL mixture_test; Line 92  MODEL mixture_test;
92          u : OUTPUT;          u : OUTPUT;
93          mixt : DATA          mixt : DATA
94      );      );
   
95      mix_phase_u : mixture_phase_u(      mix_phase_u : mixture_phase_u(
96          T, p, ii : INPUT;          T, p, ph : INPUT;
97          u_ph1 : OUTPUT;          u_ph1 : OUTPUT;
98          mixt : DATA          mixt : DATA
99      );      );
100            
101  METHODS  METHODS
102    (* Fix the variables that are to be fixed *)
103  METHOD specify;  METHOD specify;
104      FIX T;      FIX T;
105      FIX p;      FIX p;
106      FIX ii;      FIX ph;
107  END specify;  END specify;
108    (* Set values of the fixed variables *)
109  METHOD values;  METHOD values;
110      T := 100 {K} + 273.15 {K};      T := 100 {K} + 273.15 {K};
111      p := 2 {bar};      p := 2 {bar};
112      ii := 1;      ph := 1;
113  END values;  END values;
114    (* Set solver and other options *)
115  METHOD options;  METHOD options;
116      SOLVER QRSlv;      SOLVER QRSlv;
117      OPTION convopt 'RELNOM_SCALE';      OPTION convopt 'RELNOM_SCALE';
118  END options;  END options;
119    (* Quick alias for all preceeding methods; readies the model for solving *)
120  METHOD setup;  METHOD setup;
121      RUN specify;      RUN specify;
122      RUN values;      RUN values;

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

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