# Boundary values in PDE using NDSolve - different outputs whether v.10.2 or 11.3

I'm trying to solve the following PDE

$$\frac{\partial n(t,x)}{\partial t}=f(t,x)\frac{\partial^2n}{\partial x^2}+\frac{\partial n}{\partial x}\frac{\partial f}{\partial x}$$

with the boundary conditions $$\frac{\partial n}{\partial x}(t,x=0)=\frac{n}{\lambda_1}$$ $$\frac{\partial n}{\partial x}(t,x=L)=-\frac{\lambda_2}{f(t,L)}$$

and initial condition $$n(t=0,x)=\frac{1+x}{f(0,x)}$$

where $\lambda_{1,2}$ are constants.

If I use the code:

l1=2; l2=3; L=0.5;
f[t_,x_]:=x-1;

NDSolveValue[
{D[n[t, x], t] == D[f[t, x], x]*D[n[t, x], x] + f[t, x]*D[n[t, x], x, x] +
NeumannValue[n[t, x]/l1, x == 0] + NeumannValue[-l2/f[t, x], x == L],
DirichletCondition[n[t,x] == (1+x)/f[t,x],t==0]},
n,
{t,0,1},
{x,0,L},
Method -> {"PDEDiscretization" -> {"MethodOfLines","SpatialDiscretization" -> "FiniteElement"}}
]


then in Mathematica 10.2 the solution is fine but in Mathematica 11.3 I get the error:

NDSolveValue::ivone: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable.


If I use the code

l1=2; l2=3; L=0.5;
f[t_,x_]:=x-1;

NDSolveValue[
{D[n[t, x], t] == D[f[t, x], x]*D[n[t, x], x] + f[t, x]*D[n[t, x], x, x],
Derivative[0,1][n][t, 0]==n[t,0]/l1,
Derivative[0,1][n][t,L]==-l2/f[t, L],
DirichletCondition[n[t,x] == (1+x)/f[t,x],t==0]},
n,
{t,0,1},
{x,0,L},
Method -> {"PDEDiscretization" -> {"MethodOfLines","SpatialDiscretization" -> "FiniteElement"}}
]


I get the error in 10.2

CoefficientArrays::poly: -n/2 + n^(0,1)[t,0] is not a polynomial


and the error in 11.3 is the same as before:

NDSolveValue::ivone: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable.


Why in the first case it works in the older version and not in the recent version? And why in the second case it doesn't work in any version (although with different errors...)?

• Try pasting your code into a new session of Mathematica and running it. I'm getting different errors, even if I fix the obvious syntax errors. I think some things are missing from the code. – Michael E2 Jun 26 '18 at 23:12
• What is the dependent variable? n, f or ne or all of them? – user21 Jun 27 '18 at 8:07
• Please see my original post: I've corrected the syntax errors (the mathematica errors are still the same though...) and also added values for the constants and a simple function f just for clarity. – AJHC Jun 27 '18 at 8:51

An initial condition is not a DirichletCondition. Change the DirichletCondition to a proper initial condition. Like so:
NDSolveValue[{D[n[t, x], t] ==