# How to solve a nonlinear coupled PDE with initial and some boundary values

I would like to solve the following nonlinear coupled PDE with a mix of initial conditions and boundary values:

rMax = 0.01;
sol = First@NDSolve[{
Derivative[2, 0][g][r, z] + Derivative[0, 2][g][r, z] == u[r, z]^2,
Derivative[2, 0][u][r, z] + Derivative[0, 1][u][r, z] == -g[r, z],
Derivative[1, 0][u][0, z] == 0.0,
Derivative[1, 0][u][rMax, z] == 0.0,
u[rMax, z] == 0.0,
u[r, 0] == g[r, 0] == Sin[\[Pi] r/rMax],
Derivative[1, 0][g][0, z] == g[rMax, z] == 0.0},
{u, g}, {r, 0, rMax}, {z, 0, 0.01}]


but I receive the following error message (in version 10.0.1.0):

NDSolve::femnonlinear: Nonlinear coefficients are not supported in this version of NDSolve.

The offender is the square term u[r, z]^2 in the first equation; without the square NSolve[] executes without errors. NDSolve seems to apply the FEM method by default to such problems. I'm wondering why NDSolve[] doesn't switch back to another (propagation-type) algorithm? When I add the option Method -> "MethodOfLines", the error message changes to

NDSolve::ivone: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable.

and I don't quite understand why this is because my time-like variable is z and I'm setting initial conditions only for z=0 and then boundary conditions at r=0 and r=rMax which should be OK?

Any ideas how to solve my problem? Another post suggested calling low-level FEM routines directly, is this a solution? What's the advantage of using FEM on an initial condition/boundary value problem over other methods: speed, accuracy, robustness?

• Try NDSolve[..., Method -> {"MethodOfLines", "TemporalVariable" -> z}] -- You'll get another error message, but perhaps that will give you a clue. Sep 26, 2014 at 14:51
• OK, the new error message is NDSolve::tvic: "z cannot be used as the temporal independent variable because the conditions {u[r,0]==Sin[6283.19\ r],g[r,0]==Sin[6283.19\ r]} for that dimension do not constitute sufficient initial conditions given at only one value of z." Why would the condition at z=0 not be sufficient, being at the beginning of the requested solution range?
– RonH
Sep 26, 2014 at 15:07
• Perhaps a time derivative needs to be specified at z == 0? Sep 26, 2014 at 15:08
• I may be wrong but won't your Derivative[1, 0][u][0, z] == 0 condition be inconsistent with u[r, 0] == Sin[π r/rMax]? Sep 27, 2014 at 4:03
• @Silvia: Yes, you're correct, so let's replace the sine term by Cos[Pi/2 r/rMax].
– RonH
Sep 29, 2014 at 11:06

In version 12.0 you can solve this:

rMax = 0.01;
{usol, gsol} = NDSolveValue[{
Derivative[2, 0][g][r, z] + Derivative[0, 2][g][r, z] ==
u[r, z]^2,
Derivative[2, 0][u][r, z] + Derivative[0, 1][u][r, z] == -g[r, z],
u[rMax, z] == 0.0, u[r, 0] == g[r, 0] == Sin[\[Pi] r/rMax],
g[rMax, z] == 0.0}, {u, g}, {r, 0, rMax}, {z, 0, 0.01}]


I have removed the Neumann zero BCs.

Plot the solution for g:

Plot3D[gsol[r, z], {r, 0, rMax}, {z, 0, 0.01}] 