film, gives $$\label{eq:ena2}
\frac{en}{a^{2}} = \frac{\int_{0}^{L}dz P(z) - \epsilon_{\infty} V}{L},$$ with $V$ the potential difference across the film. Using this to eliminate $en/a^2$ in equation , and setting $V=0$ for the short-circuit geometry, we obtain $$\label{E}
E(z) = \frac{P_\mathrm{ave} - P(z)}{\epsilon_{\infty}},$$ with $P_\mathrm{ave}$ the average polarization of the film. Equations  and are evaluated at discrete positions $z = i_z a$, and together with equation  form a closed set that can be solved self-consistently.

shows the results of simulations for a film that is $N_L = 50$ layers thick. The figure illustrates two main points: First, the results depend qualitatively on whether or not electric fields are included in the simulation, even in the short-circuit geometry (for which naive considerations suggest the field vanishes); second, for fixed $J_0$, the value of $J_1$ has a large impact on the polarization.

The effects of electric fields in thin films were discussed at length by Kretschmer and Binder [@kretschmer79], and the results in serve as a reminder of their importance. In (a), where electric fields are not included, the polarization is reduced at the surfaces and increases to its bulk value over a length scale set by the correlation length. In the ferroelectric phase, 