From 469de0cae01e709e527d20cdbd5fb23c09ca5db9 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 1 Jun 2011 22:38:04 +0100 Subject: [PATCH] Fix air-particle heat transfer Heat transfer rate is proportional to temperature difference. Previously, the code caused the temperature change to be proportional to absolute temperature. --- src/powder.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/powder.c b/src/powder.c index 509f53254..19a6d70a6 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1610,23 +1610,16 @@ void update_particles_i(pixel *vid, int start, int inc) } //heat transfer code - c_heat = 0.0f; h_count = 0; if (t&&(t!=PT_HSWC||parts[i].life==10)&&ptypes[t].hconduct>(rand()%250)) { if (aheat_enable) { - if (hv[y/CELL][x/CELL] < parts[i].temp) - { - hv[y/CELL][x/CELL] = hv[y/CELL][x/CELL] + parts[i].temp*0.04; - parts[i].temp = parts[i].temp - hv[y/CELL][x/CELL]*0.04; - } - else - { - hv[y/CELL][x/CELL] = hv[y/CELL][x/CELL] - parts[i].temp*0.04; - parts[i].temp = parts[i].temp + hv[y/CELL][x/CELL]*0.04; - } - } + c_heat = (hv[y/CELL][x/CELL]-parts[i].temp)*0.04; + parts[i].temp += c_heat; + hv[y/CELL][x/CELL] -= c_heat; + } + c_heat = 0.0f; for (j=0; j<8; j++) { surround_hconduct[j] = i;