Numerical simulation of the effects of space charge and Schottky barrier on ferroelectric thin films