Brains and breakups

Why does the brain fixate on a breakup? Is there a primal reason? I broke up with my partner a few days ago, and suddenly he is all I can think about. I wasn’t thinking of him this often while we were together. Why once we’re split up? Why is the brain so obsessed with the situation now? It’s like I suddenly have a compulsive desire to check out his social media and I never ever did that before. It’s frustrating!

Please help me understand what my brain is doing.