/[ascend]/trunk/models/johnpye/fprops/asc_fprops.c
ViewVC logotype

Diff of /trunk/models/johnpye/fprops/asc_fprops.c

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

revision 2775 by jpye, Mon Mar 4 11:28:19 2013 UTC revision 2776 by jpye, Thu Mar 27 12:48:14 2014 UTC
# Line 43  Line 43 
43  #include "fprops.h"  #include "fprops.h"
44  #include "sat.h"  #include "sat.h"
45  #include "solve_ph.h"  #include "solve_ph.h"
46    #include "thcond.h"
47    #include "visc.h"
48    
49  /* for the moment, species data are defined in C code, we'll implement something  /* for the moment, species data are defined in C code, we'll implement something
50  better later on, hopefully. */  better later on, hopefully. */
# Line 67  ExtBBoxFunc fprops_g_calc; Line 69  ExtBBoxFunc fprops_g_calc;
69  ExtBBoxFunc fprops_cp_calc;  ExtBBoxFunc fprops_cp_calc;
70  ExtBBoxFunc fprops_cv_calc;  ExtBBoxFunc fprops_cv_calc;
71  ExtBBoxFunc fprops_w_calc;  ExtBBoxFunc fprops_w_calc;
72    ExtBBoxFunc fprops_mu_calc;
73    ExtBBoxFunc fprops_lam_calc;
74  ExtBBoxFunc fprops_phsx_vT_calc;  ExtBBoxFunc fprops_phsx_vT_calc;
75  ExtBBoxFunc fprops_Tvsx_ph_calc;  ExtBBoxFunc fprops_Tvsx_ph_calc;
76    
# Line 94  static const char *fprops_g_help = "Calc Line 98  static const char *fprops_g_help = "Calc
98  static const char *fprops_cp_help = "Calculate isobaric specific heat from temperature and density, using FPROPS";  static const char *fprops_cp_help = "Calculate isobaric specific heat from temperature and density, using FPROPS";
99  static const char *fprops_cv_help = "Calculate isochoric specific heat from temperature and density, using FPROPS";  static const char *fprops_cv_help = "Calculate isochoric specific heat from temperature and density, using FPROPS";
100  static const char *fprops_w_help = "Calculate speed of sound from temperature and density, using FPROPS";  static const char *fprops_w_help = "Calculate speed of sound from temperature and density, using FPROPS";
101    static const char *fprops_mu_help = "Calculate viscosity from temperature and density, using FPROPS";
102    static const char *fprops_lam_help = "Calculate thermal conductivity sound from temperature and density, using FPROPS";
103    
104  static const char *fprops_phsx_vT_help = "Calculate p, h, s, x from temperature and density, using FPROPS/Helmholtz eqn";  static const char *fprops_phsx_vT_help = "Calculate p, h, s, x from temperature and density, using FPROPS/Helmholtz eqn";
105    
# Line 147  ASC_EXPORT int fprops_register(){ Line 153  ASC_EXPORT int fprops_register(){
153      CALCFN(fprops_cp,2,1);      CALCFN(fprops_cp,2,1);
154      CALCFN(fprops_cv,2,1);      CALCFN(fprops_cv,2,1);
155      CALCFN(fprops_w,2,1);      CALCFN(fprops_w,2,1);
156        CALCFN(fprops_mu,2,1);
157        CALCFN(fprops_lam,2,1);
158      CALCFN(fprops_phsx_vT,2,4);      CALCFN(fprops_phsx_vT,2,4);
159      CALCFN(fprops_Tvsx_ph,2,4);      CALCFN(fprops_Tvsx_ph,2,4);
160    
# Line 456  int fprops_w_calc(struct BBoxInterp *bbo Line 464  int fprops_w_calc(struct BBoxInterp *bbo
464    
465      /* no need to worry about error states etc. */      /* no need to worry about error states etc. */
466      return 0;      return 0;
467    }
468    
469    /**
470        Evaluation function for 'fprops_mu'
471        @param jacobian ignored
472        @return 0 on success
473    */
474    int fprops_mu_calc(struct BBoxInterp *bbox,
475            int ninputs, int noutputs,
476            double *inputs, double *outputs,
477            double *jacobian
478    ){
479        CALCPREPARE(2,1);
480        FluidState S = fprops_set_Trho(inputs[0], inputs[1], FLUID, &err);
481    
482        /* first input is temperature, second is density */
483        outputs[0] = fprops_mu(S, &err);
484    
485        /* no need to worry about error states etc. */
486        return 0;
487    }
488    
489    /**
490        Evaluation function for 'fprops_lam'
491        @param jacobian ignored
492        @return 0 on success
493    */
494    int fprops_lam_calc(struct BBoxInterp *bbox,
495            int ninputs, int noutputs,
496            double *inputs, double *outputs,
497            double *jacobian
498    ){
499        CALCPREPARE(2,1);
500        FluidState S = fprops_set_Trho(inputs[0], inputs[1], FLUID, &err);
501    
502        /* first input is temperature, second is density */
503        outputs[0] = fprops_lam(S, &err);
504    
505        /* no need to worry about error states etc. */
506        return 0;
507  }  }
508    
509    

Legend:
Removed from v.2775  
changed lines
  Added in v.2776

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