You can find a discussion of it in this (unfortunately gated) article, in the context of med. They discuss two types. The first is "swearing so as to enable empathy and catharsis," in which you swear to mirror the feelings of the patient and spur him to discuss those feelings further. The second is "swearing to create a feeling of social equality," which shows that you are willing to break pointless rules, and instead care about actual results. Generally, they argue that swear words can lend an emotional edge to a sentence that other words cannot. I agree.
It might have been nice if they had discussed swear word overuse. One high school bball coach of mine used to swear only sparingly, but when he did you really listened. Yet if you are known to swear almost never, when you do swear that event itself might detract attention from what you are talking about. Thus it is tricky to approach the equilibrium of swearing that maintains optimal effectiveness in case of maximum need. Very fucking tricky.