FLRW cosmology with a scalar field: what are the phase-space variables? I'm studying a Friedmann-Lemaitre-Robertson-Walker (FLRW) cosmology model with a simple scalar field as source (no dust-like matter, no radiation, no cosmological constant).  For the moment, the field is a Klein-Gordon (KG) scalar only, of potential $\mathcal{V}(\phi) = \frac{1}{2} \; m^2 \, \phi^2$ (later, I'll generalize it to the quartic potential used in inflation theory).
The equations that I need to solve are these (FLRW equations, and the KG equation) :
\begin{gather}
\frac{\dot{a}^2}{a^2} + \frac{k}{a^2} = \frac{8 \pi G}{3} \; \rho,\tag{1} \\[12pt]
\frac{\ddot{a}}{a} = -\, \frac{4 \pi G}{3} (\rho + 3 p), \tag{2} \\[12pt]
\ddot{\phi} + 3 \frac{\dot{a}}{a} \; \dot{\phi} + \mathcal{V}^{\, \prime} = 0. \tag{3}
\end{gather}
The variables are $a(t)$, $\phi(t)$.  The scalar field density and pressure are these :
\begin{gather}
\rho = \frac{1}{2} \; \dot{\phi}^2 + \mathcal{V}(\phi), \tag{4} \\[12pt]
p = \frac{1}{2} \; \dot{\phi}^2 - \mathcal{V}(\phi). \tag{5}
\end{gather}
The initial conditions are $\phi(0) = \phi_0$ and $\partial_t \, \phi \, |_{t = 0} = \dot{\phi}_0$ (two arbitrary real numbers) and the mass parameter $m$ (an arbitrary positive number).  For the scale factor, I set $a(0) = 1$.  Since the expansion rate at $t = 0$ is $H_0 \equiv \frac{\dot{a}}{a} |_{t=0}$ (the Hubble constant), its inverse could be used as an unit of time.  So I set the initial condition $\dot{a}(0) = 1$.
I now could numerically solve equations (2) and (3) using $\phi_0$, $\dot{\phi}_0$ and $m$ as arbitrary input, and draw nice graphics of the evolution of $a(t)$ and $\phi(t)$.
Now the question is what should be the proper variables to define the phase-space of the scale factor and of the field?  Currently, I'm using these:
\begin{equation}\tag{6}
\big(\, a, \; \dot{a} \big),
\qquad \big( \, \phi, \; \dot{\phi} \big).
\end{equation}
I suspect it should be something more complicated.  From a lagrangian that I'm not writing here ($p_q = \frac{\partial L}{\partial \dot{q}}$ is the canonical momentum associated to the $q$ variable), I suspect the proper variables to be used in a phase-space diagram are these instead:
\begin{equation}\tag{7}
\big(\, a, \; -\, 6 \, a \, \dot{a} \big),
\qquad \big( \, \phi, \; a^3 \, \dot{\phi} \big).
\end{equation}
But when I plot the graphics of those variables, I'm getting weirdly deformed patterns that are hard to rescale.  Apparently, variables (6) are giving better results (nicer to look at).  I need advices on this.

EDIT: About the FLRW cosmology of a simple KG scalar field, is there any papers that discuss the results (from numerical integration)?  I would like to compare my results with something, since I never saw any discussion of this model in all the General Relativity books that I have (except the usual inflation scenarios with slow roll approximations or other variations...).
 A: I will try to convey some considerations regarding the phase-space of scalar field cosmology, extracted from personal experience as well as from the reference https://arxiv.org/abs/1309.2611 given by @Someone and the comment by @Michael Seifert.  Hopefully, at the same time, this will also help in answering the question.
Scalar field cosmology is an autonomous Hamiltonian system.  This means that:

*

*the system can be described by a Hamiltonian function that does not depend explicitly on the time coordinate (it obviously can depend on time, but only through the basic functions $a(t)$, $\phi(t)$ and their derivatives);

*Hamilton-Jacobi equations reproduce Einstein's equations (the Friedmann equation, in fact, is a parametrized form of the constant-energy surface of the Hamiltonian).

A well-known property of Hamiltonian systems is that they satisfy Liouville's theorem: the volume of a region of phase-space is invariant under time evolution.  This theorem, in particular, tells us that the Hamiltonian vector field that describes the evolution of the trajectories in the phase-space is divergence-free.  In terms more familiar to people in the field of dynamical systems applied to cosmology, this means that the phase-space does not present sources or sinks.  However, in most of the works appearing in the literature we hear people talking about "past or future attractor solutions", which are effectively points in the parameter space in which the trajectories diverge or converge.  Given that the system is undoubtfully Hamiltonian, how is the presence of attractors compatible with Liouville's theorem in this case?  What the theorem as stated above doesn't specify is that, for a Hamiltonian system, there are no sources and sinks in the phase-space if the system is expressed in canonical coordinates.
Coming to your specific example, in a purely Hamiltonian perspective the variables in eq.(7) are the canonical ones, in the sense that given the generalized coordinates $a$ and $\phi$, then $p_a=-6 a \dot{a}$ and $p_{\phi}=a^3 \dot{\phi}$ are their respective conjugate momenta.  Hence the phase-space in coordinates eq.(7) doesn't present sinks or sources.  However, the variables given by eq.(6) are not the canonical ones and that is why a representation of the phase-space in these coordinates shows the presence of sinks and sources.  This doesn't mean that the non-canonical coordinate system is wrong: it simply hides part of the Hamiltonian character of the system.  In some situations it can actually be more useful to use a non-canonical coordinate system, as the physical interpretation of the states in the phase-space might be more transparent.
