5

I know that mathematica has a DEigensystem and NDEigensystem which allow one to find eigenfunction and eigenvalue for scalar differential operator. But I want to find eigenfunction and eigenvalue for vector operator with additional relation between component of that wector field.

I need to solve Maxwell's equation in arbitrary shape cavity. $$ \Delta \bf{E}=-\omega^2 \bf{E}\quad \bf{\nabla}\cdot \bf{E}=0$$ With boundary conditions $\bf{E}_{\tau}=0$ in a boundary of a cavity, where $\bf{E}_{\tau}$ is a tangent vector of a cavity boundary.

I don't now how to correctly take into account the equation $\bf{\nabla}\cdot \bf{E}=0$. And how two express the boundary condition correctly?

I can express one component of vector field $\bf E$ through another two, but in this case the boundary condition take a more complex form. This boundary conditions can not be expressed via DirichletCondition and NeumannValue.

Edit:

I can express one component of the vector field through another two. For example $$E_z=-\int dz(\partial_x E_x+\partial_y E_y)+g(x,y)$$ Function $g(x,y)$ should obey the same equation $\Delta g=-\omega^2 g$.

The boundary condition can be rewrited in the following form $\bf{E}_\tau=\bf{E}-(\bf{E}\cdot \bf{n})\,n=0$ where $\bf{n}$ is a unit vector perpendicular to the boundary.

It is possible to solve it for rectangle. But it does not make sense because in such case there is a analytical solution. I don't know how to realize this boundary condition in the mathematica.

I agree, that the additional conditions $\bf{\nabla}\cdot \bf{E}=0$ it is a not big problem here. But the boundary conditions it is a big problem, at least for me.

Edit2 For simplisity I try to solve the same 2 dimentional problem. If the boundary can be set in the following form $y=g(x)$, one can calcuete the tangent vector analyticaly $\bf{\tau}=\bf{e}_x+g'(x)\bf{e}_y$. I try the realize it in the Mathematica:

gg[x_] := 1 - x^2/2
region = ImplicitRegion[x > -1 && x < 1 && y < gg[x] && y > -gg[x], {x, y}];
NDEigensystem[{-Laplacian[{ux[x, y], uy[x, y]}, {x, y}], 
DirichletCondition[uy[x, y] == 0, x == -1], 
  DirichletCondition[uy[x, y] == 0, x == 1], 
  DirichletCondition[{ux[x, y], uy[x, y]}.{1, D[gg[x], x]} == 0, 
   y > 0 && x > -1 && x < 1], 
  DirichletCondition[{ux[x, y], uy[x, y]}.{1, -D[gg[x], x]} == 0, 
  y > 0 && x > -1 && x < 1]}, {ux[x, y], 
 uy[x, y]}, {x, y} \[Element] region, 6]

But it does not work.

Also for solution inside 3D sphere

region = ImplicitRegion[x^2 + y^2 + z^2 <= 1, {x, y, z}];
g1 = (x* Ex[x, y, z] + y *Ey[x, y, z] + z* Ez[x, y, z])/(x^2 + y^2 + z^2);
NDEigensystem[{-Laplacian[{Ex[x, y, z], Ey[x, y, z], Ez[x, y, z]}, {x,
  y, z}], DirichletCondition[{Ex[x, y, z] - x*g1 == 0, 
Ey[x, y, z] - y*g1 == 0, Ez[x, y, z] - z*g1 == 0}, True]}, {Ex[x,  y, z], Ey[x, y, z], Ez[x, y, z]}, {x, y, z} \[Element] region, 6]

It also does not work.

