2
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ The syntax for region membership is {x, y} \[Element] o, not \[Epsilon]. (It's not complaining about x but about the whole expression.) $\endgroup$
    – Michael E2
    Apr 6 '18 at 12:11
  • $\begingroup$ What is: Lagrangian ? $\endgroup$ Apr 6 '18 at 12:12
  • $\begingroup$ @MariuszIwaniuk Oh, I forgot I changed that to Laplacian. If it's Lagrangian, then Sergio forgot (to include) the definition. But the syntax error seems the major problem. $\endgroup$
    – Michael E2
    Apr 6 '18 at 12:13
  • $\begingroup$ @MichaelE2 that was the problem ^^ thank you very much! how do a say that your answer worked? i mean how to accept it? $\endgroup$ Apr 6 '18 at 12:24
2
$\begingroup$

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.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.