We develop an explicit and tractable representation of a twist-grain-boundary phase of a smectic A liquid crystal. This allows us to calculate the interaction energy between grain boundaries and the relative contributions from the bending and compression deformations. We discuss the special stability of the 90 degree grain boundaries and discuss the relation of this structure to the Schwarz D surface.