Thermodynamics and phase transitions in model polymer blends and thin films