With this online calculator you can calculate of the water pipe diameter by flow rate.
Formula:
d = √ (4q / πv)
d - inside diameter of pipe
q - water consumption in the pipe
v - speed of water in the pipe
A pipe is a tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances which can flow.