Compartmentalization is a form of 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. It may be a form of mild dissociation; example scenarios that suggest compartmentalization include acting in an isolated moment in a way that logically defies one's own moral code, or dividing one's unpleasant work duties from one's desires to relax. Its purpose is to avoid cognitive dissonance, or the mental discomfort and anxiety caused by a person having conflicting values, cognitions, emotions, beliefs, etc. within themselves.

Compartmentalization allows these conflicting ideas to co-exist by inhibiting direct or explicit acknowledgement and interaction between separate compartmentalized self-states.

Psychoanalytic views

Psychoanalysis considers that whereas isolation separates thoughts from feeling, compartmentalization separates different (incompatible) cognitions from each other. As a secondary, intellectual defense, it may be linked to rationalization. It is also related to the phenomenon of neurotic typing, whereby everything must be classified into mutually exclusive and watertight categories.

It has been said that when thinking about death people end up compartmentalizing, and they are in a mode of denial and acceptance about it, but they both have the result of making the thinking individual very passive.

Otto Kernberg has used the term "bridging interventions" for the therapist's attempts to straddle and contain contradictory and compartmentalized components of the patient's mind.

Vulnerability
Compartmentalization can be positive, negative, and integrated depending on the context and person. Compartmentalization may lead to hidden vulnerabilities related to self-organization and self-esteem in those who use it as a major defense mechanism. When a negative self-aspect is activated, it may cause a drop in self-esteem and mood. This drop in self-esteem and mood is what the observed vulnerability is attributed to.

Social identity

Conflicting social identities may be dealt with by compartmentalizing them and dealing with each only in a context-dependent way.

Post Traumatic Stress Disorder (PTSD) and Compartmentalization 
Those who have PTSD often compartmentalize positive and negative self-aspects more than those without PTSD; this helps keep the negative self-aspects from overtaking the positive self-aspects. Positive self-concept can be kept safe through the use of compartmentalization, specifically for those who have experienced sexual trauma and have, subsequently, been diagnosed with PTSD.

Mindfulness and Compartmentalization 
Mindfulness meditation may help reduce compartmentalized self-knowledge. Also, those who have greater trait mindfulness may have less negative self-concepts about themselves.

Literary examples

In his novel, The Human Factor, Graham Greene has one of his corrupt officials use the rectangular boxes of Ben Nicholson's art as a guide to avoiding moral responsibility for bureaucratic decision-making—a way to compartmentalize oneself within one's own separately colored box.

Doris Lessing considered that the essential theme of The Golden Notebook was "that we must not divide things off, must not compartmentalise. 'Bound. Free. Good. Bad. Yes. No. Capitalism. Socialism. Sex. Love...'".

See also 
 Catharsis
 Confirmation bias
 Doublethink
 Idealization and devaluation
 Intellectualization
 Psychodynamics
 Rationalization (psychology)
 Sublimation
 Suspension of disbelief

References

Cognition
Defence mechanisms