rlguy/Blender-FLIP-Fluids

Velocity may not be extrapolated sufficiently far to accomodate CFL number

zx-82 opened this issue · 2 comments

zx-82 commented

Hi,

browsing through the source code, I came across the following possible glitch: Calculating the number of "extrapolation layers" (i.e. L1-distance) this way may significantly underestimate the actual number of layers needed to cover a given euklidian distance (as specified via CFL number).:

void FluidSimulation::_extrapolateFluidVelocities(MACVelocityField &MACGrid,
ValidVelocityComponentGrid &validVelocities) {
int numLayers = (int)ceil(_CFLConditionNumber) + 2;
MACGrid.extrapolateVelocityField(validVelocities, numLayers);
}

I propose to use numLayers = ceil( (3./MT_SQRT3)*(CFLConditionNumber) ) )+3) instead which accomodates enough layers also in the diagonal directions (plus an extra cell diagonal to include all corners of the interpolation stencil)

rlguy commented

Hi, thanks for the report and for this helpful information! That is something I had overlooked.

We should be able to get this change into a future version of the FLIP Fluids addon, hopefully the next version. The next GitHub release will be version 1.5.0 around September 7th 2022.

First we will need to take time to test if this change causes any large differences to the simulation behaviour in case this breaks any example scenes or could cause artists' scenes to function incorrectly on a version update.

rlguy commented

Hi, I wasn't able to completely test this before the release of FLIP Fluids 1.5.0. This has now been tested and does not seem to cause any negative changes. This fix will be included in FLIP Fluids 1.6.0 (Release TBA, before December 7th 2022).

Thanks again for the correction!