Was reading this article http://www.jgallant.com/2d-liquid-simulator-with-cellular-automaton-in-unity/ but couldn’t understand the mechanism in “CalculateVerticalFlowValue”. Is the remaining liquid represent the tile just above the tile “destination liquid”? Would appreciate if can provide simpler example to visualize the mechanism as I couldn’t see the logic behind this code.

```
using UnityEngine;
using System.Collections.Generic;
public class Liquid {
// Max and min cell liquid values
float MaxValue = 1.0f;
float MinValue = 0.005f;
// Extra liquid a cell can store than the cell above it
float MaxCompression = 0.25f;
// Lowest and highest amount of liquids allowed to flow per iteration
float MinFlow = 0.005f;
float MaxFlow = 4f;
// Adjusts flow speed (0.0f - 1.0f)
float FlowSpeed = 1f;
// Keep track of modifications to cell liquid values
float(,) Diffs;
public void Initialize(Cell(,) cells) {
Diffs = new float(cells.GetLength (0), cells.GetLength (1));
}
// Calculate how much liquid should flow to destination with pressure
float CalculateVerticalFlowValue(float remainingLiquid, Cell destination)
{
float sum = remainingLiquid + destination.Liquid;
float value = 0;
if (sum <= MaxValue) {
value = MaxValue;
} else if (sum < 2 * MaxValue + MaxCompression) {
value = (MaxValue * MaxValue + sum * MaxCompression) / (MaxValue + MaxCompression);
} else {
value = (sum + MaxCompression) / 2f;
}
return value;
}
```