A mechanical method for solving problems of flow in compressible fluids