Flux trapping in superconducting accelerating cavities during cooling down with a spatial temperature gradient