Exemplo n.º 1
0
int freesteam_region_pu(double p, double u){
	double p13 = freesteam_region4_psat_T(REGION1_TMAX);
	if(p < p13){
		double Tsat = freesteam_region4_Tsat_p(p);
		double uf = freesteam_region1_u_pT(p,Tsat);
		if(u < uf)return 1;
		double ug = freesteam_region2_u_pT(p,Tsat);
		if(u > ug)return 2;
		return 4;
	}
	double u13 = freesteam_region1_u_pT(p,REGION1_TMAX);
	if(u < u13){
		return 1;
	}
	double T23 = freesteam_b23_T_p(p);
	double u23 = freesteam_region2_u_pT(p,T23);
	if(u > u23){
		return 2;
	}

	if(p > IAPWS97_PCRIT)return 3;

	/* FIXME what we really need here is a psat(u) function! The current method
	is singular. */
	
	double Tsat = freesteam_region4_Tsat_p(p);
	double rhof = freesteam_region4_rhof_T(Tsat);
	double uf = freesteam_region3_u_rhoT(rhof,Tsat);
	if(u<uf) return 3;
	double rhog = freesteam_region4_rhog_T(Tsat);
	double ug = freesteam_region3_u_rhoT(rhog,Tsat);
	if(u>ug)return 3;
	return 4;
}
Exemplo n.º 2
0
double freesteam_region4_u_Tx(double T, double x){
	double uf, ug;
	if(T < REGION1_TMAX){
		double psat = freesteam_region4_psat_T(T);
		uf = freesteam_region1_u_pT(psat,T);
		ug = freesteam_region2_u_pT(psat,T);
	}else{
		double rhof, rhog;
		rhof = freesteam_region4_rhof_T(T);
		rhog = freesteam_region4_rhog_T(T);
		uf = freesteam_region3_u_rhoT(rhof,T);
		ug = freesteam_region3_u_rhoT(rhog,T);
	}
	return uf + x*(ug - uf);
}