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.
This commit is contained in:
parent
2dad5a9754
commit
31ad8bda74
|
@ -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\
|
||||
|
|
Loading…
Reference in New Issue