Semigeostrophic equations in physical space with free upper boundary