Thermal effects in optical systems