I'm interested in modelling the length of a rod as it's gradually heated up and shrinks in length and gets more dense, the rod is porous, and therefore compressible, and the density is variable Suppose I'm considering the conservation of mass: $$\frac{\partial\rho}{\partial t}+\frac{\partial}{\partial x}(\rho u)=0$$ I wish to integrate this equation numerically, to make this easier, I introduce the new coordinates, $t'=t$ and $x'=x/L(t)$ where $L(t)$ is the length of the rod at time $t$. This makes the equation: $$L(t)\frac{\partial\rho}{\partial t'}+x'L'(t)\frac{\partial\rho}{\partial x'}+\frac{\partial}{\partial x'}(\rho u)=0$$ The boundary condition at $x'=0$ isn't an issue but I'm not sure about what boundary condition to use at $x'=1$. Although this isn't the full model, there are equations for both $u$ and temperature, $T$ that I have equations for, but this one is making me scratch my head. The total mass is given by: $$M=\int_{0}^{L(t)}\rho dx$$ Differentiating this shows that $u(t,L(t))=L'(t)$, but I think there us also an issue for the density, $\rho$. Can anyone suggest anything?