If you devide the cross section area of the riser by its circumference you'll get the size of the minimum top gap. This is correct for round and square risers alike.
Be careful though, the top of the barrel buckling in would mean you'll get much less than the minimum, so it would be wise to add some tolerance. Please be aware of the fact there isn't such a thing as a maximum top gap.
In case you are talking about a batch box instead of a j-tube, the recommended top gap is one foot.
Curse your sudden but inevitable betrayal! And this tiny ad too!