4
$\begingroup$

The Dirichlet boundary condition of NDSolve, as advertised, should pick up any part of the boundary specified in the "pred" argument and apply the condition specified in the "beqn" argument. But I'm finding that if the boundary has slots, as shown here, it ignores the internal boundaries. Why is it doing this? I saw an answer that involved manually building a mesh, but why should I need to do this?

enter image description here

Specify geometry parameters

x1 = 5; y1 = 1; y2 = 2; y3 = 10; x2 = 10; ϵ = 0.1;

Specify region

region = 
  ImplicitRegion[
    (y - (y1 + (y2 - y1) UnitStep[x - x1]))^2 >= ϵ^2, {{x, 0, x2}, {y, 0, y3}}]

Solve Laplace's equation (cylindrical coordinates) and contour plot. It sees only the boundary conditions on the top and bottom:

slpolar = 
  NDSolve[
    {D[x D[u[x, y], x], x]/x + D[u[x, y], {y, 2}] == 0, 
     u[x, 0] == 30, u[x, y3] == 0, 
     DirichletCondition[u[x, y] == 0, 0 < x < x2 && y > 0]}, 
    u, {x, y} ∈ region]

enter image description here

$\endgroup$

2 Answers 2

2
$\begingroup$

Thanks. I also found that the problem goes away if I make the slots wide enough. In this example the slots had to be more than exactly 4/3 wide.

enter image description here

$\endgroup$
1
$\begingroup$

ToElementMesh (and DiscretizeRegion) have problems generating the mesh from the region you specified. Using a different specification helps to work around this:

region = RegionDifference[
  RegionDifference[Rectangle[{0, 0}, {10, 10}], 
   Rectangle[{0, 1 - \[Epsilon]}, {5, 1 + \[Epsilon]}]], 
  Rectangle[{5, 2 - \[Epsilon]}, {10, 2 + \[Epsilon]}]]

You can generate the mesh and look at it:

Needs["NDSolve`FEM`"]
m = ToElementMesh[region];
(*m["Wireframe"]*)

And here is the solution:

slpolar = 
  NDSolveValue[{D[x D[u[x, y], x], x]/x + D[u[x, y], {y, 2}] == 0, 
    u[x, 0] == 30, u[x, y3] == 0, 
    DirichletCondition[u[x, y] == 0, 0 < x < x2 && y > 0]}, 
   u, {x, y} \[Element] m];
ContourPlot[slpolar[x, y], {x, y} \[Element] m, PlotRange -> All, 
 ColorFunction -> "TemperatureMap"]

enter image description here

$\endgroup$
1
  • $\begingroup$ Yes, and in fact if the region is specified in the way you suggested, I can use {x, y} [Element] region in the NDSolve. No need to bother with the FEM package or the ToElementMesh function. So this seems to be a quirk with the way regions are specified. $\endgroup$
    – Brian
    Commented Nov 22, 2017 at 14:58

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.