I am interested in solving the PDE system
$$\frac{\partial\rho}{\partial t}(x(t),t)+u(t)\frac{\partial \rho}{\partial x}(x(t),t)=0, \qquad (\text{EQ} \ 1)$$
$$\rho(x(t),t) u'(t)=-\frac{\partial p}{\partial x}(x(t),t)+\rho(x(t),t)g(x(t),t) \qquad (\text{EQ} \ 2)$$
where $p(x(t),t)$, $g(x,t)$, $u(0)=u_0$, and $f(x)=\rho(x,0)$ are known. I attempted to solve this PDE with the method of characteristics.
For an arbitrary variable $s$ I defined $h(s)=\rho(x(t(s)),t(s))$.
By the multivariable chain rule,
$$h'(s)=\frac{d}{ds}\rho(x(t(s)),t(s))=\frac{\partial\rho}{\partial x}\frac{dx}{ds}+\frac{\partial \rho}{\partial t}\frac{dt}{ds}.$$
Setting $$\frac{dt}{ds}=1, \qquad \text{(EQ 3)}$$ $$\ \frac{dx}{ds}=u(t(s)), \qquad \text{(EQ 4)}$$
$$h'(s)=\frac{\partial\rho}{\partial x}u(t(s))+\frac{\partial \rho}{\partial t}(1)=0$$ by (EQ 1).
Integrating EQ 3 with respect to $t$, I get
$$t=s+C$$ for some unknown constant $C$.
Setting $t(0)=0$, I get $t(s)=s$.
So EQ 4 becomes
$$\frac{dx}{dt}=u(t).$$
Integrating with respect to $t$, I obtain
$$x(t)-x(0)=\int_0^t u(s) ds.$$
Hence $$x(0)=x(t)-\int_0^t u(s) ds$$
Since $h'(s)=0$, h is constant and $h(t)=h(0)$.
By the definition of $h$,
$$\rho(x(t),t)=h(t)=h(0)=\rho(x(0),0)=f(x(0))=f\left(x(t)-\int_0^t u(s)\right)\qquad \text{(EQ 5)}$$.
Substituting EQ 5 into EQ 2, I get
$$f\left(x(t)-\int_0^t u(s)\right)u'(t)=-\frac{\partial p}{\partial x}(x(t),t)+f\left(x(t)-\int_0^t u(s)\right)$$
To remove the integral, I defined an auxiliary function $U(t)=\int_0^t u(s)ds$.
Then, by the Fundamental Theorem of Calculus, $U'(t)=u(t)$ and $u'(t)=U''(t)$.
Hence $$f\left(x(t)-U(t)\right)U''(t)=-\frac{\partial p}{\partial x}(x(t),t)+f\left(x(t)-U(t)\right)g(x(t),t)$$
$$U''(t)=-\left(f\left(x(t)-U(t)\right)\right)^{-1}\frac{\partial p}{\partial x}(x(t),t)+g(x(t),t).$$
Since $x(t)$, it makes to either set $x(t)=0$ or $x(t)=U(t)$.
Setting $x(t)=0$, I obtain
$$U''(t)=-\left(f\left(-U(t)\right)\right)^{-1}\frac{\partial p}{\partial x}(0,t)+g(0,t).$$
Since the functions $p$, $g$, and $f$ are known but arbitrary this is equivalent to solving the problem
$$U''(t)=F(U(t),t)\qquad \text{(EQ 6)}$$
for some known but arbitrary function $F$.
The initial conditions for this problem would be $U(0)=\int_0^0 u(s) ds=0$ and $U'(0)=u(0)=u_0$.
EQ 6 is generally a second-order nonlinear ODE which contains both the independent variable $t$ and the dependent variable $U$ which makes it difficult if not impossible to solve.
If I were able to solve for $u$, then I know that $\rho(x(t),t)=f\left(x(t)-\int_0^t u(s)\right)$, so I would have a closed form solution for $\rho$.
I think that the method of characteristics might not be the way I should be approaching this problem. The other way I think of solving PDEs is with separation of variables since (EQ 1) and (EQ 2) are linear in $\rho$, but I have no boundary condition on $\rho$. Additionally separation of variables usually relies on a trigonometric function being derived from a second-order spartial derivative but (EQ 1)-(EQ 2) is a first-order system.
The question asks for "implicit solutions" for $\rho$ and $u$. I interpret this as meaning I need to derive an equation involves $u$, the functions that you would accept in a closed-form solution (trigonometric functions, logarithms, etc), and possibly $\int_0^t u(s)ds$? If an "implicit solution" can involve a second-order ODE then I would be done but I doubt that this is the case. Because (EQ 5) gives a closed-form solution for $\rho$ I am only concerned with finding $u$.
I put the linear PDE and the non-linear equations tags because the system is nonlinear when $\rho$ and $u$ are considered simultaneously, but it is linear in $\rho$ and in $u$. Correct me if I am wrong.
EDIT: The question did not make it clear whether $p$ and $g$ had any dependence on $x$ or $t$ (it did not give arguments for $g$ and $\frac{\partial p}{\partial x}$ like it did for $\rho$ and $u$). I don't know much about fluid dynamics so I assumed that they both depended on both $x$ and $t$. However, if $p$ and $g$ are both independent of $t$, then I know exactly how to solve this problem. Reading elsewhere I found that $g$ is generally independent of both $x$ and $t$. If it is reasonable to assume that pressure is independent of time then that would explain why the problem shouldn't have an unsolvable nonlinear second order ODE in it.
Thanks, Andrew Murdza