# NDSolveValueMethodOfLines, the Method : "SpatialDiscretization" "TensorProductGrid""MinPoints" Option does not work in 2-d [duplicate]

I'm applying NDSolveValue to 2-D diffusion equation with "Method of Lines":

eqns = {D[T[t, x, y], t] == D[T[t, x, y], x, x] + D[T[t, x, y], y, y]};
\[CapitalOmega] = Rectangle[{0, 0}, {1, 1}];
init = {T[0, x, y] == If[0.4 < x < 0.6 && 0.4 < y < 0.6, 1, 0]};
bcs = DirichletCondition[T[t, x, y] == 0,x == 1 || x == 0| y == 0 || y == 1];

sol1 = NDSolveValue[{eqns, init, bcs},T, {t, 0, 0.1}, {x, y} \[Element] \[CapitalOmega], MaxStepSize -> 0.0001]


the above code works.

But when I tried to control the spatial discretization grid points:

sol2 = NDSolveValue[{eqns, init, bcs},
T, {t, 0, 0.01}, {x, y} \[Element] \[CapitalOmega],
Method -> {"MethodOfLines", "TemporalVariable" -> t,
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 125}}, MaxStepSize -> 0.0001
]


it failed with an error message (NDSolveValue::moptx):

Unable to identify the problem, I searched the documentation and found an example:

s2 = NDSolve[{\!$$\*SubscriptBox[\(\[PartialD]$$, $$t$$]$$u[t, x]$$\) == 1/1000 \!$$\*SubscriptBox[\(\[PartialD]$$, $$x, x$$]$$u[t, x]$$\) - u[t, x] \!$$\*SubscriptBox[\(\[PartialD]$$, $$x$$]$$u[t, x]$$\),
u[0, x] == Sin[2 \[Pi] x], u[t, 0] == u[t, 1]},
u, {t, 0, 2}, {x, 0, 1},
Method -> {"PDEDiscretization" -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 128}}}]


which works, except that its in 1-D.

So what's wrong with my code?

• To be more specific, since you've: 1. defined the domain with ∈, 2. used DirichletCondition, NDSolve automatically turns to FiniteElement method, while MinPoints is a sub-option of TensorProductGrid method, so the warning pops up. May 22 '19 at 10:29
• Thanks. I thought I have manually specified "MethodOfLines", so why is "FiniteElement" still triggered without warning. May 23 '19 at 3:03
• Notice FiniteElement and TensorProductGrid are both sub-method of MethodOfLines in this case. As already mentioned, NDSolve automatically uses FiniteElement when ∈ or DirichletCondition is used, at least now. (Well, perhaps a better warning should be given in this case e.g. TensorProductGrid cannot handle DirichletCondition, sub-method has been changed to FiniteElement`? ) May 23 '19 at 5:59