0
$\begingroup$

I'm trying to solve a nonlinear PDE using NDSolve. For reference, my mathematica code is as follows:

PDE = -(1 + 1/z^2)^(-1)(D[u[z, t], t])^2 + (1 + 1/z^2)(-z^2 D[u[z, t], z])^2 == -1
BC = u[0.1, t] == 0.1;
InitCond = u[z, 0] == z;
Sol = NDSolve[Join[{PDE}, {BC}, {InitCond}], 
  u, {z, 0.1, 0.9}, {t, 0, 1}]
usol[z_, t_] := u[z, t] /. Sol[[1]]
Plot3D[usol[z, t], {z, 0.1, 0.9}, {t, 0, 1}]

Upon execution, it throws out a warning and the plotted figure is nothing but an empty box. The warning goes:

NDSolve::eerr: Warning: scaled local spatial error estimate of 60.68099644559237 at z = 0.9 in the direction of independent variable t is much greater than the prescribed error tolerance. Grid spacing with 25 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or a smaller grid spacing can be specified using the MaxStepSize or MinPoints method options.

How do I resolve this issue?

$\endgroup$
3
  • $\begingroup$ btw, you can just write NDSolve[{PDE, BC, InitCond}, u,...] and it will work also. i.e. no need to use Join command. just fyi. $\endgroup$
    – Nasser
    Commented Dec 3 at 5:10
  • 2
    $\begingroup$ There are two branches in solution generated by NDSolve with automatic options, and these solutions are complex. To plot all branches, we can use Table[Plot3D[ Abs[u[z, t]] /. Sol[[i]][[1]], {z, 0.1, 0.9}, {t, 0, 1}], {i, Length[Sol]}]. If you expected real solutions only, please use code proposed by Nasser with handmade mesh. $\endgroup$ Commented Dec 3 at 11:21
  • 1
    $\begingroup$ Your PDE looks a bit unusual, can you add a bit more background info? Do you deduce it yourself or you're trying to reproduce result in certain literature? If the lattter, it would be helpful if you can add the reference. $\endgroup$
    – xzczd
    Commented Dec 5 at 0:45

1 Answer 1

1
$\begingroup$

and the plotted figure is nothing but an empty box

This is a work around which gives non empty plot. It still generates some warnings though, but the plot looks OK

 PDE = -(1 + 1/z^2)^(-1) (D[u[z, t], t])^2 + (1 + 
      1/z^2) (-z^2 D[u[z, t], z])^2 == -1
BC = u[0.1, t] == 0.1;
InitCond = u[z, 0] == z;
Sol = NDSolve[{PDE, BC, InitCond}, u, {z, 0.1, 0.9}, {t, 0, 1}, 
   Method -> {"PDEDiscretization" -> "FiniteElement"}];
usol[z_, t_] := u[z, t] /. Sol[[1]]
Plot3D[usol[z, t], {z, 0.1, 0.9}, {t, 0, 1}]

enter image description here

V 14.1 on windows.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.