/* bwrm15.c */ #include "bwrm.h" #include #define MESSAGE (*m).b.tmp.errorcode double bwrmS2(/* calculate molar enthalpy 's'[J/kg-molK] of binary mixtures. The function 'bwrmSetSid1SI' must be already done for BWRM strucure of each component,c1 and c2, respectively. */ BWRM2 *m, char mode, /* 'l' or 'L': BWRM structure,l for liquid phase is used. 'v' or 'V': BWRM structure,v for liquid phase is used. else : BWRM structure,b for bulk fluid is used. */ double t, /* [K] */ double rho, /* [kg-mol/m3] */ double y1 /* molar fraction of component 1 */ ){ #define P0 1.0 #define MT (*cf).tmp double s1_id, s2_id, s_id; double y2; BWRM *cf; cf = &((*m).b); /* bulk */ if (mode == 'l' || mode == 'L') cf = &((*m).l); /* liquid */ if (mode == 'v' || mode == 'V') cf = &((*m).v); /* vapor */ RecalBWRM2(m, mode, t, rho, y1); y2 = 1.0 -y1; s1_id = (*m).c[1].s_id(t) + (*m).c[1].s_adj; s2_id = (*m).c[2].s_id(t) + (*m).c[2].s_adj; s_id = y1 * s1_id + y2 * s2_id; if (y1 > 0.0){ s_id += Rgas * y1 * log( P0/(y1*(*cf).tmp.rhoRT) ) ; } if (y2 > 0.0){ s_id += Rgas * y2 * log( P0/(y2*(*cf).tmp.rhoRT) ) ; } (*cf).s = s_id + bwrmdS(cf, t, rho); return( (*cf).s ); }