Specific Numerical Eigenfunctions of Helmholtz equation in 3D for ellipsoids












6












$begingroup$


I am trying to compute the eigenfunctions of an oblate spheroid (a=75 cm and b=60 cm) using Mathematica's FEM package and Chris' answer from here. Specifically, I am looking for eigenfrequencies around 433, 893, 913 and 2400 MGHz. Is there any way I could narrow my search besides getting all eigenfrequencies initially and then looking for the desired outcome which is impractical?



Here is my code for the first 4 eigenmodes:



Needs["NDSolve`FEM`"];

helmholzSolve3D[g_, numEigenToCompute_Integer,
opts : OptionsPattern] :=
Module[{u, x, y, z, t, pde, dirichletCondition, mesh, boundaryMesh,
nr, state, femdata, initBCs, methodData, initCoeffs, vd, sd,
discretePDE, discreteBCs, load, stiffness, damping, pos, nDiri,
numEigen, res, eigenValues, eigenVectors,
evIF},

(*Discretize the region*)

If[Head[g] === ImplicitRegion || Head[g] === ParametricRegion,
mesh = ToElementMesh[DiscretizeRegion[g, opts], opts],
mesh = ToElementMesh[DiscretizeGraphics[g, opts], opts]];
boundaryMesh = ToBoundaryMesh[mesh];

(*Set up the PDE and boundary condition*)

pde = D[u[t, x, y, z], t] - Laplacian[u[t, x, y, z], {x, y, z}] +
u[t, x, y, z] == 0;
dirichletCondition = DirichletCondition[u[t, x, y, z] == 0, True];
(*Pre-process the equations to obtain the FiniteElementData in
StateData*)nr = ToNumericalRegion[mesh];
{state} =
NDSolve`ProcessEquations[{pde, dirichletCondition,
u[0, x, y, z] == 0}, u, {t, 0, 1}, Element[{x, y, z}, nr]];
femdata = state["FiniteElementData"];
initBCs = femdata["BoundaryConditionData"];
methodData = femdata["FEMMethodData"];
initCoeffs = femdata["PDECoefficientData"];

(*Set up the solution*)vd = methodData["VariableData"];

sd = NDSolve`SolutionData[{"Space" -> nr, "Time" -> 0.}];

(*Discretize the PDE and boundary conditions*)

discretePDE = DiscretizePDE[initCoeffs, methodData, sd];
discreteBCs = DiscretizeBoundaryConditions[initBCs, methodData, sd];

(*Extract the relevant matrices and deploy the boundary conditions*)

load = discretePDE["LoadVector"];
stiffness = discretePDE["StiffnessMatrix"];
damping = discretePDE["DampingMatrix"];
DeployBoundaryConditions[{load, stiffness, damping}, discreteBCs];

(*Set the number of eigenvalues ignoring the Dirichlet positions*)

pos = discreteBCs["DirichletMatrix"]["NonzeroPositions"][[All, 2]];
nDiri = Length[pos];
numEigen = numEigenToCompute + nDiri;

(*Solve the eigensystem*)

res = Eigensystem[{stiffness, damping}, -numEigen];
res = Reverse /@ res;
eigenValues = res[[1, nDiri + 1 ;; Abs[numEigen]]];
eigenVectors = res[[2, nDiri + 1 ;; Abs[numEigen]]];
evIF = ElementMeshInterpolation[{mesh}, #] & /@ eigenVectors;

(*Return the relevant information*)

{eigenValues, evIF, mesh}]

{ev, if, mesh} =
helmholzSolve3D[Ellipsoid[{0, 0, 0}, {0.75, 0.6, 0.6}], 4,
MaxCellMeasure -> 0.025]

Table[
DensityPlot[
if[[i]][x, y, 0.1], {x, -1, 1}, {y, -1, 1},
RegionFunction -> Function[{x, y}, x^2/0.75^2 + y^2/0.6^2 < 1],
PlotLabel -> ev[i] ,
ColorFunction -> Hue,
PlotLegends -> Automatic
],
{i, 1, 4}
]


Any suggestions?










share|improve this question









$endgroup$

















    6












    $begingroup$


    I am trying to compute the eigenfunctions of an oblate spheroid (a=75 cm and b=60 cm) using Mathematica's FEM package and Chris' answer from here. Specifically, I am looking for eigenfrequencies around 433, 893, 913 and 2400 MGHz. Is there any way I could narrow my search besides getting all eigenfrequencies initially and then looking for the desired outcome which is impractical?



    Here is my code for the first 4 eigenmodes:



    Needs["NDSolve`FEM`"];

    helmholzSolve3D[g_, numEigenToCompute_Integer,
    opts : OptionsPattern] :=
    Module[{u, x, y, z, t, pde, dirichletCondition, mesh, boundaryMesh,
    nr, state, femdata, initBCs, methodData, initCoeffs, vd, sd,
    discretePDE, discreteBCs, load, stiffness, damping, pos, nDiri,
    numEigen, res, eigenValues, eigenVectors,
    evIF},

    (*Discretize the region*)

    If[Head[g] === ImplicitRegion || Head[g] === ParametricRegion,
    mesh = ToElementMesh[DiscretizeRegion[g, opts], opts],
    mesh = ToElementMesh[DiscretizeGraphics[g, opts], opts]];
    boundaryMesh = ToBoundaryMesh[mesh];

    (*Set up the PDE and boundary condition*)

    pde = D[u[t, x, y, z], t] - Laplacian[u[t, x, y, z], {x, y, z}] +
    u[t, x, y, z] == 0;
    dirichletCondition = DirichletCondition[u[t, x, y, z] == 0, True];
    (*Pre-process the equations to obtain the FiniteElementData in
    StateData*)nr = ToNumericalRegion[mesh];
    {state} =
    NDSolve`ProcessEquations[{pde, dirichletCondition,
    u[0, x, y, z] == 0}, u, {t, 0, 1}, Element[{x, y, z}, nr]];
    femdata = state["FiniteElementData"];
    initBCs = femdata["BoundaryConditionData"];
    methodData = femdata["FEMMethodData"];
    initCoeffs = femdata["PDECoefficientData"];

    (*Set up the solution*)vd = methodData["VariableData"];

    sd = NDSolve`SolutionData[{"Space" -> nr, "Time" -> 0.}];

    (*Discretize the PDE and boundary conditions*)

    discretePDE = DiscretizePDE[initCoeffs, methodData, sd];
    discreteBCs = DiscretizeBoundaryConditions[initBCs, methodData, sd];

    (*Extract the relevant matrices and deploy the boundary conditions*)

    load = discretePDE["LoadVector"];
    stiffness = discretePDE["StiffnessMatrix"];
    damping = discretePDE["DampingMatrix"];
    DeployBoundaryConditions[{load, stiffness, damping}, discreteBCs];

    (*Set the number of eigenvalues ignoring the Dirichlet positions*)

    pos = discreteBCs["DirichletMatrix"]["NonzeroPositions"][[All, 2]];
    nDiri = Length[pos];
    numEigen = numEigenToCompute + nDiri;

    (*Solve the eigensystem*)

    res = Eigensystem[{stiffness, damping}, -numEigen];
    res = Reverse /@ res;
    eigenValues = res[[1, nDiri + 1 ;; Abs[numEigen]]];
    eigenVectors = res[[2, nDiri + 1 ;; Abs[numEigen]]];
    evIF = ElementMeshInterpolation[{mesh}, #] & /@ eigenVectors;

    (*Return the relevant information*)

    {eigenValues, evIF, mesh}]

    {ev, if, mesh} =
    helmholzSolve3D[Ellipsoid[{0, 0, 0}, {0.75, 0.6, 0.6}], 4,
    MaxCellMeasure -> 0.025]

    Table[
    DensityPlot[
    if[[i]][x, y, 0.1], {x, -1, 1}, {y, -1, 1},
    RegionFunction -> Function[{x, y}, x^2/0.75^2 + y^2/0.6^2 < 1],
    PlotLabel -> ev[i] ,
    ColorFunction -> Hue,
    PlotLegends -> Automatic
    ],
    {i, 1, 4}
    ]


    Any suggestions?










    share|improve this question









    $endgroup$















      6












      6








      6





      $begingroup$


      I am trying to compute the eigenfunctions of an oblate spheroid (a=75 cm and b=60 cm) using Mathematica's FEM package and Chris' answer from here. Specifically, I am looking for eigenfrequencies around 433, 893, 913 and 2400 MGHz. Is there any way I could narrow my search besides getting all eigenfrequencies initially and then looking for the desired outcome which is impractical?



      Here is my code for the first 4 eigenmodes:



      Needs["NDSolve`FEM`"];

      helmholzSolve3D[g_, numEigenToCompute_Integer,
      opts : OptionsPattern] :=
      Module[{u, x, y, z, t, pde, dirichletCondition, mesh, boundaryMesh,
      nr, state, femdata, initBCs, methodData, initCoeffs, vd, sd,
      discretePDE, discreteBCs, load, stiffness, damping, pos, nDiri,
      numEigen, res, eigenValues, eigenVectors,
      evIF},

      (*Discretize the region*)

      If[Head[g] === ImplicitRegion || Head[g] === ParametricRegion,
      mesh = ToElementMesh[DiscretizeRegion[g, opts], opts],
      mesh = ToElementMesh[DiscretizeGraphics[g, opts], opts]];
      boundaryMesh = ToBoundaryMesh[mesh];

      (*Set up the PDE and boundary condition*)

      pde = D[u[t, x, y, z], t] - Laplacian[u[t, x, y, z], {x, y, z}] +
      u[t, x, y, z] == 0;
      dirichletCondition = DirichletCondition[u[t, x, y, z] == 0, True];
      (*Pre-process the equations to obtain the FiniteElementData in
      StateData*)nr = ToNumericalRegion[mesh];
      {state} =
      NDSolve`ProcessEquations[{pde, dirichletCondition,
      u[0, x, y, z] == 0}, u, {t, 0, 1}, Element[{x, y, z}, nr]];
      femdata = state["FiniteElementData"];
      initBCs = femdata["BoundaryConditionData"];
      methodData = femdata["FEMMethodData"];
      initCoeffs = femdata["PDECoefficientData"];

      (*Set up the solution*)vd = methodData["VariableData"];

      sd = NDSolve`SolutionData[{"Space" -> nr, "Time" -> 0.}];

      (*Discretize the PDE and boundary conditions*)

      discretePDE = DiscretizePDE[initCoeffs, methodData, sd];
      discreteBCs = DiscretizeBoundaryConditions[initBCs, methodData, sd];

      (*Extract the relevant matrices and deploy the boundary conditions*)

      load = discretePDE["LoadVector"];
      stiffness = discretePDE["StiffnessMatrix"];
      damping = discretePDE["DampingMatrix"];
      DeployBoundaryConditions[{load, stiffness, damping}, discreteBCs];

      (*Set the number of eigenvalues ignoring the Dirichlet positions*)

      pos = discreteBCs["DirichletMatrix"]["NonzeroPositions"][[All, 2]];
      nDiri = Length[pos];
      numEigen = numEigenToCompute + nDiri;

      (*Solve the eigensystem*)

      res = Eigensystem[{stiffness, damping}, -numEigen];
      res = Reverse /@ res;
      eigenValues = res[[1, nDiri + 1 ;; Abs[numEigen]]];
      eigenVectors = res[[2, nDiri + 1 ;; Abs[numEigen]]];
      evIF = ElementMeshInterpolation[{mesh}, #] & /@ eigenVectors;

      (*Return the relevant information*)

      {eigenValues, evIF, mesh}]

      {ev, if, mesh} =
      helmholzSolve3D[Ellipsoid[{0, 0, 0}, {0.75, 0.6, 0.6}], 4,
      MaxCellMeasure -> 0.025]

      Table[
      DensityPlot[
      if[[i]][x, y, 0.1], {x, -1, 1}, {y, -1, 1},
      RegionFunction -> Function[{x, y}, x^2/0.75^2 + y^2/0.6^2 < 1],
      PlotLabel -> ev[i] ,
      ColorFunction -> Hue,
      PlotLegends -> Automatic
      ],
      {i, 1, 4}
      ]


      Any suggestions?










      share|improve this question









      $endgroup$




      I am trying to compute the eigenfunctions of an oblate spheroid (a=75 cm and b=60 cm) using Mathematica's FEM package and Chris' answer from here. Specifically, I am looking for eigenfrequencies around 433, 893, 913 and 2400 MGHz. Is there any way I could narrow my search besides getting all eigenfrequencies initially and then looking for the desired outcome which is impractical?



      Here is my code for the first 4 eigenmodes:



      Needs["NDSolve`FEM`"];

      helmholzSolve3D[g_, numEigenToCompute_Integer,
      opts : OptionsPattern] :=
      Module[{u, x, y, z, t, pde, dirichletCondition, mesh, boundaryMesh,
      nr, state, femdata, initBCs, methodData, initCoeffs, vd, sd,
      discretePDE, discreteBCs, load, stiffness, damping, pos, nDiri,
      numEigen, res, eigenValues, eigenVectors,
      evIF},

      (*Discretize the region*)

      If[Head[g] === ImplicitRegion || Head[g] === ParametricRegion,
      mesh = ToElementMesh[DiscretizeRegion[g, opts], opts],
      mesh = ToElementMesh[DiscretizeGraphics[g, opts], opts]];
      boundaryMesh = ToBoundaryMesh[mesh];

      (*Set up the PDE and boundary condition*)

      pde = D[u[t, x, y, z], t] - Laplacian[u[t, x, y, z], {x, y, z}] +
      u[t, x, y, z] == 0;
      dirichletCondition = DirichletCondition[u[t, x, y, z] == 0, True];
      (*Pre-process the equations to obtain the FiniteElementData in
      StateData*)nr = ToNumericalRegion[mesh];
      {state} =
      NDSolve`ProcessEquations[{pde, dirichletCondition,
      u[0, x, y, z] == 0}, u, {t, 0, 1}, Element[{x, y, z}, nr]];
      femdata = state["FiniteElementData"];
      initBCs = femdata["BoundaryConditionData"];
      methodData = femdata["FEMMethodData"];
      initCoeffs = femdata["PDECoefficientData"];

      (*Set up the solution*)vd = methodData["VariableData"];

      sd = NDSolve`SolutionData[{"Space" -> nr, "Time" -> 0.}];

      (*Discretize the PDE and boundary conditions*)

      discretePDE = DiscretizePDE[initCoeffs, methodData, sd];
      discreteBCs = DiscretizeBoundaryConditions[initBCs, methodData, sd];

      (*Extract the relevant matrices and deploy the boundary conditions*)

      load = discretePDE["LoadVector"];
      stiffness = discretePDE["StiffnessMatrix"];
      damping = discretePDE["DampingMatrix"];
      DeployBoundaryConditions[{load, stiffness, damping}, discreteBCs];

      (*Set the number of eigenvalues ignoring the Dirichlet positions*)

      pos = discreteBCs["DirichletMatrix"]["NonzeroPositions"][[All, 2]];
      nDiri = Length[pos];
      numEigen = numEigenToCompute + nDiri;

      (*Solve the eigensystem*)

      res = Eigensystem[{stiffness, damping}, -numEigen];
      res = Reverse /@ res;
      eigenValues = res[[1, nDiri + 1 ;; Abs[numEigen]]];
      eigenVectors = res[[2, nDiri + 1 ;; Abs[numEigen]]];
      evIF = ElementMeshInterpolation[{mesh}, #] & /@ eigenVectors;

      (*Return the relevant information*)

      {eigenValues, evIF, mesh}]

      {ev, if, mesh} =
      helmholzSolve3D[Ellipsoid[{0, 0, 0}, {0.75, 0.6, 0.6}], 4,
      MaxCellMeasure -> 0.025]

      Table[
      DensityPlot[
      if[[i]][x, y, 0.1], {x, -1, 1}, {y, -1, 1},
      RegionFunction -> Function[{x, y}, x^2/0.75^2 + y^2/0.6^2 < 1],
      PlotLabel -> ev[i] ,
      ColorFunction -> Hue,
      PlotLegends -> Automatic
      ],
      {i, 1, 4}
      ]


      Any suggestions?







      differential-equations numerics finite-element-method






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 14 hours ago









      George GiannoulisGeorge Giannoulis

      573




      573






















          2 Answers
          2






          active

          oldest

          votes


















          7












          $begingroup$

          You could use something like this:



          {vals, funs} = 
          NDEigensystem[{-Laplacian[u[x, y, z], {x, y, z}] + u[x, y, z],
          DirichletCondition[u[x, y, z] == 0, True]}, u,
          Element[{x, y, z}, mesh], 4,
          Method -> {"Eigensystem" -> {"FEAST", "Interval" -> {425, 500}}}]

          {{427.961, 428.783, 430.026, 430.156},...}





          share|improve this answer









          $endgroup$





















            6












            $begingroup$

            You may try Eigensystem with



            Method -> {"FEAST", "Interval" -> {a, b}}


            to search eigenvalue pairs within an interval. See the documentation of Eigensystem, Section "Methods", Subsection "FEAST" for more details.






            share|improve this answer











            $endgroup$













              Your Answer





              StackExchange.ifUsing("editor", function () {
              return StackExchange.using("mathjaxEditing", function () {
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
              });
              });
              }, "mathjax-editing");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "387"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f194006%2fspecific-numerical-eigenfunctions-of-helmholtz-equation-in-3d-for-ellipsoids%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              7












              $begingroup$

              You could use something like this:



              {vals, funs} = 
              NDEigensystem[{-Laplacian[u[x, y, z], {x, y, z}] + u[x, y, z],
              DirichletCondition[u[x, y, z] == 0, True]}, u,
              Element[{x, y, z}, mesh], 4,
              Method -> {"Eigensystem" -> {"FEAST", "Interval" -> {425, 500}}}]

              {{427.961, 428.783, 430.026, 430.156},...}





              share|improve this answer









              $endgroup$


















                7












                $begingroup$

                You could use something like this:



                {vals, funs} = 
                NDEigensystem[{-Laplacian[u[x, y, z], {x, y, z}] + u[x, y, z],
                DirichletCondition[u[x, y, z] == 0, True]}, u,
                Element[{x, y, z}, mesh], 4,
                Method -> {"Eigensystem" -> {"FEAST", "Interval" -> {425, 500}}}]

                {{427.961, 428.783, 430.026, 430.156},...}





                share|improve this answer









                $endgroup$
















                  7












                  7








                  7





                  $begingroup$

                  You could use something like this:



                  {vals, funs} = 
                  NDEigensystem[{-Laplacian[u[x, y, z], {x, y, z}] + u[x, y, z],
                  DirichletCondition[u[x, y, z] == 0, True]}, u,
                  Element[{x, y, z}, mesh], 4,
                  Method -> {"Eigensystem" -> {"FEAST", "Interval" -> {425, 500}}}]

                  {{427.961, 428.783, 430.026, 430.156},...}





                  share|improve this answer









                  $endgroup$



                  You could use something like this:



                  {vals, funs} = 
                  NDEigensystem[{-Laplacian[u[x, y, z], {x, y, z}] + u[x, y, z],
                  DirichletCondition[u[x, y, z] == 0, True]}, u,
                  Element[{x, y, z}, mesh], 4,
                  Method -> {"Eigensystem" -> {"FEAST", "Interval" -> {425, 500}}}]

                  {{427.961, 428.783, 430.026, 430.156},...}






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 6 hours ago









                  user21user21

                  20k45285




                  20k45285























                      6












                      $begingroup$

                      You may try Eigensystem with



                      Method -> {"FEAST", "Interval" -> {a, b}}


                      to search eigenvalue pairs within an interval. See the documentation of Eigensystem, Section "Methods", Subsection "FEAST" for more details.






                      share|improve this answer











                      $endgroup$


















                        6












                        $begingroup$

                        You may try Eigensystem with



                        Method -> {"FEAST", "Interval" -> {a, b}}


                        to search eigenvalue pairs within an interval. See the documentation of Eigensystem, Section "Methods", Subsection "FEAST" for more details.






                        share|improve this answer











                        $endgroup$
















                          6












                          6








                          6





                          $begingroup$

                          You may try Eigensystem with



                          Method -> {"FEAST", "Interval" -> {a, b}}


                          to search eigenvalue pairs within an interval. See the documentation of Eigensystem, Section "Methods", Subsection "FEAST" for more details.






                          share|improve this answer











                          $endgroup$



                          You may try Eigensystem with



                          Method -> {"FEAST", "Interval" -> {a, b}}


                          to search eigenvalue pairs within an interval. See the documentation of Eigensystem, Section "Methods", Subsection "FEAST" for more details.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 5 hours ago

























                          answered 14 hours ago









                          Henrik SchumacherHenrik Schumacher

                          58.1k579160




                          58.1k579160






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Mathematica Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              Use MathJax to format equations. MathJax reference.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f194006%2fspecific-numerical-eigenfunctions-of-helmholtz-equation-in-3d-for-ellipsoids%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                              Bunad

                              Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum