Behold, I have refined you, but not as silver, I have tried you in the furnace of affliction. – Isaiah 48:10
Afflictions are ascribed in the Scriptures to purge our sin. In them God purges the dross and filth of the vessels of his house. The ‘fire’ tries the ways and works of men, and consumes the hay and stubble, and purifies the gold and silver (1 Cor. 3:12-13). It does this effectively by design of the Holy Spirit. Affliction removes the beauty, allurements, and comfort of all created good things that often tempt us to commit folly and lewdness with them; that is, to embrace and cleave to them inordinately. God designs affliction to wither all the flowerings of this world in the minds of men; to reveal their emptiness, vanity, and insufficiency to give relief. Affliction intercepts the delights that are apt to emerge between the world and our affections and by which our minds are polluted. Our minds and affections can be polluted both by sinful objects and by objects which we love too much. Affliction takes the edge off affections that spring up and cause our defilements and that are always ready to press us into the service of lust, like the horse into the battle, with madness and fury. Chastisement delivers us from the pollution of sin and makes us partakers of God’s holiness. Through afflictions God draws forth all the faces of the Holy Spirit unto a constant, diligent , and vigorous exercise, to cleanse the soul from the pollution of sin. Times of affliction, however, are times when we need special grace for comfort and relief, that we may be supported under our sufferings. There is no other way to sanctify and use afflictions but by the assiduous exercise of grace. This God calls for designs; and without it afflictions have no other end but to make men miserable; for they will either find no deliverance or they will brought into further misery and ruin.
– from John Owen, Works, III:447-448