I want to find the initial condition which fits mixed boundary condition of Phi[r, Theta, t].

The original initial condition in text is 

```
Phi[r, Theta, 0] == 1

```

. I heard the information that the initial condition doesn't have to be strictly consistent (the value 1). It can be bigger or smaller than 1, or can vary.

The mixed boundary condition which should be consistent with initial condition and shouldn't be changed is

```
Derivative[1, 0, 0][Phi][s, Theta, t] == k/rc Phi[s, Theta, t]

```

I tried five kinds of initial conditions.

At first, as information in text

```
Phi[r, Theta, 0] == 1

```

At second, (using exponential function in small section)

```
Phi[r, Theta, 0] == If[r < (1 + a) s, Exp[k/rc (r - s)], If[r < (1 + 2 a) s, 
Exp[-(k/rc) (r - (1 + 2 a) s)], 1]]

```

At third, (using linear function in small section)

```
Phi[r, Theta, 0] == If[r < (1 + b) s, k/rc (r - s) + 1, If[r < (1 + 2 b) s, 
-(k/rc) (r - (1 + 2 b) s) + 1, 1]]

```

At fourth, (using exponential function again but some different from second)

```
Phi[r, Theta, 0] == If[r < (1 + c) s, 2 - Exp[-(k/rc) (r - s)], If[r < (1 + 2 c) s, 
2 - Exp[k/rc (r - (1 + 2 c) s)], 1]]

```

At fifth, (same function with second, but using Piecewise than If statement)

```
Phi[r, Theta, 0] == Piecewise[{{Exp[k/rc (r - s)], r < (1 + a) s}, {Exp[-(k/
  rc) (r - (1 + 2 a) s)], r < (1 + 2 a) s}, {1, r >= (1 + 2 a) s}}]

```

All five trial gave me 'ibcinc boundary and initial conditions are inconsistent' error message.

How can I set '**initial condition**' to fit 'mixed boundary condition'?

Thanks in advance!

---

---

*From 
 here,
 it is the
 before-shortened 
 question.
 (How to get over NDSolve ibcinc error message? (Inconsistent initial condition and mixed boundary condition))*

I have a question about the error message which includes ibcinc.
The problem is that I tried to adjust initial condition to satisfy the Mixed boundary condition, but I was still given ibcinc inconsistent message.
The original initial condition is 

```
Phi[r, Theta, 0] == 1

```

. I tried to make new initial condition (Fun1[r],Fun2[r],and Fun3[r] instead of 1) using this original initial condition. However, this gave same ibcinc inconsistent IC and BC error message.

The hole code is following.

```
Clear["Global`*"]
Dif = 1.33 10^11;
s = 8 ;
rc = s/0.0713;
k = 10^4;
a = 10^-3;
Fun1[r_] = 
If[r < (1 + a) s, Exp[k/rc (r - s)], 
If[r < (1 + 2 a) s, 
Exp[-(k/rc) (r - (1 + 2 a) s)], 1]]
b = 10^-3;
Fun2[r_] = 
If[r < (1 + b) s, k/rc (r - s) + 1, 
If[r < (1 + 2 b) s, -(k/
   rc) (r - (1 + 2 b) s) + 1, 1]]
