2
$\begingroup$

I'm trying to numerically obtain the first ten eigenvalues of a 3D S-L problem via NDEigenvalues but with no success. The problem is given by

Lx=2;
Ly=2;
Lz=2;

k[x_,y_,z_]=Piecewise[{{1, 0.5<=y<=1.5&&0.5<=x<=1.5&&0<=z<=2}}, 0.25];
w[x_,y_,z_]=Piecewise[{{1, 0.5<=y<=1.5&&0.5<=x<=1.5&&0<=z<=2}}, 0.000339266];

NDEigenvalues[{D[k[x, y, z] D[ψ[x, y, z], x], x] + D[k[x, y, z] D[ψ[x, y, z], y], y] + D[
      k[x, y, z] D[ψ[x, y, z], z], z] + μ^2 w[x, y, 
      z] ψ[x, y, z] == 0, ψ[0, y, z] == 
   0, ψ[Lx, y, z] == 0, ψ[x, 0, z] == 0, ψ[x, Ly, z] ==
    0, ψ[x, y, 0] == 0, (D[ψ[x, y, z], z] /. z -> Lz) == 
   0}, ψ[x, y, z], {x, 0, Lx}, {y, 0, Ly}, {z, 0, Lz}, 10]

Nonetheless, Mathematica gives as output the input itself. Anyone could help me to solve this problem?

$\endgroup$
3
$\begingroup$

For example like this:

Lx = 2;
Ly = 2;
Lz = 2;

k[x_, y_, z_] = 
  Piecewise[{{1, 0.5 <= y <= 1.5 && 0.5 <= x <= 1.5 && 0 <= z <= 2}}, 
   0.25];
w[x_, y_, z_] = 
  Piecewise[{{1, 0.5 <= y <= 1.5 && 0.5 <= x <= 1.5 && 0 <= z <= 2}}, 
   0.000339266];

\[Mu] = 1;

NDEigenvalues[{
  D[k[x, y, z] D[\[Psi][x, y, z], x], x] + 
   D[k[x, y, z] D[\[Psi][x, y, z], y], y] + 
   D[k[x, y, z] D[\[Psi][x, y, z], z], 
    z] + \[Mu]^2 w[x, y, z] \[Psi][x, y, z]
  , DirichletCondition[\[Psi][x, y, z] == 0, 
   x == 0 || x == Lx || y == 0 || y == Ly || z == 0]}, \[Psi][x, y, 
  z], {x, 0, Lx}, {y, 0, Ly}, {z, 0, Lz}, 10]

(*
{-1.22419, -4.40255, -5.29783, -5.29783, -7.19205, -7.19205, \
-7.19414, -8.68989, -9.20316, -9.53589}
*)

Update:

After some comments back and forth, this is a better approach:

ClearAll[\[Mu]]

Sqrt[NDEigenvalues[{w[x, y, z] D[phi[t, x, y, z], 
      t] == -Inactive[Div][
      k[x, y, z] Inactive[Grad][phi[t, x, y, z], {x, y, z}], {x, y, 
       z}], DirichletCondition[phi[t, x, y, z] == 0, 
    x == 0 || x == Lx || y == 0 || y == Ly || z == 0]}, 
  phi[t, x, y, z], t, {x, 0, Lx}, {y, 0, Ly}, {z, 0, Lz}, 10]]

(* {1.72004, 2.91152, 3.84061, 3.84061, 4.38555, 4.53164, 4.53164, \
5.30524, 5.63385, 5.83603} *)
$\endgroup$
13
  • $\begingroup$ I'm curious, what is the reason that NDEigenvalues not accept boundary conditions given without DirichletCondition? $\endgroup$ – SPPearce Mar 30 '20 at 6:14
  • $\begingroup$ Note, that the FDM type Dirichlet conditions are not the only issue. There is an == in the equation and there is a Derivative to make a Neumann zero bc that need to be fixed. Never the less, I think I can make FDM type Dirichlet conditions for for NDEigensystem for version 12.2. $\endgroup$ – user21 Mar 30 '20 at 8:00
  • $\begingroup$ Thanks. Personally I find it an odd syntax, when compared to NDSolve. Why can't it take an equation? $\endgroup$ – SPPearce Mar 30 '20 at 9:15
  • $\begingroup$ @KraZug, because we are not dealing with an equation: For example, you can not have a load term. How would you explain that? $\endgroup$ – user21 Mar 30 '20 at 9:40
  • $\begingroup$ But you are have an equation in that you are solving it to be equal to $\lambda \Psi$, no? $\endgroup$ – SPPearce Mar 30 '20 at 9:51

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.