I introduce an innovative methodology for deriving numerical models of systems of partial differential equations which exhibit the evolution of spatial patterns. The new approach directly produces a discretisation for the evolution of the pattern amplitude, has the rigorous support of centre manifold theory at finite grid size $h$, and naturally incorporates physical boundaries. The results presented here for the Swift-Hohenberg equation suggest the approach will form a powerful method in computationally exploring pattern selection in general. With the aid of computer algebra, the techniques may be applied to a wide variety of equations to derive numerical models that accurately and stably capture the dynamics including the influence of possibly forced boundaries.