  A variational integrator for ideal magnetohydrodynamics is derived by
applying a discrete action principle to a formal Lagrangian. Discrete exterior
calculus is used for the discretisation of the field variables in order to
preserve their geometrical character. The resulting numerical method is free of
numerical resistivity, thus the magnetic field line topology is preserved and
unphysical reconnection is absent. In 2D numerical examples we find that
important conservation laws like total energy, magnetic helicity and cross
helicity are satisfied within machine accuracy.
