In fluid mechanics, characterizing the flow in a pipe is essential to predicting its behavior. The flow pattern can either be laminar (smooth/sheet-like), turbulent (rough/chaotic), or transitioning from laminar to turbulent. Intuitively, flow velocity is a dominant factor in determining the flow pattern: A slow-moving fluid is laminar, while a fast-moving one is turbulent. However, the flow pattern can also be influenced by pipe geometry, fluid viscosity, and fluid density.
Hence, instead of just flow velocity, engineers are using a number that better indicates the flow pattern called the Reynolds Number, Re. For a fluid flowing inside a circular pipe, Re is computed as follows:
Re = D x v x rho / mu where: D = inside diameter of the pipe [m] v = mean flow velocity [m/s] rho = fluid density [kg/m^3] mu = fluid viscosity [Pa.s] or [kg/m/s]
Note: Although it is not customary to use SI units for these quantities, this problem deals with SI units for ease.
We can then adopt the following rule: If Re < 2300, the flow is laminar; if Re > 2900, the flow is turbulent; otherwise, the flow is in transition.
Write a function that accepts a MATLAB variable, x, which is always a 4-element row vector containing the values (in SI) of D, v, rho, and mu in that order. Output the appropriate string among 'LAMINAR', 'TRANSITION', or 'TURBULENT', according to the rule above.
See sample test cases:
>> flow_pattern([0.02 0.1 1000 8.9e-4]) ans = 'LAMINAR' >> flow_pattern([0.02 0.5 1000 8.9e-4]) ans = 'TURBULENT' >> flow_pattern([0.02 0.1 1200 8.9e-4]) ans = 'TRANSITION'