Compartmentalization (psychology)
Compartmentalization is a psychological defense mechanism in which thoughts and feelings that seem to conflict are kept separated or isolated from each other in the mind. Those with post-traumatic stress disorder may use compartmentalization to separate positive and negative self aspects.
Source: Wikipedia — Compartmentalization (psychology) (CC BY-SA 4.0)