Thermal flows through periodic structures can be found in many industrial applications. By taking advantage of the relationships of flow and thermal fields in periodic modules, computer simulations can be performed over a one-module domain; however, the results can be applied to individual modules. At present this approach is limited to systems with relatively simple boundary situations: either the temperature or heat flux can be specified over the wall surfaces. To address this concern, we develop a temperature decomposition method that can work with more general boundary situations, including the mixed (temperature on some locations and heat flux on other locations) and the convective boundary conditions. The regular temperature is split into two components, namely the transient and equilibrium parts. The transient part decays with the flow and the temperature approaches the equilibrium part gradually. The two components can be solved independently under similar governing equations but different wall and inlet/outlet boundary conditions. The regular temperature can then be quickly obtained by adding them together according to the transient coefficients of individual periodic modules. The algorithm and implementation are described in details, and the method is discussed thoroughly from mathematical and physical considerations. Carefully designed example simulations are also presented to demonstrate the capacity and usefulness of this method for future simulations of thermal periodic flows using various numerical schemes.