Sometimes in the debates about whether or not it's OK to be religious if you're a scientist or somebody who accepts science, some will say that those who are scientists but also religious "compartmentalize". The implication is usually negative, and sometimes is explicitly described as walling off your scientific good sense when considering religion, and walling off the doctrines of your faith when considering science.
Of course, such a simplistic picture is far from the truth.
The truth is, though, that physicists already compartmentalize, even within Physics! Consider fundamental physics. We have two extremely successful theories, which have stood up to every experimental test we've thrown at them: Quantum Mechanics (QM) and General Relativity (GR). Quantum Mechanics does a great job of describing the behavior of atoms, molecules, subatomic particles, solids, and so forth. General Relativity does a great job of describing the behavior of gravitating systems, such as the orbit of the Earth, the Solar System, the Galaxy, and the Universe. However, we know that they can't both be right, because when you get into the regime where you need to consider both-- a regime where densities are so high that you can't ignore gravity even on small scales, and where you can't ignore quantum mechanics when doing gravity-- everything breaks down.
So what do we do? We compartmentalize. When dealing with gravity and the evolution of gravitational systems, we use GR, a continuous theory, and don't worry about QM. When dealing with the interactions of particles that require QM, we don't include gravity in those interactions at all-- at most, we may do QM on a curved spacetime background. And, we admit that we just don't know what happens where the two intersect. There are some-- such as string theorists-- who are trying to work in the region where the two intersect, and, tellingly, there are other scientists who argue that what string theorists are doing isn't really proper science.
Given that physicists compartmentalize themselves, it should be reasonable to suppose then that a degree of compartmentalization is not only necessary, but eminently reasonable and rational when dealing with science and religion. I don't mean "on Sunday, I believe God created humankind in its present form, and on other days I believe in evolution." That's a pathological compartmentalization. What I mean is that we know there are some things at which science excels describing, specifically the mechanisms of the natural world. And we know that there are some things addressed by religion, and by processes that cannot be described as scientific-- specifically, the existence of God (there being no scientific reason to suppose God exists), human spirituality, morality in the context of a traditional belief system, and faith. Religion may hold no meaning or use for some, and that's fine. But for people for whom it does hold meaning, there are clearly realms that religion can address which science cannot. Likewise, there are clearly realms that science addresses and which religion has tried to address, and where science has without exception proven to be superior.
So we compartmentalize. If we're talking about the processes of the natural world, we look to science, because science has proven over the centuries to be the right "way of knowing" to understand those processes, make predictions about them, and harness them. If we're talking about spirituality and faith, we look to religion, because the sorts of questions one asks there by and large aren't even meaningful scientific questions. And, unsurprisingly, there may be areas of grey overlap, areas where we aren't sure whether science or religion fully applies. As we understand these areas better, we may come to understand that something we once thought ineffable is in fact well within the domain of science. So we adapt, and adjust our compartments.
Just as it's entirely possible to be a completely consistent physicist while using both GR and QM, it's entirely possible to be a completely consistent rational person while accepting the roles of both science and faith in your life. The key is understanding where each applies, thinking creatively about how they overlap while understanding that it will be controversial and hard to decide, and being willing to adapt your understanding as the human race learns more.