How do you get to team magma and battle Groudon?

Go into the groudon cave and beat team magma. and then catch groudon with ultra ball or timer ball.