diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-18 13:50:29 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-18 13:50:29 (GMT) |
| commit | f84dc03c23452af62c5772509b1b5732f22f1ca8 (patch) | |
| tree | 67e28f78e991a39976df65351a72e4eb3346f740 /src/simulation/Simulation.cpp | |
| parent | 82a19334001969af688cd52eb48509d4b91cef59 (diff) | |
| download | powder-f84dc03c23452af62c5772509b1b5732f22f1ca8.zip powder-f84dc03c23452af62c5772509b1b5732f22f1ca8.tar.gz | |
TPT: A new unstable REALISTIC option. No guarantees - but more realistic behaviour. f41f96f598
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 8396b93..6341f86 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2539,8 +2539,14 @@ void Simulation::update_particles_i(int start, int inc) if (ptypes[t].diffusion)//the random diffusion that gasses have { +#ifdef REALISTIC + //The magic number controlls diffusion speed + parts[i].vx += 0.05*sqrtf(parts[i].temp)*ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += 0.05*sqrtf(parts[i].temp)*ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); +#else parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); +#endif } j = surround_space = nt = 0;//if nt is 1 after this, then there is a particle around the current particle, that is NOT the current particle's type, for water movement. @@ -2571,8 +2577,8 @@ void Simulation::update_particles_i(int start, int inc) //heat transfer code h_count = 0; -#ifdef REALHEAT - if (t&&(t!=PT_HSWC||parts[i].life==10)) +#ifdef REALISTIC + if (t&&(t!=PT_HSWC||parts[i].life==10)&&ptypes[t].hconduct) { float c_Cm = 0.0f; #else @@ -2600,7 +2606,7 @@ void Simulation::update_particles_i(int start, int inc) &&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG))) { surround_hconduct[j] = r>>8; -#ifdef REALHEAT +#ifdef REALISTIC c_heat += parts[r>>8].temp*96.645/ptypes[rt].hconduct*fabs(ptypes[rt].weight); c_Cm += 96.645/ptypes[rt].hconduct*fabs(ptypes[rt].weight); #else @@ -2609,7 +2615,7 @@ void Simulation::update_particles_i(int start, int inc) h_count++; } } -#ifdef REALHEAT +#ifdef REALISTIC if (t == PT_PHOT) pt = (c_heat+parts[i].temp*96.645)/(c_Cm+96.645); else |