Peter
  • 205
  • 1
  • 7
  • 3
    Have you tried to code anything? If so you could share that. – user21 Feb 16 '18 at 07:46
  • I give up. This is how far I got.op = Laplacian[{Ex[x, y], Ey[x, y]}, {x, y}] + {Ex[x, y], Ey[x, y]}; bc = DirichletCondition[{Ex[x, y] == 0, Ey[x, y] == 0}, True]; {ev, ef} = NDEigensystem[{op, bc}, {Ex[x, y], Ey[x, y]}, {x, y} \[Element] Disk[], 9]; VectorPlot[#, {x, y} \[Element] Disk[]] & /@ ef I tried to impose the boundary condition by defining a normal vector and using the skalar product. But the DirichletCondition is only allowed to be linear. These lecture notes may be helpful. – Matthias Bernien Feb 17 '18 at 13:04
  • @MatthiasBernien Does not your Dirichlet condition impose $E_x = E_y = 0$ on the whole domain? – anderstood Feb 18 '18 at 15:38
  • @anderstood Yes. What I wanted to do was nvec={x,y}; DirichletCondition[{Ex[x, y], Ey[x, y]}.nvec/(Norm[nvec]Norm[{Ex[x, y], Ey[x, y]}])==1, True]. But that did not work. – Matthias Bernien Feb 18 '18 at 19:42
  • This at least works for a rectangle: op = Laplacian[{Ex[x, y], Ey[x, y]}, {x, y}] + {Ex[x, y], Ey[x, y]}; bc = {DirichletCondition[Ex[x, y] == 0, y == 0 || y == 1], DirichletCondition[Ey[x, y] == 0, x == 0 || x == 1]}; {ev, ef} = NDEigensystem[Flatten[{op, bc}], {Ex[x, y], Ey[x, y]}, {x, y} \[Element] Rectangle[], 9]; VectorPlot[#, {x, y} \[Element] Rectangle[]] & /@ ef. Not all of the ef have Div[...]=0. Then one can find linear combinations of ef with the same eigenvalues to get Div[...]=0. – Matthias Bernien Feb 18 '18 at 19:56
  • Here is an impressive answer of user21 that can probably solve the problem. But one needs to find a way to manually adapt the DiscretizedBoundaryConditionData in a meaningful way. – Matthias Bernien Feb 19 '18 at 16:43
  • In the documentation they say that cross-coupled Dirichlet conditions, which depend on both of the dependent variables, are not yet supported. To implement this would probably require a very skilled person. Maybe we have to wait for the next version of Mathematica. – Matthias Bernien Feb 20 '18 at 18:54
  • Is it possible to modify this answer for my case? I am no so familiar in mathematica and I even can not modify it for the case of vector laplasian with the same boundary condition. Can somebody help me with it? – Peter Feb 21 '18 at 22:49
  • 1
    @Peter Besides adding the second component of the field everywhere you need to split the eigenvectors into two halfs:evIFx = ElementMeshInterpolation[{mesh}, #[[1 ;; 539]]] & /@ eigenVectors; evIFy = ElementMeshInterpolation[{mesh}, #[[540 ;; -1]]] & /@ eigenVectors;. Then use VectorPlot. – Matthias Bernien Feb 22 '18 at 07:04
  • In 2D the Dirichlet conditions can be decoupled by transforming to polar coordinates. However, the condition E\[CurlyPhi][\[CurlyPhi], r] == nvec\[CurlyPhi][\[CurlyPhi], r] is still inhomogeneous which can be handeled by NDSolve but not by NDEigensystem. In the answer of user21 one can input inhomogeneous conditions but they have no effect. @user21 Is there a way to extend the solution? – Matthias Bernien Feb 22 '18 at 09:41
  • @MatthiasBernien, inhomogeneous BCs can not be handled; ever. The reason is simple. The eigensystem solved is D=\lambdaS where D is the matrix from the time dependent component and S is the stiffness matrix. Note, there is no F (right hand side) but that is where the value of the Dirichlet condition will be. But since it is not part of the eigenvalue equation it can not be modeled. The cross coupling is not a problem in principal since that gives a relation between Dirichlet positions. That could be done like here.... – user21 Feb 22 '18 at 11:58
  • ... The problem is the x in front of that. One would need to actually integrate along the line. Not impossible, but I do not want to spend the time to do it. Maybe, just maybe, you could model this with a PeriodicBoundaryCondition but that is a shot in the (very) dark. – user21 Feb 22 '18 at 12:00

0 Answers0