Finite formulation method(FFM) is a new discrete numerical method which complies with the laws of physics and uses global variable defined on geometry construction of two nested grids to obtain discrete equations. On the basis of the finite formulation method of temperature field mathematical model,the paper discusses the implementation of grid-based mapping convection boundary treatment and programming,and gives the basic idea of designing calculation program. Finally,take a 20kW water-cooled permanent magnet motor 3D temperature field as an example,it analyzes the relationship of the cooling water flow rate and cooling temperature and motor temperature distribution,meanwhile,the values of temperature rise calculated by Finite Element Method(FEM) under the same grid and temperature test verified the accuracy and reliability of the program.