Lagrangian for Perfect fluid Stress-Energy tensor

The wiki article on the Einstein-Hilbert action for General Relativity says that the stress-energy tensor $T_{\mu\nu}$ is related to the Lagrangian of matter, $\mathcal{L}_M$, by $$T_{\mu\nu}=-2\frac{\delta\mathcal{L}_M}{\delta g^{\mu\nu}}+g_{\mu\nu}\mathcal{L}_M.$$ In FRW cosmology, in the comoving frame, the stress-energy tensor $T^\mu{}_\nu$ for a perfect fluid is given by $$T^\mu{}_\nu={\rm diag}(-\rho,p,p,p)$$ with equation of state $$p=w\ \rho$$ and $$\rho \propto a^{-3(1+w)},$$ where $w$ is a constant.

What is the Lagrangian $\mathcal{L}_M$ that leads to the FRW perfect fluid stress-energy tensor $T_{\mu\nu}$?

• Searching for "general relativity perfect fluid lagrangian" with the search engine of your choosing should point you towards this paper: arxiv.org/abs/1209.2754v1. The authors use matter current conservation to derive the fagrangian of an ideal fluid from the standart definition you gave. There are some non-obvious steps involved but they are referenced. They also give some explicit expressions for simple EoS: The $P=\omega \rho$ case is included. – N0va Jan 30 '17 at 23:00
• Section II of this preprint may be helpful. arxiv.org/abs/1701.00607v2 – Saksith Jaksri Feb 18 '17 at 19:44