2
$\begingroup$

I need to solve an eigenvalue problem in 2D as seen in the picture.

enter image description here

I've tried the function NDEigensystem but reading its documentation it seems it has issues with non-homogeneous boundary conditions. As solution I need the eigenvalues and eigenfunctions.

I would be very thankful if anybody could suggest how to solve such eigenvalue problem.

$\endgroup$
5
  • $\begingroup$ I do not think NDEigensystem supports Robin BC (ie. both Dirichlet and Neumann on same boundary). $\endgroup$
    – Nasser
    Commented May 19, 2022 at 23:49
  • 1
    $\begingroup$ “it seems it has issues with non-homogeneous boundary conditions” Yeah, but yours is homogeneous! $\endgroup$
    – xzczd
    Commented May 20, 2022 at 2:46
  • 1
    $\begingroup$ @Nasser No, Robin b.c. can be defined with NeumannValue. $\endgroup$
    – xzczd
    Commented May 20, 2022 at 2:47
  • $\begingroup$ @xzczd good to know. I but I could not make it work myself. $\endgroup$
    – Nasser
    Commented May 20, 2022 at 3:34
  • $\begingroup$ @kpaz Could you show your attempt with NDEigensystem? $\endgroup$ Commented May 20, 2022 at 6:38

2 Answers 2

2
$\begingroup$

Let me extend my comments to an answer.

…it seems it has issues with non-homogeneous boundary conditions

Yes, but your b.c.s are homogeneous. NeumannValue can handle it, and we can use my allowfemdbc to automatically convert the b.c.s involving derivative to NeumannValue:

With[{u = u[x, y]}, lhs = Laplacian[u, {x, y}];
  bc = {u == 0 /. {{x -> -1}, {y -> -1}},
    {2 D[u, x] + u == 0 /. x -> 1,
     D[u, y] + u == 0 /. y -> 1}}];

tst = allowfemdbc[
   NDEigensystem[{lhs, bc} // Flatten, u, {x, -1, 1}, {y, -1, 1}, 4, 
    Method -> {"PDEDiscretization" -> {"FiniteElement", 
        "MeshOptions" -> {"MaxCellMeasure" -> 0.01}}}]]
(* {{0.916814, -4.13089, -4.56846, -9.61616}, …} *)

Plot3D[tst[[2, 1]][x, y], {x, -1, 1}, {y, -1, 1}]

enter image description here

Let's check if the Robin b.c.s are satisfied:

index = 2;
mid = Subtract @@@ bc[[2, 1]] /. u -> tst[[2, index]]; 
mid2 = Subtract @@@ bc[[2, 2]] /. u -> tst[[2, index]];
Plot[mid2, {x, -1, 1}, PlotRange -> All] ~Show~Plot[mid, {y, -1, 1}] 

enter image description here

Not bad, and will be better if MaxCellMeasure is smaller. The following is obtained with "MaxCellMeasure" -> 0.001:

enter image description here

$\endgroup$
7
  • $\begingroup$ Nice answer. Why NDEigensystem[{Laplacian[u[x, y], {x, y}] - \[Lambda] u[x, y] == NeumannValue[- 1/2 u[x, y], x == 1] +NeumannValue[- u[x, y], y == 1] , u[-1, y] ==$MachineEpsilon,u[x, -1 ] == $MachineEpsilon}, u,Element[{x, y}, Rectangle[{-1, -1}, {1, 1}]],2] doesn't work ? $\endgroup$ Commented May 20, 2022 at 11:10
  • $\begingroup$ $MachineEpsilon makes the b.c. inhomogeneous. As mentioned above, it's not allowed. @ulrich $\endgroup$
    – xzczd
    Commented May 20, 2022 at 11:14
  • $\begingroup$ Ok but also NDEigensystem[{Laplacian[u[x, y], {x, y}] - \[Lambda] u[x, y] == NeumannValue[- 1/2 u[x, y], x == 1] +NeumannValue[- u[x, y], y == 1] , u[-1, y] ==0,u[x, -1 ] == 0}, u,Element[{x, y}, Rectangle[{-1, -1}, {1, 1}]],2] doesn't evaluate! $\endgroup$ Commented May 20, 2022 at 11:17
  • $\begingroup$ In your answer part \[Lambda] u[x, y] is missing I think $\endgroup$ Commented May 20, 2022 at 11:22
  • $\begingroup$ @ul First argument of NDEigensystem is not an equation, please check the document carefully. $\endgroup$
    – xzczd
    Commented May 20, 2022 at 11:30
1
$\begingroup$

Unfortunately NDEigensystem doesn't evaluate. Perhaps NDSolveValue helps to describe the system with Robin boundaries and gives an idea about the shape of the eigenfunction:

\[Lambda] = 1;
U = NDSolveValue[{Laplacian[u[x, y], {x, y}] - \[Lambda] u[x, y] ==
NeumannValue[- 1/2 u[x, y], x == 1] +NeumannValue[-  u[x, y], y == 1] , u[-1, y] ==$MachineEpsilon,u[x, -1 ] == $MachineEpsilon}, u,Element[{x, y}, Rectangle[{-1, -1}, {1, 1}]]]

Plot3D[U[x, y], Element[{x, y}, Rectangle[{-1,-1}, {1, 1}]]]    

enter image description here

It looks like the problem has only trivial solution u==0 (Separation of variables might show this result analytically)!

addendum NDEigensystem works after all (thanks @xzczd's comments!)

es = NDEigensystem[{Laplacian[u[x, y], {x, y}] - 
    NeumannValue[-1/2 u[x, y], x == 1] - 
    NeumannValue[-u[x, y], y == 1], u[-1, y] == 0, u[x, -1] == 0}, u, 
  Element[{x, y}, Rectangle[{-1, -1}, {1, 1}]], 3]

Map[Plot3D[#[x, y], Element[{x, y},Rectangle[{-1, -1}, {1, 1}]]] &,es[[2]]]

enter image description here

$\endgroup$
2
  • $\begingroup$ NDSolve cannot be used to deal with eigenvalue problem (at least cannot be used in this manner), and NDEigensystem evaluates. See my answer. $\endgroup$
    – xzczd
    Commented May 20, 2022 at 10:49
  • $\begingroup$ @xzczd My focus was to show how to formulate the pde-problem. $\endgroup$ Commented May 20, 2022 at 11:08

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.