Examples of ferromagnetic materials include iron, cobalt, nickel, and an alloy called Alnico. The atoms in these materials have permanent magnetic moments, and a phenomenon called exchange coupling takes place in which the magnetic moments of nearby atoms line up with one another. This forms domains, small neighborhoods where the magnetic moments are aligned. Typical dimensions of domains are 0.1 to 1 mm.
When a ferromagnetic material is not magnetized it still has domains, but the domains have random magnetization directions. If an external field is turned on two things happen. Domains aligned with the field grow at the expense of domains aligned against the field, and the magnetization direction within each domain tends to shift towards the direction of the applied field.
What direction is the applied magnetic field in the simulation?
If the external field is removed the ferromagnetic material does not return to its original state, but retains some of its net magnetization. The degree to which the magnetization is retained depends on the material.
In "hard" ferromagnetic material it is hard to shift the domains, so a significant fraction of the magnetization is retained when the external field is removed. This is how permanent magnets are made.
In "soft" ferromagnetic material the domains more closely follow the external field, and not much net magnetization remains when the external field is removed. A good application of this is an electromagnet, which has a strong magnetic field when a current is turned on and very little field when the current is removed.
A ferromagnetic material has a hysteresis curve that shows the net field as a function of H. In the case of a cylindrical piece of ferromagnet with a coil of wire wrapped around it, for instance, this can be interpreted as a plot of the net field as a function of the current through the coil, as the current is cycled from some maximum in one direction to the same maximum in the other.
The curve is double-valued - the value of B, the net field, depends not just on the magnetic field from the current in the coil but also on whether the current is increasing or decreasing. B generally lags behind H because the domains don't like to change.
The area enclosed by the B-H curve is proportional to the work required to take the material around the cycle once.
Another feature of the graph is that it levels off at large values. This is known as saturation, the point where most of the domains are aligned and, essentially, maximum M is reached. Increasing the current in the coil past this point doesn't get you very much.