A catastrophe model for the stability of ships