public void TestHenrysLawScenario() { MaterialType mt = m_brs.MyMaterialCatalog["Hydrazine"]; double temperature = 35 + K.CELSIUS_TO_KELVIN; double vp = VaporPressureCalculator.ComputeVaporPressure(mt, temperature, TemperatureUnits.Kelvin, PressureUnits.Pascals); double svp = (double)m_computedVaporPressureInPascals[mt.Name]; double pctError = Math.Abs(vp - svp) / Math.Max(vp, svp); string msg = string.Format("Computed VP({0}) at {1:F2} deg C was {2:F2}, refData was {3:F2}, for a {4:F2} percent error.", mt.Name, temperature, vp, svp, pctError * 100); _Debug.WriteLine(msg); _Debug.Assert(pctError < 0.01, "Vapor Pressure", mt.Name + " Vapor Pressure at 35 deg C == " + svp + " Pascals"); }
public void TestEmpiricalWaterVaporPressureScenarios() { double vp; MaterialType mt = m_brs.MyMaterialCatalog["Water"]; foreach (double[] row in empiricalVPOfWater) { double temperature = row[0] + K.CELSIUS_TO_KELVIN; //if ( temperature != 35 ) continue; double empiricalVP = row[1]; empiricalVP = empiricalVP * 1000.0; // kPa -> Pa. vp = VaporPressureCalculator.ComputeVaporPressure(mt, temperature, TemperatureUnits.Kelvin, PressureUnits.Pascals); double pctError = Math.Abs(vp - empiricalVP) / Math.Max(vp, empiricalVP); string msg = string.Format("Computed VP({0}) at {1:F2} deg C was {2:F2}, empirical was {3:F2}, for a {4:F2} percent error.", mt.Name, temperature, vp, empiricalVP, pctError * 100); _Debug.WriteLine(msg); _Debug.Assert(pctError < 0.01, "Water Vapor Pressure", "Water Vapor Pressure at " + temperature + " deg C == " + empiricalVP); } }
public void TestKnownVaporPressureValues() { string[] knownBad = new string[] {}; //"Hydrazine"}; ArrayList untestables = new ArrayList(knownBad); ArrayList testables = new ArrayList(m_brs.MyMaterialCatalog.MaterialTypes); foreach (MaterialType mt in testables) { if (untestables.Contains(mt.Name)) { continue; } double temperature = 35 + K.CELSIUS_TO_KELVIN; double vp = VaporPressureCalculator.ComputeVaporPressure(mt, temperature, TemperatureUnits.Kelvin, PressureUnits.Pascals); double svp = (double)m_computedVaporPressureInPascals[mt.Name]; double pctError = Math.Abs(vp - svp) / Math.Max(vp, svp); string msg = string.Format("Computed VP({0}) at {1:F2} deg C was {2:F2}, refData was {3:F2}, for a {4:F2} percent error.", mt.Name, temperature, vp, svp, pctError * 100); _Debug.WriteLine(msg); _Debug.Assert(pctError < 0.01, "Vapor Pressure", mt.Name + " Vapor Pressure at " + temperature + " deg C == " + svp + " Pascals"); } }