예제 #1
0
        /// <summary>
        /// Computes the partial pressure of a specified substance in the volume above a specified mixture at a specified temperature.
        /// Note that we will ignore the temperature of the mixture.
        /// </summary>
        /// <param name="substance">The substance whose partial pressure we desire.</param>
        /// <param name="temperature">The temperature at which we wish to have the partial pressure computed, in degrees kelvin.</param>
        /// <param name="mixture">The mixture that specifies the other materials that are to be considered in the calculation.</param>
        /// <returns>The partial pressure of the specified substance in the volume above the specified mixture, in Pascals.</returns>
        private static double PartialPressure(Substance substance, double temperature, Mixture mixture)
        {
            MaterialType mt = substance.MaterialType;

            if (mt.STPState == MaterialState.Unknown || mt.STPState == MaterialState.Liquid)
            {
                double molWt         = mt.MolecularWeight;
                double molFrac       = mixture.GetMoleFraction(mt, MaterialType.FilterAcceptLiquidOnly);
                double vaporPressure = ComputeVaporPressure(mt, temperature, TemperatureUnits.Kelvin, PressureUnits.Pascals);
                return(molFrac * vaporPressure);
            }
            else
            {
                return(0.0);
            }
        }