交互求解和可视化偏微分方程
通过调整一个缺口在矩形上交互操作一个泊松方程(Poisson equation).
In[1]:=
Manipulate[DynamicModule[{ifun},
ifun = NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 1,
DirichletCondition[u[x, y] == 0., True]},
u, {x, y} \[Element]
RegionDifference[Rectangle[{0, 0}, {1, 1}], Rectangle[p1, p2]]];
ContourPlot[ifun[x, y], {x, y} \[Element] ifun["ElementMesh"],
ColorFunction -> "TemperatureMap"]]
, {{p1, {0.3, 0.2}}, Locator}
, {{p2, {0.5, 0.4}}, Locator}]