# NDSolve with FEM works on my computer but not on another one I have

I have the following code:

Clear["Global*"];
Needs["NDSolveFEM"];
SetDirectory[NotebookDirectory[]];

Tinf = 20.0; Tini = 20.0; Lx = 0.10; Lf = 0.01; lx1 = (Lx - Lf)/2;
lx2 = (Lx - Lf)/2 + Lf; ly1 = 0.01;
Lc = 0.001;
ly2 = ly1 + Lc;
ly3 = 0.005;
Ly = ly2 + ly3 ; kep = 0.87; wep = 1400*935;
k1 = 13.4; k2 = 0.7; k3 = 1.171; k4 = 0.0263;
w1 = 8238*468; w2 = 1750000.0; w3 = 2652321.63;
w4 = 1.1614*1.007*1000; q = 2000;
tf = 20000.0;
h = 15.0;
dx = 0.005;

k[x_, y_] =
Piecewise[{{k1, y <= ly1}, {k2,
ly1 < y <= ly2 && (x < lx1 || x > lx2)}, {k4,
ly1 < y <= ly2 && lx1 <= x <= lx2}, {k3, ly2 < y <= Ly}}];

Cp[x_, y_] =
Piecewise[{{w1, y <= ly1}, {w2,
ly1 < y <= ly2 && (x < lx1 || x > lx2)}, {w4,
ly1 < y <= ly2 && lx1 <= x <= lx2}, {w3, ly2 < y <= Ly}}];

eq = Cp[x, y] D[T[x, y, t], t] ==
D[k[x, y] D[T[x, y, t], x], x] + D[k[x, y] D[T[x, y, t], y], y] +
NeumannValue[0., x == Lx] + NeumannValue[0., x == 0] +
NeumannValue[q, y == 0] - NeumannValue[h (T[x, y, t] - Tinf), y == Ly];

\[ScriptCapitalR] = ImplicitRegion[0 <= x <= Lx && 0 <= y <= Ly, {x, y}];

Tn[x_, y_, t_] =
NDSolveValue[{eq, T[x, y, 0] == Tini},
T[x, y, t], {t, 0, tf}, {x, y} \[Element] \[ScriptCapitalR],
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"FiniteElement",
"MeshOptions" -> {"MaxCellMeasure" -> 0.01}}}]; // Timing


On my computer (version 11.1) it runs without problems, but I tried to run this same code on another computer (version 11.3) and it gives the following errors when evaluating the last part:

NDSolveValue::femtemnm: A mesh could not be generated.

NDSolveValue::fememins: The mesh elements are not valid. A set of valid mesh element
incidents needs to be positive integers and be able to form a complete sequence starting
from 1 to the largest incident present. There are missing incidents; a complete sequence
cannot be formed.

NDSolveValue::nmesh: A mesh could not be generated from
NumericalRegion[ImplicitRegion[0<=x<=0.1&&0<=y<=0.071,{x,y}],{{0,1/10},{0,71/1000}}].


I don't have deep knowledge of Mathematica, I just use it to solve some physical problems in engineering.

EDIT: with @user21 's idea, the following works:

\[ScriptCapitalR] = ToElementMesh[Rectangle[{0, 0}, {Lx, Ly}],
"MaxBoundaryCellMeasure" -> 0.001,

• In version 12.0 the code runs fine with no warnings or errors. I wonder if the last line is what you intended. In your code it is saving the output of Timing in Tn, rather than the output of NDSolveValue. You may want (Tn[...] = NDSolveValue[...]) // Timing instead (note the parentheses). – MarcoB Mar 18 at 15:24
• @MarcoB I don't think that was the issue. It didn't work even without the warning. Thanks anyway. – User01 Mar 18 at 16:58

\[ScriptCapitalR] = Rectangle[{0, 0}, {Lx, Ly}];

Method -> {"MethodOfLines",
`