# Modeling contamination diffusion in a draining container

I asked this on the Physics site, but it fits much better here, and I now can ask a more specific question.

For the scope of the problem, I have a 250-mL bottle filled with pure water and a sampling line at the bottom slowly draining the bottle to analyze, say 2.5 mL/min. The bottle is on the order of 10 cm high.

Since the bottle is open, a tiny amount of analyte (trace metal) is constantly entering the bottle from the top, at a certain mass flux. I observe that the concentration of this analyte increases over time as expected, but I'm interested in modeling the dynamics, perhaps for different bottle sizes.

First I want to model this with the 1D convection-diffusion equation, but I don't know how to properly apply boundary conditions. If the equation is,

$$\frac{\partial C}{\partial t} = D\frac{\partial^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$

then I choose $$v$$ as the velocity that the liquid is draining (with the numbers I gave, $$0.1$$ cm/min).

For the boundary conditions, I'm unsure (for now I'm ignoring that the top face is moving downwards as the bottle drains). I think the top face should be a Robin boundary; since it has a constant flux, I could do

$$vC - D\frac{\partial C}{\partial x} = \phi, \quad x = 0$$

For the bottom face, I'm wondering if the boundary should simply be

$$\frac{\partial C}{\partial x} = 0, \quad x = L$$

since nothing can diffuse out of the bottom of the bottle, but I allow whatever concentration flows out of the system through the sampling tube to pass by. Is this correct?

Edit: I found a coordinate transform to include the effect of the level dropping, essentially mapping $$x\in[0,\delta(t)]\to y=x/\delta ,y\in [0,1]$$ (now x,y = 0 is the bottom face and y=1 is the top). I adapted the procedure in this paper After this transform, the advection term becomes something like $$v(1−y)$$; because the top boundary is moving due to the coordinate transform, it effectively sees no velocity in the volume there. Now what should the top boundary condition be?

• The boundary conditions should be applied to the flux $q = vC - DC_x$, not just $C_x$. That is a special case when $v=0$. Sep 4 at 14:37
• @whpowell96 So what should the BC be at the bottom? My other thought was that the flux draining is simply the flow rate times the concentration at the drain, $C(L)$ Sep 5 at 23:41
• If nothing is flowing, then flux is zero; i.e., $q\cdot \hat{n}=0$. For one spatial dimension, the normal vector is just a sign change but since it is zero it doesn't matter here. I can write this up as a more detailed answer tomorrow, but it follows from the fact that physical boundary conditions are typically only applied to either the state or the flux. Neumann boundary conditions are a often just special case of the latter. Sep 5 at 23:44
• Let me make sure I didn't confuse the issue. The sample is flowing out the bottom, albeit slowly, through a tiny opening, the sample line. So I thought diffusion wouldn't be important, but if $q = vC - DC_x$ is still appropriate then let's use that. Sep 5 at 23:56
• Is the sample flowing through the bottom at some prescribed rate? If so that would just be another Robin condition $q\cdot\hat{n} = \psi$. I am not familiar with models where the flux is definitionally different depending on where you are in the domain. I would assume a priori that diffusion and convection should be considered everywher in the domain Sep 6 at 0:55

If you are negleting the fact the the level of the flow gets lower as the bottle drains, then you are implicitly assuming that new water comes into the domain at speed $$v$$. Since the analyte inflows at a prescribed rate, too, I would use the condition $$vC=\phi$$ at the top of the bottle, that you can further split into $$v=0.1\mathrm{cm/min}$$ and $$C=\phi/v$$ if you need. If you include the diffusive flux of concentration in the top boundary condition you will potentially allow the analyte to diffuse outwards, depending on the concentration gradinent, which does not make much sense considering your physical system.
• Thanks. Sorry to pivot the question, but I found a coordinate transform to include the effect of the level dropping, essentially mapping $x \in [0,\delta (t)] \to y = x/\delta, y \in [0,1]$ (now x,y = 0 is the bottom face and y=1 is the top). I adapted the procedure in this paper hindawi.com/journals/mpe/2013/384246 After this transform, the advection term becomes something like $v(1-y)$; because the top boundary is moving due to the coordinate transform, it effectively sees no velocity in the volume there. Now what should the top boundary condition be? Sep 14 at 10:57