I don't think there is a magic formula for it. Just decide that you want to stop thinking about it and think about somehting else every time you find yourself thinking about something that you don't want to think about. It takes a bit discipline in the beginning, because you started to create a habit of thinking about him all day. So start a new one and think about icecream or whatever makes you happy. Or learn a programming language or somthing like this. It will occupy your brain so that you can't think about anything else while doing it.
"Self-abandonment. That is the secret. We have to abandon ourselves to the state, in our love for the state, and in so doing live the life of the state and no more our present state. And to make the state alive, one must become it."
Neville Goddard ~ The Law and the Promise