diff options
| author | savask <savask@yandex.ru> | 2012-03-31 17:23:56 (GMT) |
|---|---|---|
| committer | savask <savask@yandex.ru> | 2012-03-31 17:27:01 (GMT) |
| commit | 4b4830b5a46258e399179faf2aacf54fe57adf46 (patch) | |
| tree | 55a941c86c7cf5fc7562c5d4d207f6a6ea05fb78 /src/powder.c | |
| parent | 57aa7b88f1cab19c091c6c700035812731052089 (diff) | |
| download | powder-4b4830b5a46258e399179faf2aacf54fe57adf46.zip powder-4b4830b5a46258e399179faf2aacf54fe57adf46.tar.gz | |
REALISTIC - Latent heat. It may be buggy, and enthalpy table isn't
filled, but it works.
Diffstat (limited to 'src/powder.c')
| -rw-r--r-- | src/powder.c | 82 |
1 files changed, 78 insertions, 4 deletions
diff --git a/src/powder.c b/src/powder.c index 67a16f8..187a0d9 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1904,15 +1904,18 @@ void update_particles_i(pixel *vid, int start, int inc) pt = (c_heat+parts[i].temp*96.645)/(c_Cm+96.645); else pt = (c_heat+parts[i].temp*96.645/ptypes[t].hconduct*fabs(ptypes[t].weight))/(c_Cm+96.645/ptypes[t].hconduct*fabs(ptypes[t].weight)); - + + c_heat += parts[i].temp*96.645/ptypes[t].hconduct*fabs(ptypes[t].weight); + c_Cm += 96.645/ptypes[t].hconduct*fabs(ptypes[t].weight); + parts[i].temp = restrict_flt(pt, MIN_TEMP, MAX_TEMP); #else pt = (c_heat+parts[i].temp)/(h_count+1); -#endif pt = parts[i].temp = restrict_flt(pt, MIN_TEMP, MAX_TEMP); for (j=0; j<8; j++) { parts[surround_hconduct[j]].temp = pt; } +#endif ctemph = ctempl = pt; // change boiling point with pressure @@ -1925,29 +1928,93 @@ void update_particles_i(pixel *vid, int start, int inc) s = 1; if (ctemph>ptransitions[t].thv&&ptransitions[t].tht>-1) { // particle type change due to high temperature +#ifdef REALISTIC + float dbt = ctempl - pt; + if (ptransitions[t].tht!=PT_NUM) + { + if (platent[t] <= (c_heat - (ptransitions[t].thv - dbt)*c_Cm)) + { + pt = (c_heat - platent[t])/c_Cm; + t = ptransitions[t].tht; + } + else + { + parts[i].temp = restrict_flt(ptransitions[t].thv - dbt, MIN_TEMP, MAX_TEMP); + s = 0; + } + } +#else if (ptransitions[t].tht!=PT_NUM) t = ptransitions[t].tht; +#endif else if (t==PT_ICEI) { - if (parts[i].ctype>0&&parts[i].ctype<PT_NUM&&parts[i].ctype!=PT_ICEI) { + if (parts[i].ctype<PT_NUM&&parts[i].ctype!=PT_ICEI) { if (ptransitions[parts[i].ctype].tlt==PT_ICEI&&pt<=ptransitions[parts[i].ctype].tlv) s = 0; else { +#ifdef REALISTIC + //One ice table value for all it's kinds + if (platent[t] <= (c_heat - (ptransitions[parts[i].ctype].tlv - dbt)*c_Cm)) + { + pt = (c_heat - platent[t])/c_Cm; + t = parts[i].ctype; + parts[i].ctype = PT_NONE; + parts[i].life = 0; + } + else + { + parts[i].temp = restrict_flt(ptransitions[parts[i].ctype].tlv - dbt, MIN_TEMP, MAX_TEMP); + s = 0; + } +#else t = parts[i].ctype; parts[i].ctype = PT_NONE; parts[i].life = 0; +#endif } } - else if (pt>274.0f) t = PT_WATR; else s = 0; } else if (t==PT_SLTW) { +#ifdef REALISTIC + if (platent[t] <= (c_heat - (ptransitions[t].thv - dbt)*c_Cm)) + { + pt = (c_heat - platent[t])/c_Cm; + + if (1>rand()%6) t = PT_SALT; + else t = PT_WTRV; + } + else + { + parts[i].temp = restrict_flt(ptransitions[t].thv - dbt, MIN_TEMP, MAX_TEMP); + s = 0; + } +#else if (1>rand()%6) t = PT_SALT; else t = PT_WTRV; +#endif } else s = 0; } else if (ctempl<ptransitions[t].tlv&&ptransitions[t].tlt>-1) { // particle type change due to low temperature +#ifdef REALISTIC + float dbt = ctempl - pt; + if (ptransitions[t].tlt!=PT_NUM) + { + if (platent[ptransitions[t].tlt] >= (c_heat - (ptransitions[t].tlv - dbt)*c_Cm)) + { + pt = (c_heat + platent[ptransitions[t].tlt])/c_Cm; + t = ptransitions[t].tlt; + } + else + { + parts[i].temp = restrict_flt(ptransitions[t].tlv - dbt, MIN_TEMP, MAX_TEMP); + s = 0; + } + } +#else if (ptransitions[t].tlt!=PT_NUM) t = ptransitions[t].tlt; +#endif else if (t==PT_WTRV) { if (pt<273.0f) t = PT_RIME; else t = PT_DSTW; @@ -1979,6 +2046,13 @@ void update_particles_i(pixel *vid, int start, int inc) else s = 0; } else s = 0; +#ifdef REALISTIC + pt = restrict_flt(pt, MIN_TEMP, MAX_TEMP); + for (j=0; j<8; j++) + { + parts[surround_hconduct[j]].temp = pt; + } +#endif if (s) { // particle type change occurred if (t==PT_ICEI||t==PT_LAVA) parts[i].ctype = parts[i].type; |
