Nonlinear waves in general relativity and fluid dynamics