a) Another boundary fix. Resulted in smoke getting "sucked" back into the domain
b) Disabling substeps (internal thing). Fixes arbitrary explosions/instabilities.

Part of my Blender Smoke Development.
This commit is contained in:
Daniel Genrich 2012-05-27 18:45:16 +00:00
parent d4b6927179
commit 1e13168183
2 changed files with 11 additions and 6 deletions

View File

@ -153,9 +153,13 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
index = x + y * res[0];
field[index] = field[index + 2 * slabSize];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += slabSize;
if(field[index]>0.) field[index] = 0.;
// DG: Disable this for z-axis.
// The problem is that smoke somehow gets sucked in again
// from the TOP slab when this is enabled
// if(field[index]>0.) field[index] = 0.;
// index += slabSize;
// if(field[index]>0.) field[index] = 0.;
}
}

View File

@ -1592,8 +1592,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps)
/* adapt timestep for different framerates, dt = 0.1 is at 25fps */
dt *= (25.0f / fps);
// maximum timestep/"CFL" constraint: dt < dx * maxVel
maxVel = (sds->dx * 1.0);
// maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel
maxVel = (sds->dx * 5.0);
for(i = 0; i < size; i++)
{
@ -1607,7 +1607,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps)
totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
// totalSubsteps = 2.0f; // DEBUG
/* Disable substeps for now, since it results in numerical instability */
totalSubsteps = 1.0f;
dtSubdiv = (float)dt / (float)totalSubsteps;