2
$\begingroup$

I'm new to the mathematica and just try to solve an seemingly simply non-lineal coupled PDEs. It is about the diffusion-reaction kinetics in a pellet.The code seems workable, but keep running without result. I had to manually abort the evaluation. Can anyone help on the problem? The code with some simplification is given as:

ClearAll["Global`*"];

del = 10^(-8);
{casol, gsol} = 
  NDSolveValue[   {  
    D[r^2*D[ca[r, t], r], r]/r^2 - 
      (2344.2833*0.0121212*(g2[r, t])^2*ca[r, t])/
      (0.0121212 + 
       g2[r, t]*(1 - g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))) == 
     D[ca[r, t], t],

    D[g2[r, t], t] == (0.0121212*ca[r, t])/
     (0.0121212 + g2[r, t]*(1 - g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))),

    ca[r, 0.] == 0.0,  
    ca[1.0, t] == 1.0 - Exp[-1000*t], (D[ca[r, t], r] /. r -> del) == 
     0, g2[r, 0.0] == 1.0  },

    {ca, g2}, {r, del, 1}, {t, 0, 1} ,

   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       MinPoints -> 200}} 
   ];

Thanks for your comments and it helps to find the problems.I modified the code a little bit and feel a little bit confused about the mathematics nature of the problem. Basically, my problem has two functions, ca(r,t) and g2(r,t). The equation (1) for ca is only differential to r, while equation(2) for g2 is only differential to t, while ca and g2 are inter-correlated. I'm not sure from mathematical point view, this problem is treated as ODE and DAE problem. The code can run now but the answer is not right, which give ca(r,t)=0 and g2(r,t)=1 for any r and t. The problem has been solved by analytical methods. Can you put some hints on this again?

ClearAll["Global`*"];
del = 10^(-8);
Monitor[{casol, gsol} = 
  NDSolveValue[{D[r^2*D[ca[r, t], r], r]/r^2 == 
  (2344.2833*0.0121212*(g2[r, t])^2*ca[r, t])/(0.0121212 + 
         g2[r, t]*(1 - g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))) , 
    D[g2[r, t],  t] == (0.0121212*ca[r, t])/(0.0121212 + 
        g2[r, t]*(1 - g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))), 
    ca[r, 0.] == 0.0, 
    ca[1.0, t] == 1.0 - Exp[-1000*t], 
    (D[ca[r, t], r] /. r -> del) == 0, g2[r, 0.0] == 1.0}, 
    {ca, g2}, {r, del, 1}, {t, 0, 1}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", MinPoints -> 200}}, 
   EvaluationMonitor :> (monitor = Row[{"t = ", CForm[t]}])], monitor]
$\endgroup$
5
$\begingroup$

You can use a Monitor to follow the time integration:

ClearAll["Global`*"];
del = 10^(-8);
Monitor[{casol, gsol} = 
  NDSolveValue[{D[r^2*D[ca[r, t], r], r]/
       r^2 - (2344.2833*0.0121212*(g2[r, t])^2*ca[r, t])/(0.0121212 + 
         g2[r, t]*(1 - 
            g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))) == 
     D[ca[r, t], t], 
    D[g2[r, t], 
      t] == (0.0121212*ca[r, t])/(0.0121212 + 
        g2[r, t]*(1 - 
           g2[r, t]/(3.08876 - 2.08876*(g2[r, t])^3)^(1/3))), 
    ca[r, 0.] == 0.0, 
    ca[1.0, t] == 1.0 - Exp[-1000*t], (D[ca[r, t], r] /. r -> del) == 
     0, g2[r, 0.0] == 1.0}, {ca, g2}, {r, del, 1}, {t, 0, 1}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       MinPoints -> 200}}, 
   EvaluationMonitor :> (monitor = Row[{"t = ", CForm[t]}])], monitor]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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