1
$\begingroup$

I have the following domain:

rA=ImplicitRegion[((x - 10)/0.2)^2 + y^2 <= 
   1 || ((x + 10)/0.2)^2 + y^2 <= 1, {x, y}]
rB=ImplicitRegion[((x - 6)/0.2)^2 + (y + 20)^2 <= 
   1 || ((x + 6)/0.2)^2 + (y + 20)^2 <= 1, {x, y}]
Dom = RegionDifference[Rectangle[{-100, -100}, {100, 100}], 
  RegionUnion[ rA , rB]]

Then try to solve Laplace equation on the domain, applying boundary conditions:

sol = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0,
   DirichletCondition[
    u[x, y] == 
     100, ((x - 10)/0.2)^2 + y^2 <= 1 || ((x + 10)/0.2)^2 + y^2 <= 
      1],
   DirichletCondition[
    u[x, y] == 
     0, ((x - 6)/0.2)^2 + (y + 20)^2 <= 
      1 || ((x + 6)/0.2)^2 + (y + 20)^2 <= 1],
   u[x, -100] == u[x, 100] == u[-100, y] == u[100, y] == 0}, u, 
  Element[{x, y}, Dom]]

But I get errors

NDSolveValue::bcnop: No places were found on the boundary where 25. (-10+x)^2+y^2<=1||25. (10+x)^2+y^2<=1 was True, so DirichletCondition[u==100,25. (-10+x)^2+y^2<=1||25. (10+x)^2+y^2<=1] will effectively be ignored. >>
NDSolveValue::bcnop: No places were found on the boundary where 25. (-6+x)^2+(20+y)^2<=1||25. (6+x)^2+(20+y)^2<=1 was True, so DirichletCondition[u==0,25. (-6+x)^2+(20+y)^2<=1||25. (6+x)^2+(20+y)^2<=1] will effectively be ignored. >>

I tried a more succinct semantics, but I get even more errors:

sol = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0,
   DirichletCondition[u[x, y] == 100, 
    Element[{x, y}, RegionBoundary[rA]]],
   DirichletCondition[u[x, y] == 0, 
    Element[{x, y}, RegionBoundary[rB]]],
   u[x, -100] == u[x, 100] == u[-100, y] == u[100, y] == 0}, u, 
  Element[{x, y}, Dom]]



ImplicitRegion::ivar: "-100. is not a valid variable."
CompiledFunction::cfta: "Argument {{Boole[{-100.,-100.}\[Element]RegionBoundary[ImplicitRegion[LessEqual[<<2>>]||LessEqual[<<2>>],{-100.,-100.}]]]},{Boole[{-100.,-87.5}\[Element]RegionBoundary[ImplicitRegion[LessEqual[<<2>>]||LessEqual[<<2>>],{-100.,-87.5}]]]},<<47>>,{Boole[{87.5,-100.}\[Element]RegionBoundary[ImplicitRegion[LessEqual[<<2>>]||LessEqual[<<2>>],{87.5,-100.}]]]},<<78>>} at position 1 should be a rank 1 tensor of \!\(\"machine-size integer\"\)s"
NDSolveValue::bcnop: "No places were found on the boundary where {x,y}\[Element]RegionBoundary[ImplicitRegion[25.\ Plus[<<2>>]^2+y^2<=1||25.\ Plus[<<2>>]^2+y^2<=1,{x,y}]] was True, so DirichletCondition[u==100,{x,y}\[Element]RegionBoundary[ImplicitRegion[25.\ Power[<<2>>]+y^2<=1||25.\ Power[<<2>>]+y^2<=1,{x,y}]]] will effectively be ignored"
....
$\endgroup$
1
  • $\begingroup$ Try using Method -> {"FiniteElement", "MeshOptions" -> {"BoundaryMeshGenerator" -> "Continuation"}} does this help? $\endgroup$
    – user21
    Jan 5, 2015 at 14:13

1 Answer 1

1
$\begingroup$

This works in Version 10.2:

rA = ImplicitRegion[((x - 10)/0.2)^2 + y^2 <= 
    1 || ((x + 10)/0.2)^2 + y^2 <= 1, {x, y}]
rB = ImplicitRegion[((x - 6)/0.2)^2 + (y + 20)^2 <= 
    1 || ((x + 6)/0.2)^2 + (y + 20)^2 <= 1, {x, y}]
Dom = RegionDifference[Rectangle[{-100, -100}, {100, 100}], 
  RegionUnion[rA, rB]]
sol = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0, 
   DirichletCondition[
    u[x, y] == 
     100, ((x - 10)/0.2)^2 + y^2 <= 1 || ((x + 10)/0.2)^2 + y^2 <= 1],
    DirichletCondition[
    u[x, y] == 
     0, ((x - 6)/0.2)^2 + (y + 20)^2 <= 
      1 || ((x + 6)/0.2)^2 + (y + 20)^2 <= 1], 
   u[x, -100] == u[x, 100] == u[-100, y] == u[100, y] == 0}, u, 
  Element[{x, y}, Dom]]
Plot3D[sol[x, y], {x, y} \[Element] sol["ElementMesh"], 
 PlotRange -> All]

enter image description here

Here are the seed points inside the region holes:

sol["ElementMesh"]["RegionHoles"]
{{10.016713574468996`, 
  0.059658883955950155`}, {-5.9832860016757525`, \
-19.940335393998154`}, {6.016708912061227`, -19.940335393998154`}, \
{-9.983289604445392`, 0.059661427087461485`}}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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