Nightmares and PTSD – PTSD: National Center for PTSD
https://www.ptsd.va.gov/public/problems/nightmares.asp
One treatment is Imagery Rehearsal Therapy (IRT). In IRT, the person who is having nightmares, while awake, changes how the nightmare ends so that it no longer upsets them. Then the person replays over and over in their minds the new dream with the non-scary ending. Research shows that this type of treatment can reduce how often nightmares occur.