# Component Solutions of Diffusion Equation with zero flux at boundaries

I am looking at the reaction of A and B, which react instantaneously and irreversibly (acid and base for example). Hence this is just a diffusion or Fick's law problem.

$$\frac{\partial c}{\partial t} = D\frac{\partial ^2 c}{\partial x^2}$$

where $$c(x,t)=c_A(x,t)-c_B(x,t).$$

The model is a slab of A, with fixed initial thickness of $$\delta$$, immediately adjacent to a slab of B, with fixed initial thickness of $$\delta$$. The domain for both slabs is $$-\delta$$ to $$+\delta$$. The following are the boundary conditions:

at $$t > 0$$ and $$x = -\delta$$: $$\frac{\partial c_A}{\partial x} = 0$$

or in terms of the defined variable c, $$\frac{\partial c}{\partial x} = 0$$

at $$t > 0$$ and $$x = +\delta$$: $$\frac{\partial c_B}{\partial x} = 0$$

or in terms of the defined variable c, $$\frac{\partial c}{\partial x} = 0$$

The initial conditions at $$t = 0$$ are:

$$c(x,0)=c_{A_0} \hspace{1cm} for -\delta\leq x<0$$

$$c(x,0)=-c_{B_0} \hspace{1cm} for\hspace{.2cm} 0< x\leq+\delta$$

Assuming that the diffusion coefficient ($$D$$) for A equals the diffusion coefficient for B and by defining a single variable $$c(x,t)$$, a single domain is created and the solution via separation of variables is (thanks to Ricardo Cavalcanti):

$$c(x,t)= A_0 +\sum_{n=1}^{\infty}A_n\exp\left(-\frac{Dn^2\pi^2t}{4\delta^2}\right)\cos\left[\frac{n\pi}{2\delta}(x+\delta)\right]$$

The coefficients are: $$A_0 = \frac{c_{Ao} -c_{Bo}}{2}$$

$$A_n=\frac{2}{n\pi}(c_{Ao}+c_{Bo})\sin\left(\frac{n\pi}{2}\right)$$

This solution is for $$c$$ where $$c(x,t)=c_A(x,t)-c_B(x,t)$$. How would I explicitly solve for the variables $$c_A$$ and $$c_B$$?

I've attached a chart of what the concentration profiles look like for this solution. In this chart $$c_{Ao} > c_{Bo}$$ and A starts in the left slab. As A moves into slab B the A domain increases (A and B cannot coexist). The edge of that domain is where $$c(x,t)$$ is equal to zero. This is a moving boundary problem.

P.S. Sorry for the figure showing up twice. I don't know why that is happening. I have tried to fix it, but to no avail.

Since A and B cannot coexist and since $$c(x,t) = c_A(x,t) - c_B(x,t)$$, then when $$c(x,t) > 0$$ that means that $$c_A(x,t) = c(x,t)$$ and $$c_B(x,t) = 0$$. When $$c(x,t) < 0$$, then $$c_B(x,t) =c(x,t)$$ and $$c_A(x,t) = 0$$.