Message Boards Message Boards

Poisson equation with PeriodicBoundaryCondition

The below example is from https://www.wolfram.com/language/11/partial-differential-equations/solve-a-poisson-equation-with-periodic-boundary-co.html.es?product=language I have copied the code but some thing is wrong. What is my mistake? Thanks a lot

omega=  RegionDifference[RegionUnion[Disk[], Rectangle[{0, -1}, {2, 1}]], 
   Disk[{2, 0}]];

ufun = NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 1, 
    PeriodicBoundaryCondition[u[x, y], (x - 2)^2 + y^2 == 1, 
     Function[x, x - {2, 0}]], 
    DirichletCondition[u[x, y] == 0, 0 <= x <= 2 && (y <= -1 || y >= 1)]}, u, 
   Element[{x, y}, omega]]; 

ContourPlot[ufun[x, y], {x, y} \[Element]omega, ColorFunction -> "TemperatureMap", 
  AspectRatio -> Automatic] // Quiet
2 Replies
Posted 3 years ago

Hi Guillermo,

There is a mistake in the Spanish version of the page. The code in the English version works fine, a small offset is used to prevent the conditions from overlapping.

POSTED BY: Rohit Namjoshi

You are right. The code in the English version is (a light but important difference: - 10^-6):

ufun = NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 1, 
   PeriodicBoundaryCondition[u[x, y], (x - 2)^2 + y^2 == 1, 
         Function[x, x - {2, 0}]], 
   DirichletCondition[u[x, y] == 0, 
    Inequality[0, LessEqual, x, Less, 2 - 10^(-6)] && 
           (y <= -1 || y >= 1)]}, u, Element[{x, y}, \[CapitalOmega]]]

Thank you

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract