# Problem in solving PDE

I have a problem in solving a type of PDE. The actual problem involves diffusion and adsorption in a trench, but here is a simpler example. I have two independent variables $t$ and $x$. There are two dependent variables $y(t,x)$ and $z(t)$. Note that $z$ is a function of $t$ only.

NDSolve does not accept the problem with the boundary conditions. Running this code

ClearAll["Global*"];

pdeset = {D[y[t, x], t] == -D[y[t, x], x] + z[t], D[z[t], t] == y[t, 0]};
bc1 = {y[t, 0] == 5, y[0, x] == Cos[x]};
bc2 = {z == 1};

bcAll = Flatten[{bc1, bc2}, 1];

sol = NDSolve[{pdeset, bcAll}, {y, z}, {t, 0, 1}, {x, 0, 1}]


I get the error message saying

NDSolve::ndode: Input is not an ordinary differential equation.


I am using Mathematica 9.0 on Windows 7 64 bit.

• there might be something wrong with the DE formation, you can put your equation here from book as it is (using Latex) – Rorschach Aug 11 '13 at 13:09
• As pointed out by @Nasser your z[t] is just the integral of the boundary condition, so you can calculate that separately. – b.gates.you.know.what Aug 12 '13 at 8:43
• "Thanks @Nasser. I see that I have not formulated the example well. Wrong BC and the second equation was solvable independently. Here is a better example to illustrate my problem. Note that the BC is consistent, but I can't solve 2nd equation independently. I still see the problem. " ClearAll["Global*"]; pdeset = {D[y[t, x], t] == -D[y[t, x], x] + z[t], D[z[t], t] == y[t, 0.5]}; bc1 = {y[t, 0] == 1, y[0, x] == Cos[x]}; bc2 = {z == 1}; bcAll = Flatten[{bc1, bc2}, 1]; sol = NDSolve[{pdeset, bcAll}, {y, z}, {t, 0, 1}, {x, 0, 1}] – user8983 Aug 16 '13 at 6:35

The initial and boundary conditions are inconsistent.

You say y[0, x] == Cos[x] which means for any x. So lets try x=0, this gives y[0, 0] == Cos == 1, but looking at y[t, 0] == 5, since this is valid for any t, then it means y[0, 0] == 5.

So which one is it? y[0, 0] == 5 or y[0, 0] == 1

Now, if you correct this problem, and make y[t, 0] == 1, then it can be solved. Notice that you do not even need to include z'[t] in the set of equations, since its solution is there to start with. Why not solve it and just use z[t] directly?

ClearAll["Global*"];
yt0 = 1;
bc1 = {y[t, 0] == yt0, y[0, x] == Cos[x]};
zt = z[t] /. First@DSolve[{z'[t] == yt0, z == yt0}, z[t], t];
pdeset = D[y[t, x], t] == -D[y[t, x], x] + zt;
sol = NDSolve[{pdeset, bc1}, y, {t, 0, 5}, {x, 0, 4 Pi}] Plot3D[Evaluate[y[t, x] /. sol], {t, 0, 5}, {x, 0, 4 Pi},
PlotRange -> All, AxesLabel -> Automatic]
` 