Solution (source code)

= Solution

Define the positive total shear stress by $\tau=\rho[\nu U_z-\overline{u'w'}]$, so the physical wall traction on the fluid opposes the positive flow. The steady mean momentum equation gives
$$
0=-P_x+\tau_z,\qquad\boxed{\tau(z)=\tau_S+P_xz.}
$$
For a driving pressure gradient $P_x<0$, the stress decreases upward. It is approximately constant while
$$
\boxed{z\ll\delta_\tau=\tau_S/|P_x|,\qquad u_*=\sqrt{\tau_S/\rho}.}
$$
An outer boundary-layer height can impose a stricter limit. In the turbulent region outside the viscous or roughness sublayer, the only local neutral scales are $u_*$ and $z$, so $U_z=C u_*/z$. Conventionally write $C=1/\kappa$, where $\kappa$ is the von Kármán constant. Equivalently, a mixing length $\ell=\kappa z$ and stress closure $u_*^2=\ell^2U_z^2$ give the same result. Integration yields the <law of the wall>
$$
\boxed{U(z)=\frac{u_*}{\kappa}\log\frac z{z_0}.}
$$
The <roughness length> $z_0$ is an extrapolation scale, not a statement that the logarithm is valid at the actual solid surface. For a smooth boundary, the viscous inner scales are $z^+=zu_*/\nu$, $U^+=U/u_*$. The viscous sublayer has $U^+\simeq z^+$; farther out $U^+=\kappa^{-1}\log z^++C_s$, corresponding to $z_0=(\nu/u_*)e^{-\kappa C_s}$. For a fully rough boundary, $z_0$ is proportional to a geometric roughness height and viscosity no longer determines the leading profile. The logarithmic region still needs roughness height $\ll z\ll\delta_\tau$.

In local equilibrium, production of <turbulent kinetic energy> by the shear is $P=-\overline{u'w'}U_z\simeq u_*^2U_z$. Neglecting its transport relative to production and <viscous dissipation>,
$$
\boxed{\epsilon\simeq\frac{u_*^3}{\kappa z}.}
$$
Dimensional similarity alone gives $\epsilon\propto u_*^3/z$; the displayed coefficient additionally uses the local energy balance and the logarithmic shear.