//cp unit is J/kg.k private static double CalculateCp(ArrayList materialComponents, double temperature, SubstanceState state) { double heatCapacity = 0.0; double cp = 0; double molarWeight; double massFrac; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; molarWeight = s.MolarWeight; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; massFrac = mc.GetMassFractionValue(); if (state == SubstanceState.Gas) { cp = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs) / molarWeight; } else if (state == SubstanceState.Liquid) { cp = ThermalPropCalculator.CalculateLiquidHeatCapacity1(temperature, tpc.LiqCpCoeffs) / molarWeight; } heatCapacity += cp * massFrac; } return(heatCapacity); }
private static double CalculateViscosity(ArrayList materialComponents, double temperature, SubstanceState state) { double viscosity = 0.0; double visc; double molarWt; double moleFrac; double massFrac; double numerator = 0.0; double denominator = 0.0; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; molarWt = s.MolarWeight; moleFrac = mc.GetMoleFractionValue(); massFrac = mc.GetMassFractionValue(); if (moleFrac == Constants.NO_VALUE) { moleFrac = massFrac; } if (state == SubstanceState.Gas) { if (s.Name == "Air") { visc = ThermalPropCalculator.CalculateAirGasViscosity(temperature); } else { visc = ThermalPropCalculator.CalculateGasViscosity(temperature, tpc.GasViscCoeffs); } numerator += visc * moleFrac * Math.Sqrt(molarWt); denominator += moleFrac * Math.Sqrt(molarWt); } else if (state == SubstanceState.Liquid) { visc = ThermalPropCalculator.CalculateLiquidViscosity(temperature, tpc.LiqViscCoeffs); numerator += moleFrac * Math.Log10(visc); } } if (state == SubstanceState.Gas) { if (denominator > 1.0e-8) { viscosity = numerator / denominator; } } else if (state == SubstanceState.Liquid) { viscosity = Math.Pow(10, numerator); } return(viscosity); }
//water properties------------------- public MoistureProperties(Substance moisture) { this.moisture = moisture; ThermalPropsAndCoeffs tpc = moisture.ThermalPropsAndCoeffs; criticalTemperature = moisture.CriticalProperties.CriticalTemperature; liqCpCoeffs = tpc.LiqCpCoeffs; gasCpCoeffs = tpc.GasCpCoeffs; liqDensityCoeffs = tpc.LiqDensityCoeffs; evapHeatCoeffs = tpc.EvapHeatCoeffs; vapPressureCoeffs = tpc.VapPressureCoeffs; molarWeight = moisture.MolarWeight; }
public static double GetLiquidDensity(ArrayList materialComponents, double temperature) { double density = 0.0; double den = 0; double massFrac; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; massFrac = mc.GetMassFractionValue(); den = ThermalPropCalculator.CalculateLiquidDensity(temperature, tpc.LiqDensityCoeffs); density += den * massFrac; } return(density); }
public static double GetSpecificHeatRatio(ArrayList materialComponents, double temperature) { double heatCapacity = 0.0; double cp = 0; //double molarWeight = 0.0; double w; double molarFrac; double totalMole = 0.0; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; if (s.Name == "Generic Dry Material" || s is CompositeSubstance) { continue; } w = s.MolarWeight; molarFrac = mc.GetMassFractionValue() / w; totalMole += molarFrac; } foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; if (s.Name == "Generic Dry Material" || s is CompositeSubstance) { continue; } w = s.MolarWeight; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; molarFrac = mc.GetMassFractionValue() / w / totalMole; //since heat capacity from ThermalPropCalculator is in J/kmol.K, it is necessary to //convert into kJ/kmol.K to be aligned with the unit of universal gas constant R heatCapacity = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs) / 1000; cp += heatCapacity * molarFrac; } return(cp / (cp - Constants.R)); }
private static double CalculateThermalConductivity(ArrayList materialComponents, double temperature, SubstanceState state) { double thermalCond = 0.0; double k = 0; double massFrac; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; massFrac = mc.GetMassFractionValue(); if (state == SubstanceState.Gas) { if (s.Name == "Air") { k = ThermalPropCalculator.CalculateAirGasThermalConductivity(temperature); } else { k = ThermalPropCalculator.CalculateGasThermalConductivity(temperature, tpc.GasKCoeffs); } } else if (state == SubstanceState.Liquid) { if (s.SubstanceType == SubstanceType.Inorganic) { k = ThermalPropCalculator.CalculateLiquidInorganicThermalConductivity(temperature, tpc.LiqKCoeffs); } else if (s.SubstanceType == SubstanceType.Organic) { k = ThermalPropCalculator.CalculateLiquidOrganicThermalConductivity(temperature, tpc.LiqKCoeffs); } } thermalCond += k * massFrac; } return(thermalCond); }
public static double GetSpecificHeatRatio(ArrayList materialComponents, double temperature) { double heatCapacity = 0.0; double cp = 0; //double molarWeight = 0.0; double w; double molarFrac; double totalMole = 1.0; foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; if (s.Name == "Generic Dry Material" || s is CompositeSubstance) { continue; } w = s.MolarWeight; molarFrac = mc.GetMassFractionValue() / w; totalMole += molarFrac; } foreach (MaterialComponent mc in materialComponents) { Substance s = mc.Substance; if (s.Name == "Generic Dry Material" || s is CompositeSubstance) { continue; } w = s.MolarWeight; ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs; molarFrac = mc.GetMassFractionValue() / w / totalMole; heatCapacity = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs); cp += heatCapacity * molarFrac; } return(cp / (cp - Constants.R)); }