  Despite their formal simplicity, most lattice spin models cannot be easily
solved, even under the simplifying assumptions of mean field theory. In this
manuscript, we present a method for generating mean field solutions to
classical continuous spins. We focus our attention on systems with non-local
interactions and non-periodic boundaries, which require careful handling with
existing approaches, such as Monte Carlo sampling. Our approach utilizes
functional optimization to derive a closed-form optimality condition and arrive
at self-consistent mean field equations. We show that this approach
significantly outperforms conventional Monte Carlo sampling in convergence
speed and accuracy. To convey the general concept behind the approach, we first
demonstrate its application to a simple system - a finite one-dimensional
dipolar chain in an external electric field. We then describe how the approach
naturally extends to more complicated spin systems and to continuum field
theories. Furthermore, we numerically illustrate the efficacy of our approach
by highlighting its utility on nonperiodic spin models of various
dimensionality.
