Formation of the domain structure by the cooling of ferroelectric surface