Decomposition method for solving parabolic equations in finite domains