If the mechanical energy is used directly by machinery , such as for pumping water , cutting lumber or grinding stones , the machine is called a windmill . If the mechanical energy is used to drive machinery , such as for grinding grain or pumping water , the device is called a windmill or wind pump .