Ex verbally abusive and threating to child

The Ex wife has primary custody of our 12 year old daughter. the Ex has a temper and regulary takes out her frustrations on my daughter in the form of profanity laced tirades and threats of physical violence I have tried to talk to her about it but to no avail she seems to think she can do or say anything she wants and it’s affecting my daughter’s performance at school and her overall demeanor she has told me she is fearful of the Ex.
Some sort of action needs to be taken here and it needs to be done the right and legal way, my question is what can I bring to bear to have this situation addressed?

If you believe your child is at risk for immediate and irreparable harm you may file an action for emergency custody.