From Water Drop Tank · v2. Edit this definition in its source simulation.
Source
behavior PlanRedistribution for FreeSurfaceWater
{
update {
let target = max(self.nextKind - 1.0, 0.0) * self.rho + self.recipient * (self.mass + self.reserve);
let excess = self.mass - target + self.reserve;
let count = sum n in neighbors[FreeSurfaceWater using D3Q19] { n.recipient };
let hasRecipient = min(count, 1.0);
set self.targetMass = clamp(target, -1000000.0, 1000000.0);
set self.share = clamp(hasRecipient * excess / max(count, 1.0), -1000000.0, 1000000.0);
set self.carried = clamp((1.0 - hasRecipient) * excess, -1000000.0, 1000000.0);
}
}Building blocks
These exact versions are included when you reuse this artifact.