# failure of code with Helmholtz equation with point source

I am new to the finite elements package in Mathematica. I have a system of equations, one of which is a Helmholtz equation with a point source in the interior of a bounded domain. The following is the code I've attempted to use:

bmesh = ToBoundaryMesh[
"Coordinates" -> {{-0.05, -0.1}, {0.2, -0.1}, {0.2, 0.1}, {-0.05, 0.1},
{0.1, 0}, {0.11, 0}, {0.11, 0.03}, {0.1, 0.03}, {0, 0}},
"BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 1}}]}]
%["Wireframe"]
mesh = ToElementMesh[bmesh];
Show[
mesh["Wireframe"],
Graphics[{Red, PointSize[Large], Point[{0, 0}]}]]
sol = NDSolve[{-D[u[x, y], x, x] - D[u[x, y], y, y] - u[x, y] == 0,
DirichletCondition[u[x, y] == 1, x == 0 && y == 0],
u[x, 0.1] == 0,
Derivative[1, 0][u][-0.05, y] == 0,
Derivative[0, 1][u][x, -0.1] == 0,
Derivative[1, 0][u][0.2, y] == 0},
u, {x, y} ∈ mesh];


Error messages appear stating that the first x-derivative is not a polynomial and that the dependent variable u is not linear. What is wrong here?

• I think this does what you want:sol = NDSolve[{-D[u[x, y], x, x] - D[u[x, y], y, y] - u[x, y] == 0, DirichletCondition[u[x, y] == 1, x == 0 && y == 0], DirichletCondition[u[x, y] == 0, y == .1]}, u, {x, y} [Element] mesh] I have the impression your boundary conditions are redundant since the rhs of the pde is 0 Commented Jul 3, 2016 at 17:09

Here is a way to do it:

(*
Needs["NDSolveFEM"];
\[CapitalOmega]=Rectangle[{-0.05,-0.1},{0.2,0.1}];
mesh=ToElementMesh[\[CapitalOmega],"IncludePoints"\[Rule]{{0,0}}];
*)
sol = NDSolveValue[{-D[u[x, y], x, x] - D[u[x, y], y, y] -
u[x, y] == 0,
DirichletCondition[u[x, y] == 1, x == 0 && y == 0],
DirichletCondition[u[x, y] == 1, y == 0.1]
}, u, {x, y} \[Element] mesh];
sol[0, 0]
0.9999999999999986
`
• Thanks to User 21 for the above suggestion. It works.
– RJR
Commented Jul 5, 2016 at 23:43
• @RJR, no worries. Commented Jul 6, 2016 at 0:31