0
$\begingroup$

I have this system of PDE below. But upon running the code I get an error:

R = 3.95;
gamma1 = 0.2667;
gamma2 = 0.35;

This is the system of equations, initial conditions, and boundary conditions:

eqns = {Derivative[0, 1][mT][phi, t] == Derivative[2, 0][mT][phi, t],
   Derivative[0, 1][mB][phi, t] == 
    gamma1*mT[phi, t]*cB[r, phi, t] - gamma2*mB[phi, t] + 
     Derivative[2, 0][mB][phi, t],
   Derivative[0, 0, 1][cB][r, phi, t] == 
    Derivative[2, 0, 0][cB][r, phi, t] + 
     1./r^2*Derivative[0, 2, 0][cB][r, phi, t],
 (*initial condition*)
   mT[phi, 0] == 0.001, mB[phi, 0] == 0, cB[r, phi, 0] == 0.005,

 (*boundary condition*)
   Derivative[1, 0, 0][cB][R, phi, 
     t] == -gamma1*mT[phi, t]*cB[R, phi, t] + gamma2*mB[phi, t]
   };

I try to solve it:

usol = NDSolveValue[
  eqns, {mT, mB, cB}, {r, 0, R}, {theta, 0, Pi}, {phi, 0, 2*Pi}, {t, 
   0, 1}]

However, I get this error:

NDSolveValue::derlen: The length of the derivative operator Derivative[0,1] in (mT^(0,1))[phi,t] is not the same as the number of arguments.

I think the problem is that in the boundary condition I try to make a derivative at R = 3.95, which I already pass it as an argument. How can I pass the boundary condition in a proper way?

$\endgroup$
2
  • $\begingroup$ The number of arguments should be 3 for all functions in your pde-system!?! $\endgroup$ Commented Feb 15, 2019 at 17:32
  • $\begingroup$ All functions should depend on [r,phi,t]. It is necessary to exclude theta from NDSolve. What is expected to receive? Boundary conditions must be formulated at least at r=R. The initial data is the solution. Need to change for mb[r,phi,0]. $\endgroup$ Commented Feb 15, 2019 at 19:07

1 Answer 1

1
$\begingroup$

This is just debugged code in which I changed the initial data for mB[r,phi,0]:

R = 3.95;
gamma1 = 0.2667;
gamma2 = 0.35; r0 = 10^-5;
eqns = {Derivative[0, 0, 1][mT][r, phi, t] == 
    Derivative[0, 2, 0][mT][r, phi, t], 
   Derivative[0, 0, 1][mB][r, phi, t] == 
    gamma1*mT[r, phi, t]*cB[r, phi, t] - gamma2*mB[r, phi, t] + 
     Derivative[0, 2, 0][mB][r, phi, t], 
   Derivative[0, 0, 1][cB][r, phi, t] == 
    Derivative[2, 0, 0][cB][r, phi, t] + 
     1./r^2*Derivative[0, 2, 0][cB][r, phi, t]};
(*initial condition*)
ic = {mT[r, phi, 0] == 0.001, mB[r, phi, 0] == 0.001, 
   cB[r, phi, 0] == 0.005};
(*boundary condition*)
bc = {mT[r0, phi, t] == .001, mT[R, phi, t] == .001, 
   mT[r, 0, t] == .001, mT[r, 2*Pi, t] == .001, 
   mB[r0, phi, t] == .001, mB[R, phi, t] == .001, mB[r, 0, t] == .001,
    mB[r, 2*Pi, t] == .001, cB[r0, phi, t] == .005, 
   cB[r, 0, t] == .005, cB[r, 2*Pi, t] == .005, 
   Derivative[1, 0, 0][cB][R, phi, 
     t] == -gamma1*mT[R, phi, t]*cB[R, phi, t] + 
     gamma2*mB[R, phi, t]*(1 - Exp[-100*t])};
usol = NDSolve[{eqns, bc, ic}, {mT, mB, cB}, {r, r0, R}, {phi, 0, 
   2*Pi}, {t, 0, 1}]

{Table[Plot3D[
   Evaluate[mT[r, phi, t] /. First[usol]], {r, r0, R}, {phi, 0, 2*Pi},
    PlotLabel -> Row[{"t = ", t}], Mesh -> None, ColorFunction -> Hue,
    AxesLabel -> {"r", "phi", "mT"}], {t, .25, 1, .25}], 
 Table[Plot3D[
   Evaluate[mB[r, phi, t] /. First[usol]], {r, r0, R}, {phi, 0, 2*Pi},
    PlotLabel -> Row[{"t = ", t}], Mesh -> None, ColorFunction -> Hue,
    AxesLabel -> {"r", "phi", "mB"}], {t, .25, 1, .25}], 
 Table[Plot3D[
   Evaluate[cB[r, phi, t] /. First[usol]], {r, r0, R}, {phi, 0, 2*Pi},
    PlotLabel -> Row[{"t = ", t}], PlotRange -> All, Mesh -> None, 
   ColorFunction -> Hue, AxesLabel -> {"r", "phi", "cB"}], {t, .25, 
   1, .25}]}

fig1

$\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.