/[ascend]/trunk/models/johnpye/iapws95.a4c
ViewVC logotype

Diff of /trunk/models/johnpye/iapws95.a4c

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

revision 166 by johnpye, Thu Jan 5 09:51:50 2006 UTC revision 167 by johnpye, Fri Jan 6 00:54:21 2006 UTC
# Line 35  References: Line 35  References:
35  freesteam-ascend - IAPWS-95 steam library for ASCEND  freesteam-ascend - IAPWS-95 steam library for ASCEND
36  Copyright (C) John Pye 2005  Copyright (C) John Pye 2005
37  derived from work by Don Peterson for freesteam, (C) 2004.  derived from work by Don Peterson for freesteam, (C) 2004.
38    http://freesteam.sourceforge.net/
39    
40  This program is free software; you can redistribute it  This program is free software; you can redistribute it
41  and/or modify it under the terms of the GNU General Public  and/or modify it under the terms of the GNU General Public
# Line 510  MODEL iapws95_2phase REFINES thermo_stat Line 511  MODEL iapws95_2phase REFINES thermo_stat
511      Sg IS_A iapws95_1phase;      Sg IS_A iapws95_1phase;
512      xf IS_A fraction;      xf IS_A fraction;
513      xg IS_A fraction;      xg IS_A fraction;
     xfslack IS_A fraction;  
     xgslack IS_A fraction;  
       
514      z01: xf + xg = 1.0;      z01: xf + xg = 1.0;
515    
     (* complementarity... ??? *)  
     z02: xf * xfslack = 0.0; (* xfslack must be zero, else xf must be zero (ie no liquid) *)  
     z03: xg * xgslack = 0.0; (* xgslack must be zero, else xg must be zero (ie no gas) *)  
     (* so, if we have a non-zero slack variable, that phase will have disappeared and we don't need to worry! *)  
       
516      (* saturation conditions *)      (* saturation conditions *)
517      sat IS_A iapws_sat_curves;      sat IS_A iapws_sat_curves;
     sat.rhof, Sf.rho ARE_THE_SAME;  
     sat.rhog, Sg.rho ARE_THE_SAME;  
518      Sf.T, Sg.T, sat.T ARE_THE_SAME;      Sf.T, Sg.T, sat.T ARE_THE_SAME;
519      rhof ALIASES Sf.rho;      rhof ALIASES sat.rhof;
520      rhog ALIASES Sg.rho;      rhog ALIASES sat.rhog;
521        rhov ALIASES Sg.rho;
522        rhol ALIASES Sf.rho;
523      T, Sf.T ARE_THE_SAME;      T, Sf.T ARE_THE_SAME;
524      p, Sf.p ARE_THE_SAME;      p, Sf.p ARE_THE_SAME;
525    
526        z02: xf * (rhov-rhog) = 0.0 {kg/m^3};
527        z03: xg * (rhol-rhof) = 0.0 {kg/m^3};      
528    
529      x ALIASES xg;      x ALIASES xg;
530    
531      z04: rhof * rhog = rho * ( xf * rhog + xg * rhof);      z04: Sf.rho * Sg.rho = rho * ( xf * Sg.rho + xg * Sf.rho);
532      z05: u =  xf * Sf.u  + xg * Sg.u;      z05: u =  xf * Sf.u  + xg * Sg.u;
533      z06: h  = xf * Sf.h  + xg * Sg.h;      z06: h  = xf * Sf.h  + xg * Sg.h;
534      z07: s  = xf * Sf.s  + xg * Sg.s;      z07: s  = xf * Sf.s  + xg * Sg.s;
# Line 559  END values; Line 555  END values;
555            
556  END iapws95_2phase;      END iapws95_2phase;    
557    
 (*  
 MODEL iapws95 REFINES thermo_state;  
     S1 IS_A iapws95_1phase;  
     S2 IS_A iapws95_2phase;  
     sat IS_A iapws_sat_curves;  
   
     T, sat.T, S1.T, S2.T ARE_THE_SAME;  
     rho, S1.rho, S2.rho ARE_THE_SAME;  
     h, S1.h, S2.h ARE_THE_SAME;  
     u, S1.u, S2.u ARE_THE_SAME;  
     p, S1.p, S2.p ARE_THE_SAME;  
     s, S1.s, S2.s ARE_THE_SAME;  
     cp, S1.cp, S2.cp ARE_THE_SAME;  
     cv, S1.cv, S2.cv ARE_THE_SAME;  
     w, S1.w, S2.w ARE_THE_SAME;  
   
     CONDITIONAL  
         sub_test: rho >= sat.rhof;  
         super_test: rho <= sat.rhog;  
         sat1_test: rho < sat.rhof;  
         sat2_test: rho > sat.rhog;  
     END CONDITIONAL;  
   
     issat1 IS_A boolean_var;  
     sat1_expr: issat1 == SATISFIED(sat1_test);  
     issat2 IS_A boolean_var;  
     sat2_expr: issat1 == SATISFIED(sat2_test);  
     issat IS_A boolean_var;  
     saturation_expr: issat == issat1 OR issat2;  
     issub IS_A boolean_var;  
     subcooled_expr: issub == SATISFIED(sub_test);  
     issuper IS_A boolean_var;  
     superheated_expr: issuper == SATISFIED(super_test);  
       
     saturation_when: WHEN (issat)  
         CASE TRUE:  
             USE S2;  
         CASE FALSE:  
             USE S1;  
     END WHEN;  
   
 METHODS  
 METHOD default_self;  
     RUN reset;  
     RUN values;  
 END default_self;  
   
 METHOD specify;  
     T.fixed := TRUE;  
     rho.fixed := TRUE;  
 END specify;  
   
 METHOD values;  
     (* fixed vars *)  
     T := 300 {K};  
     rho := 100 {kg/m^3};  
     (* initial values *)  
     issat := TRUE;  
     issuper := FALSE;  
     issub := FALSE;  
     p := 1 {atm};  
     h := 400 {kJ/kg};  
 END values;  
   
 END iapws95;  

Legend:
Removed from v.166  
changed lines
  Added in v.167

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