Skip to main content

differential equations - NDSolveValue. x cannot be used as a variable


Im trying to solve an electrocinetic problem that is supposed to be very easy. I only need a region and some DirichletCondition, adn then solve the Lagrange equation. Here you've got the program.


Needs["NDSolve`FEM`"]
Clear[Rint, Rext, vint, vext, x, y, u, uif, e0, o1, o2, o]
Rint = 2;
Rext = 4;
vint = 1;
vext = 0;

o1 = Disk[{0, 0}, Rext];

o2 = RegionDifference[o1, Disk[{0, 0}, Rint]];
o = RegionDifference[o2, Rectangle[{-Rext, -Rext}, {Rext, 0}]];

CC = {
DirichletCondition[u[x, y] == vext, Sqrt[x^2 + y^2] == Rext],
DirichletCondition[u[x, y] == vint, Sqrt[x^2 + y^2] == Rint]
};

uif = NDSolveValue[{Lagrangian[u[x, y], {x, y}] == 0, CC},
u, {x, y} \[Epsilon] o,

Method -> {"FiniteElement",
"MeshOptions" -> {MaxCellMeasure -> 0.001}}];

Then, this message appears:


NDSolveValue::dsvar: x \[Epsilon] BooleanRegion[#1&&!#2&&!#3&,{Disk[{0,0},4],Disk[{0,0},2],Rectangle[{-4,-4},{4,0}]}] cannot be used as a variable.

I can't undestand why this happens, as I have a model program very similar to this one as an example.



Answer



The syntax for region membership is {x, y} \[Element] o, not \[Epsilon], which look very similar:


{x, y} \[Element] o

{x, y} \[Epsilon] o

Mathematica graphics


Unless \[Epsilon] has a definition, it will show up blue instead of black. (The error message is not complaining about x but about the whole expression.)


Comments