From 1e13168183361e65e01c7613f094407780d0967e Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 27 May 2012 18:45:16 +0000 Subject: Smoke: 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. --- intern/smoke/intern/FLUID_3D_STATIC.cpp | 10 +++++++--- source/blender/blenkernel/intern/smoke.c | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp index 74c2c9c7e2d..c7a0ddcd04c 100644 --- a/intern/smoke/intern/FLUID_3D_STATIC.cpp +++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp @@ -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.; } } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index edb4348dc5a..ce739a00bb4 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -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; -- cgit v1.2.3