I don’t know what is wrong with my code. I am trying to create 2-D or 3-D curves to simulate something like the SIR model, but with tumor growth instead.

enter image description here

enter image description here

It is a proliferation-invasion/ reaction-diffusion model.

Clear[a, r, d, g];
Clear[DE1,DE2, DE3, c,m,v,t,CMVsys]; Grad
DE1=D[c[x,y,z,t], t]\[Equal]Div[(a*(1-v[x,y,z,t]))*Grad[(c[x,y,z,t]),        {x,y,z}],{x,y,z}]+r*c[x,y,z,t]*(1-c[x,y,z,t]);
DE2=D[m[x,y,z,t],t]==Laplacian[(m[x,y,z,t]),{x,y,z}]+d*(c[x,y,z,t]- m[x,y,z,t]);
Clear [solution, initial,cplot,mplot, vplot]; initial={c[x,y,z,0]==1,  m[x,y,z,0]==1, v[x,y,z,0]==1};
solution=Flatten[NDSolve[Join[CMVsys, initial], {c,m,v}, {t,0,800}]]
cplot=Plot[c[x,y,z,t]/.solution[[1]], {t,0,800}, PlotStyle-   >RGBColor[0,0,1], PlotRange-> {0,1}]
mplot=Plot[m[t]/.solution[[2]],{t,0,800}, PlotStyle->RGBColor[1,0,0]]
Show[cplot, mplot, vplot, AxesLabel->{"t", "c=blue, m=red, v=green"}]
  • 5
    $\begingroup$ Please edit your question to add your code from the images. Posting the code makes it easier for us to try it by copying and pasting it rather than typing it from scratch. $\endgroup$
    – creidhne
    Apr 25, 2021 at 2:40
  • $\begingroup$ I edited the code! $\endgroup$
    – user79647
    Apr 25, 2021 at 2:51
  • 1
    $\begingroup$ 1. There is a spurious Grad just before the definition of DE1; 2. don't you need to provide NDSolve with additional information regarding x, y, z ? $\endgroup$ Apr 25, 2021 at 7:52
  • 1
    $\begingroup$ You need to give boundary conditions. $\endgroup$ Apr 25, 2021 at 8:42


Your Answer

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

Browse other questions tagged or ask your own question.