Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

http://reference.wolfram.com/mathematica/tutorial/NDSolvePDE.html#51169332

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!

share|improve this question
    
When I comment out j0 I still get the (correct) warning about inconsistent initial conditions. Also, the fact that j0 is not defined does not matter since the other boundary condition and the initial condition are inconsistent (too). –  user21 Nov 14 '12 at 0:34
    
Thank you @ruebenko and I understand what you're saying about the boundary condition at x==length. However, 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. –  Name Nov 14 '12 at 10:01
    
I am not sure I can follow you; the warning says there is an insufficient number of bcs. For the method of lines, you need an initial condition, and (in 2D) a boundary to the left and one to the right. Note that, for example, replacing the Dirichlet condition with D[u[x, t], x] == -((j0*t)/(1 + t)) /. x -> length also finds a solution. Does this help? –  user21 Nov 14 '12 at 23:26
    
In the above comment I meant to say 1D (in space). –  user21 Nov 15 '12 at 9:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.