12 Now in view of our repeated, nay our unbroken assertion both that it was the Only-begotten Son of God Who was uplifted on the cross, and that He was condemned to death Who is eternal by virtue of the origin which is His by the nature which He derives from the eternal Father, it must be clearly understood that He was subjected to suffering of no natural necessity, but to accomplish the mystery of man's salvation; that He submitted to suffering of His own Will, and not under compulsion. And although this suffering did not belong to His nature as eternal Son, the immutability of God being proof against the assault of any derogatory disturbance, yet it was freely undertaken, and was intended to fulfil a penal function without, however, inflicting the pain of penalty upon the sufferer: not that the suffering in question was not of a kind to cause pain, but because the divine Nature feels no pain. God suffered, then, by voluntarily submitting to suffering; but although He underwent the sufferings in all the fullness of their force, which necessarily causes pain to the sufferers, yet He never so abandoned the powers of His Nature as to feel pain.
Source: Homilies on the Psalms (New Advent)