summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsavask <savask@yandex.ru>2011-06-13 12:48:43 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-14 15:50:04 (GMT)
commit0fbc55dfe8247a62557ff7883c15af95c2a79d46 (patch)
tree810b549943e82a1fa5f2acb2d1f4914ff8518ba4 /src
parent464d36d910f8f79bae0715b990cc6e0ba3cd8de7 (diff)
downloadpowder-0fbc55dfe8247a62557ff7883c15af95c2a79d46.zip
powder-0fbc55dfe8247a62557ff7883c15af95c2a79d46.tar.gz
Better heat treatment.
Diffstat (limited to 'src')
-rw-r--r--src/powder.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/powder.c b/src/powder.c
index adb5cb7..7d55473 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1629,7 +1629,7 @@ void update_particles_i(pixel *vid, int start, int inc)
//heat transfer code
h_count = 0;
- if (t&&(t!=PT_HSWC||parts[i].life==10)&&ptypes[t].hconduct>(rand()%250))
+ if (t&&(t!=PT_HSWC||parts[i].life==10)&&ptypes[t].hconduct)
{
if (aheat_enable)
{
@@ -1640,27 +1640,25 @@ void update_particles_i(pixel *vid, int start, int inc)
c_heat = 0.0f;
for (j=0; j<8; j++)
{
- surround_hconduct[j] = i;
r = surround[j];
if ((r>>8)>=NPART || !r)
continue;
rt = r&0xFF;
- if (rt&&ptypes[rt].hconduct&&(rt!=PT_HSWC||parts[r>>8].life==10)
+ if ((parts[r>>8].temp < parts[i].temp)&&rt&&ptypes[rt].hconduct&&(rt!=PT_HSWC||parts[r>>8].life==10)
&&(t!=PT_FILT||(rt!=PT_BRAY&&rt!=PT_BIZR&&rt!=PT_BIZRG))
&&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG)))
{
- surround_hconduct[j] = r>>8;
- c_heat += parts[r>>8].temp;
- h_count++;
- }
- }
+ float dq, dt;
- pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1);
- for (j=0; j<8; j++)
- {
- parts[surround_hconduct[j]].temp = pt;
+ dt = parts[i].temp - parts[r>>8].temp;
+ dq = 0.347*ptypes[t].weight*dt; //It's constant for now
+
+ parts[i].temp -= dq*ptypes[t].hconduct/(96.635*ptypes[t].weight);
+ parts[r>>8].temp += dq*ptypes[rt].hconduct/(96.635*ptypes[rt].weight);
+ }
}
+ pt = parts[i].temp;
ctemph = ctempl = pt;
// change boiling point with pressure
if ((ptypes[t].state==ST_LIQUID && ptransitions[t].tht>-1 && ptransitions[t].tht<PT_NUM && ptypes[ptransitions[t].tht].state==ST_GAS)