public void Diffuse(GasMixture a, float factor = 8) { foreach (var gas in a.gasses) { float amount = (gas.Value - gasses[gas.Key]) / factor; AddNextGas(amount, gas.Key); a.AddNextGas(-amount, gas.Key); } ShareTemp(a, factor); }
public void ShareTemp(GasMixture a, float factor = 8) { float HCCell = HeatCapacity * TotalMass; float HCa = a.HeatCapacity * a.TotalMass; float energyFlow = a.Temperature - Temperature; if (energyFlow > 0.0f) { energyFlow *= HCa; } else { energyFlow *= HCCell; } energyFlow *= (1 / factor); SetNextTemperature((energyFlow / HCCell)); a.SetNextTemperature(-(energyFlow / HCa)); }
public void ShareTemp(GasMixture a, float factor = 8) { float HCCell = HeatCapacity*TotalMass; float HCa = a.HeatCapacity*a.TotalMass; float energyFlow = a.Temperature - Temperature; if (energyFlow > 0.0f) { energyFlow *= HCa; } else { energyFlow *= HCCell; } energyFlow *= (1/factor); SetNextTemperature((energyFlow/HCCell)); a.SetNextTemperature(-(energyFlow/HCa)); }
public void Diffuse(GasMixture a, float factor = 8) { foreach (var gas in a.gasses) { float amount = (gas.Value - gasses[gas.Key])/factor; AddNextGas(amount, gas.Key); a.AddNextGas(-amount, gas.Key); } ShareTemp(a, factor); }