# How to calculate the analytical solution of linear advection equation with Dirichlet's boundary conditions?

I am trying to find the solution of linear advection equation of the form:

$$\frac {\partial c}{\partial t}+u\frac {\partial c}{\partial x}=0$$

$$c(x,0)=0$$

$$c(0,t)=\{c_0 \ \text{for}\ t \leq t_1 \text{and}\ 0 \ \text{for}\ t>t_1$$

Can anybody help me?

The transport equation simply moves your solution to the right with speed $$u$$ (assuming $$u > 0$$ and that $$u$$ is independent of $$t$$ and $$x$$).

Until time $$t_1$$, you will move a constant solution equal to $$c_0$$ into the domain at a speed $$u$$. The "jump" from $$c_0$$ to $$0$$ (your initial value), originally located at $$x=0$$, will thus travel rightward with speed $$u$$ and is thus located at $$x = u*t$$ (because it starts at $$x=0$$). So until time $$t_1$$, your solution will be

$$$$c(x,t) = c_0$$$$

for $$0 \leq x \leq u t$$ and

$$$$c(x,t) = 0$$$$ for $$x > u t$$.

At time $$t_1$$, your boundary condition changes and you now start to move a second jump from $$c_0$$ to $$0$$ into the domain, again with speed $$u$$. Therefore, you now have a "sawtooth" shaped solution with the right edge at $$x = u*t$$ and the left edge at $$x = u(t - t_1)$$.

Thus, for $$t > t_1$$, your solution is

$$$$c(x,t) = c_0$$$$

if $$u(t - t_1) \leq x \leq u t$$ and

$$$$c(x,t) = 0$$$$ for all other values of $$x$$.