diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-06-25 19:02:58 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-06-25 19:03:08 +0300 |
commit | 31ad8bda74ec8228db03b5969145c499b0f5a6f3 (patch) | |
tree | 6b4c441f2ec7132bc35ffcd509c06d007450022d /intern/mantaflow | |
parent | 2dad5a97544f06a90a2e98e5df5c110e7c56c638 (diff) |
Fix T77204: Mantaflow Initial velocity bugged?
Always initialize the particle velocity of newly sampled particles to 0 if there are no initial velocities. Clearing the grid source makes sure that new particles will get a 0 velocity - and not interpolated from the associated grid.
Diffstat (limited to 'intern/mantaflow')
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index d7ba220d2c3..04505206601 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -211,10 +211,10 @@ def liquid_adaptive_step_$ID$(framenr):\n\ if using_invel_s$ID$:\n\ extrapolateVec3Simple(vel=invelC_s$ID$, phi=phiIn_s$ID$, distance=6, inside=True)\n\ resampleVec3ToMac(source=invelC_s$ID$, target=invel_s$ID$)\n\ - pVel_pp$ID$.setSource(invel_s$ID$, isMAC=True)\n\ - # ensure that pvel has vel as source (important when resuming bake jobs)\n\ + pVel_pp$ID$.setSource(grid=invel_s$ID$, isMAC=True)\n\ + # reset pvel grid source before sampling new particles - ensures that new particles are initialized with 0 velocity\n\ else:\n\ - pVel_pp$ID$.setSource(vel_s$ID$, isMAC=True)\n\ + pVel_pp$ID$.setSource(grid=None, isMAC=False)\n\ \n\ sampleLevelsetWithParticles(phi=phiIn_s$ID$, flags=flags_s$ID$, parts=pp_s$ID$, discretization=particleNumber_s$ID$, randomness=randomness_s$ID$)\n\ flags_s$ID$.updateFromLevelset(phi_s$ID$)\n\ @@ -310,7 +310,7 @@ def liquid_step_$ID$():\n\ extrapolateMACSimple(flags=flags_s$ID$, vel=vel_s$ID$)\n\ \n\ # set source grids for resampling, used in adjustNumber!\n\ - pVel_pp$ID$.setSource(vel_s$ID$, isMAC=True)\n\ + pVel_pp$ID$.setSource(grid=vel_s$ID$, isMAC=True)\n\ adjustNumber(parts=pp_s$ID$, vel=vel_s$ID$, flags=flags_s$ID$, minParticles=minParticles_s$ID$, maxParticles=maxParticles_s$ID$, phi=phi_s$ID$, exclude=phiObs_s$ID$, radiusFactor=radiusFactor_s$ID$, narrowBand=adjustedNarrowBandWidth_s$ID$)\n\ flipVelocityUpdate(vel=vel_s$ID$, velOld=velOld_s$ID$, flags=flags_s$ID$, parts=pp_s$ID$, partVel=pVel_pp$ID$, flipRatio=flipRatio_s$ID$)\n"; @@ -347,7 +347,7 @@ def liquid_step_mesh_$ID$():\n\ # Vert vel vector needs to pull data from vel grid with correct dim\n\ if using_speedvectors_s$ID$:\n\ interpolateMACGrid(target=vel_sm$ID$, source=vel_s$ID$)\n\ - mVel_mesh$ID$.setSource(vel_sm$ID$, isMAC=True)\n\ + mVel_mesh$ID$.setSource(grid=vel_sm$ID$, isMAC=True)\n\ \n\ # Set 0.5 boundary at walls + account for extra wall thickness in fractions mode + account for grid scaling:\n\ # E.g. at upres=1 we expect 1 cell border (or 2 with fractions), at upres=2 we expect 2 cell border (or 4 with fractions), etc.\n\ |