Study of the barrier against flux exit from type II superconductors