3
$\begingroup$

I have defined a region and found the eigenmodes of the 2D Helmholtz equation in it:

reg = Region[ImplicitRegion[x^2 + y^2 <= 1 + 0.1 Cos[3 ArcTan[x, y]], {x, y}]];
{vals, funcs} = NDEigensystem[Laplacian[\[Zeta][x, y], {x, y}], \[Zeta], {x, y} \[Element] reg, 50];

and I need to decompose the eigenmodes into their component plane waves ie. $$ \zeta(x,y) = \sum_i A_i\cos(\vec{k}_i \cdot \vec{x}) + B_i\sin(\vec{k}_i \cdot \vec{x}) $$ where $\vec{x} = (x,y)$ and $|\vec{k}_i| = k$ is the wavenumber of the mode I am interested in

I have tried posing the problem as a linear system, summing finite cosine and sine terms at evenly spaced angles and evaluating the eigenmode at evenly spaced points:

bounds = RegionBounds[reg];
i = 15;
k = Sqrt[-vals[[i]]];

n = 10;
pts = Select[
   Flatten[
    Table[{x, y}, {x, bounds[[1, 1]], bounds[[1, 2]], (
      bounds[[1, 2]] - bounds[[1, 1]])/n}, {y, bounds[[2, 1]], 
      bounds[[2, 2]], (bounds[[2, 2]] - bounds[[2, 1]])/n}], 1], 
   NumericQ[Quiet@funcs[[i]][#[[1]], #[[2]]]] &];
If[Mod[Length[pts], 2] != 0, pts = pts[[;; -2]]];
nPts = Length[pts];

m = Table[
   Flatten[Table[{Cos[k {Cos[\[Theta]], Sin[\[Theta]]} . pts[[j]]], 
      Sin[k {Cos[\[Theta]], Sin[\[Theta]]} . pts[[j]]]}, {\[Theta], 
      0, \[Pi] (1 - 2/nPts), (2 \[Pi])/nPts}]], {j, nPts}];
b = Table[funcs[[i]][pts[[j, 1]], pts[[j, 2]]], {j, nPts}];
sol = LinearSolve[m, b]

but I get the error

LinearSolve::luc: Result for LinearSolve of badly conditioned matrix {{0.981031,-0.19385,0.985288,-0.170904,0.994813,-0.101725,0.999903,0.0139491,0.984732,0.174079,<<64>>},{0.391126,0.920337,0.670184,0.742195,0.856171,0.516692,0.957962,0.286895,0.996627,0.0820664,<<64>>},{0.391126,0.920337,0.578956,0.815359,0.713611,0.700542,0.802905,0.596107,0.856782,0.515678,<<64>>},<<6>>,{-0.820435,0.571739,-0.584819,0.811164,-0.311331,0.950302,-0.0401902,0.999192,0.201146,0.979561,<<64>>},<<64>>} may contain significant numerical errors.

Is there another way to solve this problem, maybe through fourier series?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy