Every thought and imagination has real substantive existence in the spiritual realm; you could say they are alive. Everything in the spiritual realm is alive, that is the defining characteristic of the spiritual realm: spirit = life.
Our soul is attracted to and collects thoughts and imaginations and memories; it attaches itself to them. It clings to them tightly.
Three categories of things in the spiritual realm...
Ultimately, in the new heavens and new earth,only things pleasing to God exist; everything else is banished for eternity to the lake of fire. The plan of redemption involves segregating things pleasing to God from things displeasing to God (he hates these.)
Nothing in the spiritual realm is ever annihilated; the defining characteristic of life is to live. Ultimately, all of life lives forever.
God allowed for his created creatures to think thoughts and have imaginations and memories displeasing to him. These exist in a segregated bubble within the spiritual realm, separated from God's direct presence. Having original sin, our soul also resides within this bubble separated from God; this is the cloudy glass we see though darkly.
When Jesus died the sacrificial death on our behalf he took on judged sin as part of his nature. God can only look on sin if it has been judged — judged sin becomes holy. In fact, the reason there is sin at all is because God as Judge needs something to judge. In receiving Christ's sacrifice for our sin, the souls of believers take on a new component, the Holy Spirit, as part of their nature. A new bubble of God's holiness appears and grows within our souls. These two aspects are at war, these two bubbles each seeking to overwhelm the other.
Santification and purgatory are two aspects of the same thing: santification occurs while we are alive, purgatory after we have died.
The process is as follows: we have attachments to various thoughts, ideas, imaginations, and memories. Not only that, our mind keeps manufacturing these — it is very active. Because of original sin, not everything the mind manufactures pleases God.
Believers are to please God. This involves sifting through all these thoughts, ideas, imaginations, and memories, and rejecting those displeasing to God. Some are recurring; confronted with it again and again we must reject it again and again.
Those who are martyred for their faith have no need for purgatory; they have already given up the greatest attachment, the attachment to life. All lesser attachments are subsumed under this one. Those redeemed who have died but who are not consigned to purgatory reside somewhere else in the spiritual realm close to Christ, free from the intrigues of the wicked spirits.
I suppose you could say that hell (hades) is the same kind of place as purgatory; a similar process occurs. Since those in hell have chosen to reject Christ who presented himself in full glory to them at their death, they will one by one reject all aspects of goodness and godliness. As they review one by one their thoughts and memories, the wickedness of all the other spiritual garbage they have chosen to keep will repulse the good.
At the great white throne judgment we will finally see the results of the process of santification and purgatory for the redeemed, and antipurgatory in hell for the eternally damned. For the unredeemed, nothing good and godly will remain; why would God cast anything of himself into the Lake of Fire? Before anyone can be cast into the Lake of Fire they must be purged of all goodness, holiness, purity, and godliness.
The phrase "temporal effects of sin" refers to aspects of the sin which do not affect ultimate salvation. Examples are, the harm caused to someone else and the habit formed by committing the sin. The temporal effects of sin result in temporal punishment. No one can truly pay the full price so at some point God intervenes and forgives even this.
For those who doubt that there is such a thing as temporal punishment all you have to do to see that it is true is examine the long train of cause and effect originating from your sin. The mental anguish we have from recognizing that we've harmed someone is a form of temporal punishment. In fact, purgatory is a lot like that: we are confronted with the harm our sins have caused and we grieve over it and ask God to somehow make it all right.
Jesus paid the penalty for our sins so that we can be forgiven and redeemed. But the Bible is clear that we must, ourselves, pay the price for the damage to ourselves and others caused by our sins.
Those in purgatory will end up eternally in God's presence. Purgatory is not the hell of the damned. We must be perfect to enter heaven and purgatory is the place where we become perfect.
Those who are perfect upon dying or who have paid the supreme sacrifice of their life through martyrdom for their faith have no need for purgatory. These enter heaven directly upon death.