Interactively Solve and Visualize PDEs
Interactively manipulate a Poisson equation over a rectangle by modifying a cutout.
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}]