Exemplo n.º 1
0
        // Function from file: gas_mixture.dm
        public void temperature_share(GasMixture sharer = null, double conduction_coefficient = 0)
        {
            dynamic temperature_delta    = null;
            double  self_heat_capacity   = 0;
            double  sharer_heat_capacity = 0;
            double  heat = 0;

            temperature_delta = this.temperature_archived - sharer.temperature_archived;

            if (Math.Abs(Convert.ToDouble(temperature_delta)) > 0.5)
            {
                self_heat_capacity   = this.heat_capacity_archived();
                sharer_heat_capacity = sharer.heat_capacity_archived();

                if (sharer_heat_capacity > 0.0003 && self_heat_capacity > 0.0003)
                {
                    heat               = conduction_coefficient * Convert.ToDouble(temperature_delta) * (self_heat_capacity * sharer_heat_capacity / (self_heat_capacity + sharer_heat_capacity));
                    this.temperature   = Num13.MaxInt(Convert.ToInt32(this.temperature - heat / self_heat_capacity), ((int)(2.7)));
                    sharer.temperature = Num13.MaxInt(Convert.ToInt32(sharer.temperature + heat / sharer_heat_capacity), ((int)(2.7)));
                }
            }
            return;
        }