Analytical solution of transient barometric formula for fluid in one dimension Consider a column of fluid of length $L$, with initial density $\rho_0$ and initial velocity ($u_0 =0$) everywhere. Now at time $t=0$ gravity is switched on. No-slip boundary conditions are assumed at both end of the fluid column.
We know that after a while column will attain a steady state with fluid everywhere at rest and density as exponential function of distance from either end.
Continuity equation is
\begin{eqnarray}
\frac{\partial\rho}{\partial t} + \frac{\partial(\rho u)}{\partial x} = 0
\end{eqnarray}
Navier-stokes equation for fluid in one dimension is
\begin{eqnarray}
\rho\left[\frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} \right] &=& -\frac{\partial P}{\partial x} + f_{external} \nonumber \\
&=& -\frac{\partial\rho}{\partial x}c^2_s - \rho g 
\end{eqnarray}
Here I assume shear forces are zero since the system is one dimensional. 
In the steady state $u=0$ and $\frac{d\rho}{dt} = 0$ so we get,
\begin{eqnarray}
\frac{d\rho}{dx}c^2_s &=& - \rho g  \\
\frac{d\rho}{\rho} &=& - dx \frac{g}{c^2_s} \\
\rho &=& \rho'\exp\left(-\frac{g}{c^2_s}x \right)
\end{eqnarray}
where $\rho'$ is evaluated by mass conservation equation.
\begin{eqnarray}
\rho_{0} L = \int^{L}_0\rho'\exp\left(-\frac{g}{c^2_s}x \right)dx
\end{eqnarray}
Where I assume hydrostatic pressure($P$) is proportional to density ($\rho$).
Is it possible to solve these equations(assuming they are correct) as a function of time?
To start with, I tried to get velocity ($u$) profile for the time very close 
to initial time. When the time is really small $t<<1$, For the Navier-Stokes equation we assume spatial variation in density($\rho$) and velocity($u$) is yet to develop, so that we get
\begin{eqnarray}
\frac{du}{dt} &=& -g \\
u &=& -gt \hspace{0.5cm} t <<1
\end{eqnarray}
I am not sure if it is allowed to assume initial spatial variation small compared to time variations in the system. Even if allowed, I am not able to go any further.
Also I feel the solution for density and velocity depend upon viscosity of the fluid but viscosity appears nowhere in the formulation. Do I need to include shear forces? 
 A: I don't think you can solve this problem analytically, as it is highly nonlinear (so no spectral methods) and you cannot do any seperation of variables or similar as far as I can see. I'm not even sure that you will reach a steady state since you don't have any energy dissipation mechanism and there might appear sound waves the moment you switch on gravity. Moreover, you have Robin boundary conditions: from $u=0$ at $x=0$ we get 
$$ (-c_s^2\partial_x \rho - \rho g )|_{x=0}=0$$
from the Navier Stokes equation . The problem is essentially two-dimensional with (x,t) as the variables. The only way out is to solve it numerically. However, you'll probably run into troubles with these boundary conditions. Maybe some lattice Boltzmann method will do the trick. I know that these can treat various boundary conditions easily but I never personally implemented one of these.  
A: You could solve numerically the first problem that you postulate, but the solution will not converge to the steady state solution you solve later. 
In the initial condition that you propose and in the steady state solution, in both cases the energy of the fluid is purely gravitational, since it is not moving. But the homogeneous column has more potential energy than the one associated to the barometric solution. Therefore, for any consistent solution that evolves from your initial condition that would have more mass concentrated in the lower parts of the pipe, there will be a remanent of kinetic energy that will keep the fluid moving. As @maze-cooperation indicates, since there is no viscosity you do not have a way to dissipate this energy.
On a purely especulative side note, I would expect the time dependent solution to evolve toward something like a barometric solution, plus a density wave traveling back and forth through the pipe.
