I have an $N$-Body simulation for the evolution of the universe. It uses a hybrid Tree Particle-Mesh scheme to compute the forces. The tree code used Newtons law of gravity:
$$\textbf{F}_i = -G \sum_{j\neq i} \frac{m_i m_j}{|\textbf{x}_i - \textbf{x}_j|^3} (\textbf{x}_i - \textbf{x}_j). $$
The particle mesh method computes force by solving the poisson equation for potential in through a Fourier transform:
$$\nabla^2 \phi = 4 \pi G \rho.$$
The particle mesh method accounts for periodic boundary conditions and the tree code is used only for dense regions. Currently the simulation does not account for the expansion of the universe. Is there any way of adapting the equations or the methods to take expansion into account?