Part 1, but I'll repeat here. This time we'll move the top boundary.
I have a container of water with initial volume $V_0$ and height $L$, open at the top which receives a constant mass flux $\phi$. A sampling line is placed in the container all the way to the bottom which drains the container at some rate $f$. This means the water level drops at a speed $v = fL/V_0$. Thus, in terms of dimensionless time $T = Dt/L^2$ and position $X=x/L$,
$$ \frac{\partial C}{\partial T}=\frac{\partial^2 C}{\partial X^2}+P\frac{\partial C}{\partial X},\quad P=\frac{vL}{D} $$
where I use $+$ for the advection term because $X=0$ will be the bottom of the container, $X=L$ will be the top, and the velocity is in the $-X$ direction. Because the top boundary is moving as the water drains, we can change coordinates to keep the spatial grid fixed instead. I'm adapting the procedure from this paper. We have
$$ X \in [0,\delta(T)],\quad\delta(T) = 1-PT\\[1em] Y = \frac{X}{\delta},\quad Y\in[0,1] $$
Now we transform the original PDE for $C(X,T)\to\tilde C(Y,T)$ with
$$ \frac{\partial C}{\partial X}=\frac{1}{\delta}\frac{\partial \tilde C}{\partial Y}\\[1em] \frac{\partial^2 C}{\partial X^2}=\frac{1}{\delta^2}\frac{\partial^2 \tilde C}{\partial Y^2}\\[1em] \frac{\partial C}{\partial T}=\frac{\partial \tilde C}{\partial T} + \frac{\partial \tilde C}{\partial Y}\frac{\partial Y}{\partial T} = \frac{\partial \tilde C}{\partial T} + \frac{\partial \tilde C}{\partial Y}(-\frac{Y}{\delta})(-P) $$
which we substitute in to get,
$$ \frac{\partial \tilde C}{\partial T} = \frac{1}{\delta^2}\frac{\partial^2 \tilde C}{\partial Y^2} + \frac{P(1-Y)}{\delta}\frac{\partial \tilde C}{\partial Y} $$
Now my question is how to set the boundary conditions. In Part 1, user Rigel confirmed that the bottom boundary should be
$$\frac{\partial C}{\partial X}\Bigg\rvert_{X=0} = 0$$
which lets concentration flow out but not diffuse out. The top boundary I still don't understand. There is a constant flux coming in, which was handled in Part 1 by using the flow like $vC(L,T) = \phi$, but there is no longer any velocity at the top boundary with these coordinates as $P(1-Y)\to 0$ as $Y\to 1$. If there's no velocity, and there can't be diffusion across the top, do we have to use a source term to introduce the mass flux?