The total energy of a micromagnetic system is given by the Gibbs free energy , which depends on the magnetic polarization, the external field and some (temperature dependent) material parameters. It includes macroscopic contributions such as the Zeeman energy and the magnetostatic energy as well as microscopic contributions like the magnetocrystalline anisotropy energy and the exchange energy. This highlights the intermediate level of micromagnetics as a continuum theory again, which bridges the gap between the macroscopic world and microstructural and quantum mechanical effects.
The external field is independent of the magnetization distribution and the exchange and anisotropy energy are short range interactions, which depend only on the local magnetization distribution. Thus, they can be computed very efficiently. However, the magnetostatic field is a long-range interaction, which is the most expensive part in terms of memory requirements and computation time. Its calculation is usually based on a magnetic vector  or scalar potential (cf. Sec. 3.4). In addition, it is an open boundary problem, for which various methods have been developed [31,32].