Domain walls separating regions of ferroelectric material with polarization oriented in different directions are crucial for applications of ferroelectrics. Rational design of ferroelectric materials requires the development of a theory describing how compositional and environmental changes affect domain walls. To model domain wall systems, a discrete microscopic Landau-Ginzburg-Devonshire (dmLGD) approach with A- and B-site cation displacements serving as order parameters is developed. Application of dmLGD to the classic BaTiO3 , KNbO3, and PbTiO3 ferroelectrics shows that A-B cation repulsion is the key interaction that couples the polarization in neighboring unit cells of the material. dmLGD decomposition of the total energy of the syste...