happy holidays, I am solving a coupled ODE - PDE system -for simplicity all coefficients are taken as 1-. I checked other questions on the issue but couldn't find any suitable answer or comparison. The model

$$ \frac{\partial \text{x1}(t,x)}{\partial t}=\frac{\partial ^2\text{x1}(t,x)}{\partial x\, \partial x}+\text{x1}(t,x) \text{x2}(t,x) \text{x3}(t,x)-\text{x1}(t,x)+1,\\ \frac{\partial \text{x2}(t,x)}{\partial t}=\frac{\partial ^2\text{x2}(t,x)}{\partial x\, \partial x}-\text{x2}(t,x),\\ \frac{\partial \text{x3}(t,x)}{\partial t}=1-\text{x1}(t,x)^2-\text{x3}(t,x) $$ The code

solveme = NDSolve[{
    D[x1[t, x], t] == 
     D[x1[t, x], x, x] + x1[t, x] x2[t, x] x3[t, x] - x1[t, x] + 1,
    D[x2[t, x], t] == D[x2[t, x], x, x] - x2[t, x],
    D[x3[t, x], t] == (1 - x1[t, x]^2) - x3[t, x],
    x1[0, x] == If[-20 < x < 20, 30, 0],
    x1[t, -200] == 0,
    x1[t, 200] == 0,
    x2[0, x] == If[-20 < x < 20, 2, 0],
    x2[t, -200] == 0,
    x2[t, 200] == 0,
    x3[0, x] == 1
   {x1, x2, x3}, {t, 0, 200}, {x, -200, 200}];

 Evaluate[{x1[t, x]} /. solveme], {t, 0, 200}, {x, -200, 200}, 
 ColorFunction -> "Rainbow", PlotLegends -> Automatic, 
 Method -> {"MethodOfLines", 
   "SpatialDiscretization" -> {"TensorProductGrid", 
     "MaxPoints" -> 101}}, PlotPoints -> 100]

Question Can NDSolve be used for this problem, or do you know\suggest any other approach for coupled PDE - ODE systems?

  • 1
    $\begingroup$ Your NDSolve runs without complaint. What's the problem? (BTW, your DensityPlot code has got the wrong options, but it seems irrelevant since you're not asking only about NDSolve.) $\endgroup$
    – Michael E2
    Dec 27, 2020 at 17:41
  • $\begingroup$ @MichaelE2 thanks for the comment. I was wondering whether having an ODE-PDE coupled system NDSolve is the correct way to solve it or not. Would you mind telling me which options are wrong? $\endgroup$
    – confused
    Dec 28, 2020 at 8:20
  • $\begingroup$ The Method option is appropriate for NDSolve but not for DensityPlot. Are you thinking the last equation is an ODE? The function $x1$ and therefore $x3$ depend on both $t$ and $x$, so it's not an ODE of the form $du/dt = F(t,u)$. The other equations are clearly PDEs. $\endgroup$
    – Michael E2
    Dec 28, 2020 at 14:21
  • $\begingroup$ @MichaelE2 Yes you are right, let's call it "pseudo-ODE approach" for $x3(x,t)$. If I wish to keep it as an ODE (lets call this "ODE approach") then $dx1(x,t)/dt$ needs $x3(t)$ as $f(x)*x3(t)$ and $dx3(t)/dt$ and $x1(x,t)$ as $\int_{domain} x1(x,t) dx$. How one can choose between these approaches? $\endgroup$
    – confused
    Dec 28, 2020 at 19:02
  • 1
    $\begingroup$ (1) I'm pretty sure NDSolve won't handle dependent variables with different arguments. So if you have x1[t, x], then it must be x3[t, x] and not just x3[t]. (This came up before on this site, and I couldn't figure out a way around it.) (2) If, for example, you have D[x3[t, x], t] == 1 - t^2 - x3[t, x], then NDSolve will construct x3 by integrating the ODE $du/dt = 1 - t^2 - u^2$ for every value of $x$ in the spatial grid. Everything should be ok, despite the extra work. (I'm not sure I understood your last comment, so I'm taking two shots at it, in hopes that they help.) $\endgroup$
    – Michael E2
    Dec 28, 2020 at 19:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.