In Mathematica PDE solvers (say by FEM), the specification of Neumann boundary conditions is by specifying NeumannValue[..] (see Mathematica documentation, and also example below). However, I have different Neumann boundary values on different parts of the boundary (I am well aware of consistency conditions required for Neumann b.c's and my b.v's do satisfy these). This causes a problem. For example, Mathematica gives as an example for a Neumann value on one part and a Dirichlet conditon on another part of the boundary:

NDSolveValue[{-Laplacian[u[x, y], {x, y}] == NeumannValue[1., x >= 0.35], 
   DirichletCondition[u[x, y] == 0., x <= -0.3]}, u, Element[{x, y}, Disk[]]]

If I attempt to specifiy NeumannValues (different ones) on both parts of a boundary, Mathematica thinks I am equating a scalar (the equation) to a vector (the boundary values) and declares a parsing error.

Does anyone know how to specify Neumann b.c.'s on a boundary with different values on two parts of the boundary?

Marco: I am happy to send the entire notebook, but here is a fragment that has the problem. Before exhibiting it, let me say I have tried variations such as splitting the two Neumann conditions, call them N1 for one part, N2 on another and providing them that way. Also I have tried the || separator as well. None of them work. (All of them would work syntactically at leaset were these Dirichlet conditions which are specified by DirichletCondition.):

waveop2D = Div[Grad[u[x, y], {x, y}], {x, y}] + a u[x, y];

Subscript[\[CapitalGamma], N] = {NeumannValue[-(I \[Rho]0 - 1/(
       2 r0)) u[x, y], x^2 + y^2 == r0^2], 
   I \[Kappa]1[y] E^(I (x \[Kappa]1[y] + y \[Kappa]2[y]) ), 
   x == 0 && -1 <= y <= 1]}

Timing[ufun = 
  NDSolveValue[{waveop2D == Subscript[\[CapitalGamma], N]}, 
   u, {x, y} \[Element] region]]

NDSolveValue::femper: PDE parsing error of {{u+u$1051+u$1052-NeumannValue[(1/16-I) Removed[u$1081],x^2+y^2==64],u+u$1051+u$1052-NeumannValue[(I E^(I Plus[<<2>>]))/Sqrt[2],x==0&&-1<=y<=1]}}. Inconsistent equation dimensions.

USER 21: Thank you very much!

  • 2
    $\begingroup$ @Raghu, please show the actual code that gives you trouble, rather than non-relevant sample code from the docs. $\endgroup$ – MarcoB Jun 13 '18 at 18:41
  • $\begingroup$ @MarcoB Oops. I should start reading text with white background again... ;) $\endgroup$ – Henrik Schumacher Jun 13 '18 at 18:42
  • $\begingroup$ I have edited my entry to attempt to answer you. I can send the notebook to you if you like. $\endgroup$ – Raghu Raghavan Jun 14 '18 at 13:18

You'd need to add them, like this Neumann and Robin condition:

NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 
   NeumannValue[1., x >= 0.35] + NeumannValue[u[x, y], x < 0.3], 
  DirichletCondition[u[x, y] == 0., x <= -0.3]}, u, 
 Element[{x, y}, Disk[]]]

Note that if no Dirichlet or Robin BC condition is given a warning about non uniqueness will pop up.

|improve this answer|||||

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.