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); }