Magnetism in transition metals at finite temperatures: I. Computational model