A unified variational framework and applications for flow-induced vibration in cavitating flows