c = 10^-3;
Fun3[r_] = 
If[r < (1 + c) s, 2 - Exp[-(k/rc) (r - s)], 
If[r < (1 + 2 c) s, 
2 - Exp[k/rc (r - (1 + 2 c) s)], 1]]
Fun11[r_] = Piecewise[{{Exp[k/rc (r - s)], 
r < (1 + a) s}, {Exp[-(k/rc) (r - (1 + 2 a) s)], r < (1 + 2 a) s}, {1, 
r >= (1 + 2 a) s}}]
Plot[Fun1[r],{r,s,(1+3 a)s}]
Plot[Fun2[r],{r,s,(1+3 b)s}]
Plot[Fun3[r],{r,s,(1+3 c)s}]
Plot[Fun11[r],{r,s,(1+3 a)s}]
t0 = 10^-3;
tmax = 10;
rmax = 1.5 s
e = 1.602 10^-19
Ef = 10^6
kB = 1.381 10^-23
T = 298
Const = (e Ef)/(kB T) /10^10 (* 1/(angstrom)*)
sol = NDSolve[{D[Phi[r, Theta, t], {t, 1}] == 
Dif (D[Phi[r, Theta, t], {r, 2}] + 
   1/r^2 D[Phi[r, Theta, t], {Theta, 2}] + (2/r - 
      rc/r^2 + Const Cos[Theta]) D[Phi[r, Theta, 
      t], {r, 1}] + (1/r^2 Cos[Theta]/Sin[Theta] - 
      Const/r Sin[Theta]) D[Phi[r, Theta, 
      t], {Theta, 1}]), Phi[r, Theta, 0] == 
Fun3[r], Phi[rmax, Theta, t] == 
1, ( Derivative[1, 0, 0][Phi][s, Theta, 
  t]) == k/rc (Phi[s, Theta, t]), ( 
 D[Phi[r, Theta, t], {Theta, 1}] /. Theta -> 
   10^-3) == 
0, ( D[Phi[r, Theta, t], {Theta, 
    1}] /. Theta -> (\[Pi] - 10^-3)) == 
0}, Phi, {r, s, rmax}, {Theta, 
10^-3, \[Pi] - 10^-3}, {t, 0, tmax}, PrecisionGoal -> 4, 
StartingStepSize -> 0.0001, 
Method -> {"MethodOfLines", 
"SpatialDiscretization" -> {"TensorProductGrid", 
  "MinPoints" -> 100, "MaxPoints" -> 200}}]

(*BCtest1*)Plot3D[
 First[(Phi[rmax, Theta, t] - 1) /. sol], {Theta, 
 10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
(*BCtest2-1*)Plot3D[
 First[((( D[Phi[r, Theta, t], {r, 1}]) - k/
    rc Phi[r, Theta, t]) /. sol) /. 
 r -> s], {Theta, 10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
(*BCtest2-1-1*)Plot3D[
 First[((( D[Phi[r, Theta, t], {r, 1}])) /. sol) /. 
 r -> s], {Theta, 10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
(*BCtest2-1-1-1*)Plot3D[
 First[((( D[Phi[r, Theta, t], {r, 1}])) /. 
 r -> s) /. sol], {Theta, 10^-3, \[Pi] - 10^-3}, {t, 0, 
 tmax}]
(*BCtest2-2*)Plot3D[
 First[((( D[Phi[r, Theta, t], {r, 1}]) - k/
     rc Phi[r, Theta, t]) /. sol) /. 
 r -> s] + k/rc, {Theta, 
 10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
(*BCtest2-3*)Plot3D[
 First[((( D[Phi[r, Theta, t], {r, 1}]) - k/
    rc (Phi[r, Theta, t] - 1)) /. sol) /. 
 r -> s], {Theta, 10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
(*BCtest3*)Plot3D[
 First[( D[Phi[r, Theta, t], {Theta, 1}] /. Theta -> 
  10^-3) /. sol], {r, s, rmax}, {t, 0, tmax}]
(*BCtest4*)Plot3D[
 First[( D[Phi[r, Theta, t], {Theta, 
   1}] /. Theta -> (\[Pi] - 10^-3)) /. sol], {r, s, 
 rmax}, {t, 0, tmax}]

Phin = First[Phi /. sol]
Plot3D[Phin[s, Theta, t], {Theta, 
10^-3, \[Pi] - 10^-3}, {t, 0, tmax}]
Plot3D[Phin[r, 10^-3, t], {r, s, rmax}, {t, 0, tmax}]

```

If solution is well investigated, boundary conditions should have consistency so that the boudary condition test gives the value nearly zero (*BCtest 1~4*) using Plot3D, but the second boundary condition 

```
( Derivative[1, 0, 0][Phi][s, Theta, t]) == k/rc (Phi[s, Theta, t])

```

is not satisfied (That is, in boundary condition test (*BCtest2-1*) using Plot3D, (Derivative[1,0,0][Phi][s, Theta, t]- (k/rc) Phi[s, Theta, t]) should give nearly zero, but k/rc ), and is expected to have conflicts with initial condition

```
Phi[r, Theta, 0] == Fun1[r]

```

,

```
Phi[r, Theta, 0] == Fun2[r]

```

, or

```
Phi[r, Theta, 0] == Fun3[r]

```

Could I get a suggestion for adjust the initial condition to new one which doesn't deviate much from the original initial condition

```
Phi[r, Theta, 0] == 1

```

?

Or can I receive new insights to get over inconsistent IC and BC error message?

Thanks in advance!