static IF97REGIONS RegionDetermination_TP(double T, double p) { if (T > Constants.Text) { throw new ArgumentOutOfRangeException("Temperature out of range"); } else if (T > Constants.Tmax && T <= Constants.Text) { if (p <= Constants.Pext) { return IF97REGIONS.REGION_5; } else { throw new ArgumentOutOfRangeException("Pressure out of range"); } } else if (T > Constants.T23min && T <= Constants.Tmax) { if (p > Constants.Pmax) { throw new ArgumentOutOfRangeException("Pressure out of range"); } else if (p < 16.5292) { // Check this one first to avoid the call to 2-3 boundary curve (a little bit faster) return IF97REGIONS.REGION_2; } else if (p > Region23_T(T)) { return IF97REGIONS.REGION_3; } else { return IF97REGIONS.REGION_2; } } else if (T >= Constants.Tmin && T <= Constants.T23min) { if (p > Constants.Pmax) throw new ArgumentOutOfRangeException("Pressure out of range"); else if (p > Region4.p_T(T)) return IF97REGIONS.REGION_1; else if (p < Region4.p_T(T)) return IF97REGIONS.REGION_2; else return IF97REGIONS.REGION_4; } else { throw new ArgumentOutOfRangeException("Temperature out of range"); } }
/// Get the saturation pressure [Pa] as a function of T [K] public static double psat97(double T) { return Region4.p_T(T); }