I would like to solve the following nonlinear PDE:
∂2ϕ∂x2−∂2ϕ∂t2=λ|ϕ|2ϕ
I was trying:
NDSolve[{D[f[x, t], x, x] - D[f[x, t], t, t] == f[x, t]^3, f[x, 0] == Sin[2*Pi*x], f[0, t] == 0, f[1, t] == 0}, f, {x, 0, 1}, {t, 0, 1}]
but, I am consistenly getting NDSolve::femnonlinear: Nonlinear coefficients are not supported in this version of NDSolve
.
Is there any solver for non-linear PDEs?
Answer
The error message is misleading. NDSolve
fails, because not enough boundary conditions in t
have been supplied. If, for instance, (D[f[x, t], t] /. t -> 0) == 0
is added, then
sol = First@NDSolve[{D[f[x, t], x, x] - D[f[x, t], t, t] == f[x, t]^3,
f[x, 0] == Sin[2*Pi*x], (D[f[x, t], t] /. t -> 0) == 0,
f[0, t] == 0, f[1, t] == 0}, f, {x, 0, 1}, {t, 0, 1}];
yields
Plot3D[f[x, t] /. sol, {x, 0, 1}, {t, 0, 1}, AxesLabel -> {x, t, f},
LabelStyle -> Directive[Black, Bold, 12]]
Comments
Post a Comment