Micromagnetics of Nd–Fe–B magnets at finite temperature