This problem can (mostly) be solved if we convert to polar coordinates and solve u
as a function of r,t
. The pde in the narrative does not match the code, but I will go with the code, changing the variables from x,y
to r
.
pde = Laplacian[u[r, t], {r, theta]}, "Polar"] + u[r, t] (2 - u[r, t]) == D[u[r, t], t]
(*D[ u[r, t], r]/r + D[ u[r, t], r, r] + (2 - u[r, t]) u[r, t] ==
D[ u[r, t], t]*)
NDSolve doesn't like the 1/r
in the pde at r = 0
, so instead of solving from 0
, I will have r
go from some small value epsilon
to 1
. In doing that, I will have to add the boundary condition at r = epsilon
. The derivative of u
would be 0 at the center of the disk anyway.
epsilon = .0001;
bc1 = (D[ u[r, t], r] /. r -> 1) == 0;
bc2 = (D[ u[r, t], r] /. r -> epsilon) == 0;
The given initial condition does not match up with the boundary condition at r = 1
very well. NDSolve in trying to reconcile the two conditions is too unstable to get anywhere, so I modified the ic slightly, by making it a combination of 2 functions. Most of the disk retains the given ic, with a transition to a funtion that has a 0
derivative at r = 1
.
f1 = r^2 - 1
f2 = -1000 (r - 1)^2
Find the transition point, where the two are equal:
r1 = r /. FindRoot[f1 - f2, {r, .9}]
(*0.998002*)
Form the ic transition from f1
to f2
with a combination of UnitStep
functions.
ic = u[r, 0] == (UnitStep[r - epsilon] -
UnitStep[r - r1]) f1 + (UnitStep[r - r1] - UnitStep[r - 1]) f2
Now plug into NDSolve.
s = NDSolve[{pde, bc1, bc2, ic}, u, {r, epsilon, 1}, {t, 0, 1},
PrecisionGoal -> Infinity, MaxStepFraction -> 1/1000,
MaxSteps -> {50000, Automatic}];
NDSolve still complains about inconsistent bc's and ic's and doesn't run all that long, but it gives a enough of a solution to see the behavior of u.
u[r_, t_] = u[r, t] /. s[[1]];
gifs = Table[Plot[u[r, t], {r, epsilon, 1}, PlotRange -> {-2, 0},
PlotLabel -> t "t"], {t, 0, .5, .01}];
ListAnimate[gifs]

Subscript
while defining symbols (variables).Subscript[x, 1]
is not a symbol, but a compound expression, if you do $x_1=2$ you are actually doingSet[Subscript[x, 1], 2]
which is to assign a Downvalue toSubscript
and not an Ownvalue to an indexedx
as you may intend. Read how to properly define indexed variables here. $\endgroup$ – rhermans Feb 1 '16 at 17:14a
(in your casea=1-u
) is a scalar. I am guessinga
can depend on{x,y}
, but not onu
, that's just not implemented inNDSolve
. $\endgroup$ – Alexander Erlich Aug 20 '17 at 15:04