diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-06-01 21:38:04 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-02 19:19:46 (GMT) |
| commit | 469de0cae01e709e527d20cdbd5fb23c09ca5db9 (patch) | |
| tree | 6484b41b60afda77931bd24dfeb8e901c947f0d4 /src | |
| parent | 744854ef3691002b7049cb5c48fb89f86bed5320 (diff) | |
| download | powder-469de0cae01e709e527d20cdbd5fb23c09ca5db9.zip powder-469de0cae01e709e527d20cdbd5fb23c09ca5db9.tar.gz | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/powder.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/powder.c b/src/powder.c index 509f532..19a6d70 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; |
