Consider the following diffusion-decay equation with von Neumann b/c in the origin and Dirichlet at the other boundary:
pde = D[u[x, t], t] == d*D[u[x, t], x, x] - \[Delta]*u[x, t]
bc = {D[u[x, t], x] == -j0 /. x -> 0, u[x, t] == 0 /. x -> length}
ic = u[x, t] == u0 /. t -> 0
params = {d -> 10, \[Delta] -> 1, length -> 600, u0 -> 200, j0 -> 4000}
tFinal = 150;
soln = NDSolve[Flatten@{pde, bc, ic} /. params, u, {t, 0, tFinal}, {x, 0, length /. params}]
Running NDSolve as above generates this Warning:
NDSolve::ibcinc: Warning: Boundary and initial conditions are inconsistent.
I understand that the boundary and initial conditions are inconsistent. To solve this problem I looked through this webpage:
https://reference.wolfram.com/language/tutorial/NDSolveMethodOfLines.html#1306392612
I noticed, however, that changing j0 had no effect on the attained numerical solution and, in fact, leaving the symbol j0 undefined does not lead NDSolve to complain about non-numerical derivatives and such. This leads me to believe that NDSolve ignores somehow the boundary condition in the origin altogether, making it somewhat hard to debug the warning message about inconsistent boundary and initial conditions.
To clarify my point about j0: I don't understand how NDSolve manages to ignore the boundary condition in the origin altogether without running into trouble. If I comment out the left b/c, NDSolve complains:
NDSolve::bcart: Warning: An insufficient number of boundary conditions have been specified for the direction of independent variable x. Artificial boundary effects may be present in the solution.
Edit: One solution I found is to turn j0 into a Michaelis-Menten type of function of time. Here, I also incorporate a valid point made in the comments: the Dirichlet b/c on the right of the domain was also inconsistent with the initial condition.
pde = D[u[x, t], t] == d*D[u[x, t], x, x] - \[Delta]*u[x, t]
bc = {D[u[x, t], x] == -((j0*t)/(1 + t)) /. x -> 0, u[x, t] == 0 /. x -> length}
ic = u[x, t] == u0 /. t -> 0
params = {d -> 100, \[Delta] -> 1, length -> 600, u0 -> 0, j0 -> 40}
tFinal = 150;
soln = NDSolve[Flatten@{pde, bc, ic} /. params, u, {t, 0, tFinal}, {x, 0, length /. params}, Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 1000}}]
Your help and suggestions are greatly appreciated!
j0
I still get the (correct) warning about inconsistent initial conditions. Also, the fact thatj0
is not defined does not matter since the other boundary condition and the initial condition are inconsistent (too). $\endgroup$NDSolve::bcart: Warning: An insufficient number of boundary conditions have been specified for the direction of independent variable x. Artificial boundary effects may be present in the solution.
$\endgroup$D[u[x, t], x] == -((j0*t)/(1 + t)) /. x -> length
also finds a solution. Does this help? $\endgroup$