Wind is formed when: