Mathematics for the fluid earth