Avoid ArrayIndexOutOfBoundsExceptions in WaterModel#doWaterDisplacement by checking indexes before lookup.