Lösen Sie ein Dirichlet-Problem für die Helmholtz-Gleichung
Spezifizieren Sie eine Helmholtz-Gleichung in 2D.
In[1]:=
![Click for copyable input](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/In_24.png)
heqn = {Laplacian[u[x, y], {x, y}] + 5 u[x, y] == 0};
Schreiben Sie Dirichlet-Bedingungen für die Gleichung auf dem Gebiet eines Rechtecks vor.
In[2]:=
![Click for copyable input](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/In_25.png)
bc = {u[x, 0] == UnitTriangle[x - 2]/2, u[x, 2] == 0, u[0, y] == 0,
u[4, y] == 0};
Lösen Sie das Dirichlet-Problem mit DSolveValue.
In[3]:=
![Click for copyable input](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/In_26.png)
(sol = DSolveValue[{heqn, bc}, u[x, y], {x, y}]) // TraditionalForm
Out[3]//TraditionalForm=
![](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/O_13.png)
Extrahieren Sie die ersten 30 Terme aus der Inactive-Summe.
In[4]:=
![Click for copyable input](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/In_27.png)
fsol = sol /. \[Infinity] -> 30 // Activate;
Visualisieren Sie die approximierte Lösung.
In[5]:=
![Click for copyable input](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/In_28.png)
Plot3D[fsol // Evaluate, {x, 0, 4}, {y, 0, 2}, PlotRange -> All,
PlotTheme -> "Scientific"]
Out[5]=
![](assets.de/solve-a-dirichlet-problem-for-the-helmholtz-equati/O_14.png)