Pericarditis is an inflammation of the pericardium, or the sac that surrounds the heart. It is often related to a viral infection and can cause chest pain.