by Kathy_Bautista » Thu Jun 24, 2010 12:05 am
I have spoken to our technical support engineers about this issue, and they commented that this is basically related to how initial/boundary conditions are to be specified for NDSolve. I have attached their comments below.
-Kathy
-----------------
Certain limitations exist in terms of how these can be specified. I have tried to give some workarounds to get a reasonable solution, which you can see below.
If the problem (system) has singularities, then PrecisionGoal may have to be used to get better results.
Given equation and boundary conditions
IN:
eqn = D[u[r, z], {z, 2}] + D[u[r, z], {r, 2}] + D[u[r, z], {r, 1}]*1/r ==
0; b1 = (D[u[r, z], {z, 1}] /. z -> 0) ==
0; b2 = (D[u[r, z], {r, 1}] /. r -> 10^-5) == 0; b3 = u[r, 2] == 1; b4 =
u[2, z] == 1;
NDSolve[{eqn, b1, b2, b3, b4}, u, {r, 0, 2}, {z, 0, 2}]
ERROR:
NDSolve::bcedge: Boundary condition u[2,z]==1 is not specified on a single edge of the boundary of the computational domain. >>
The above error indicates that there is inconsistency between the specified boundary conditions and the domain of NDSolve. Note that the domain of NDSolve is given as {r,0,2} and {z,0,2}.
Try changing the b.c to fit the domain values for r.
IN:
eqn = D[u[r, z], {z, 2}] + D[u[r, z], {r, 2}] +
D[u[r, z], {r, 1}]*1/r ==
0; b1 = (D[u[r, z], {z, 1}] /. z -> 0) ==
0; b2 = (D[u[r, z], {r, 1}] /. r -> 10^-5) == 0; b3 =
u[r, 2] == 1; b4 = u[10^-5, z] == 1;
NDSolve[{eqn, b1, b2, b3, b4}, u, {r, 10^-5, 2}, {z, 0, 2}]
ERROR:
NDSolve::eerr: Warning: Scaled local spatial error estimate of 717.6034425350999` at r = 2.` in the direction of independent variable z is much greater than 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 you may want to specify a smaller grid spacing using the MaxStepSize or MinPoints method options. >>
The above warning message indicates that there could be some singularity in the solution, and the error can be high.
Try using PrecisionGoal
IN:
eqn = D[u[r, z], {z, 2}] + D[u[r, z], {r, 2}] +
D[u[r, z], {r, 1}]*1/r ==
0; b1 = (D[u[r, z], {z, 1}] /. z -> 0) ==
0; b2 = (D[u[r, z], {r, 1}] /. r -> 10^-5) == 0; b3 =
u[r, 2] == 1; b4 = u[10^-5, z] == 1;
NDSolve[{eqn, b1, b2, b3, b4}, u, {r, 10^-5, 2}, {z, 0, 2},
PrecisionGoal -> 2]
The solution looks reasonable.
Notice that NDSolve must have "consistent" boundary and initial conditions. Thats why the following fails. Note the error message.
IN:
eqn = D[u[r, z], {z, 2}] + D[u[r, z], {r, 2}] +
D[u[r, z], {r, 1}]*1/r ==
0; b1 = (D[u[r, z], {z, 1}] /. z -> 0) ==
0; b2 = (D[u[r, z], {r, 1}] /. r -> 10^-5) == 0; b3 =
u[r, 2] == 1; b4 = u[2, z] == 1;
NDSolve[{eqn, b1, b2, b3, b4}, u, {r, 10^-5, 2}, {z, 0, 2},
PrecisionGoal -> 2]
ERROR:
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. >>
The following also works. (Changing the boundary conditions for r.)
IN:
eqn = D[u[r, z], {z, 2}] + D[u[r, z], {r, 2}] +
D[u[r, z], {r, 1}]*1/r ==
0; b1 = (D[u[r, z], {z, 1}] /. z -> 0) ==
0; b2 = (D[u[r, z], {r, 1}] /. r -> 2) == 0; b3 = u[r, 2] == 1; b4 =
u[2, z] == 1;
NDSolve[{eqn, b1, b2, b3, b4}, u, {r, 10^-5, 2}, {z, 0, 2},
PrecisionGoal -> 2]