1
$\begingroup$

I tried to solve this coupled PDE with NDsolve and use manipulation code for manipulating the obtained plot, but I get an error like order inconsistency. Here I take the Initial and boundary condition as when t>0 u=1, Theta=1, C=t. And I want to plot various curves with different values of parameters in a single curve.

 Module[{u, y, t, c, \[Theta], Gr, Gm, \[Alpha], M, K, Pr, Sc, Kc, 
   pde1, pde2, pde3, parm},
  pde1 = D[u[t, y], t] == 
    D[u[t, y], y, 
       y] (\[Alpha]*(D[u[t, y], y, y, t])) + (Gr*\[Theta][t, 
        y]) + (Gm*c[t, y]) - ((M + (1/K))*u[t, y]);
  pde2 = D[\[Theta][t, y], t] == ((1/Pr)*D[\[Theta][t, y], y, y]);
  pde3 = D[c[t, y], t] == ((1/Sc)*D[c[t, y], y, y]) - (Kc*c[t, y]);
  ic = {u[y, 0] == 0, \[Theta][y, 0] == 0, c[y, 0] == 0};
  bc = {u[0, t] == 1, \[Theta][0, t] == 1, 
    c[0, t] == t, (D[u[y, t], y, y] /. y -> 0) == 
     0, (D[u[y, t], y] /. y -> 0) == 
     0, (D[\[Theta][y, t], y] /. y -> 0) == 
     0, (D[c[y, t], y] /. y -> 0) == 0};
  parm = {Gr -> 10, Gm -> 5, \[Alpha] -> 1, M -> 1, K -> 3, Pr -> 5, 
    Sc -> 2.02, Kc -> 2};
  {usol1, \[Theta]sol1, Csol1} = 
   NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, \[Theta], 
     c}, {y, 0, 10}, {t, 0, 20}];
  parm = {Gr -> 10, Gm -> 5, \[Alpha] -> 3, M -> 1, K -> 3, Pr -> 5, 
    Sc -> 2.02, Kc -> 2};
  {usol2, \[Theta]sol2, Csol2} = 
   NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, \[Theta], 
     c}, {y, 0, 10}, {t, 0, 20}];
  parm = {Gr -> 10, Gm -> 5, \[Alpha] -> 5, M -> 1, K -> 3, Pr -> 5, 
    Sc -> 2.02, Kc -> 2};
  {usol3, \[Theta]sol3, Csol3} = 
   NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, \[Theta], 
     c}, {y, 0, 10}, {t, 0, 20}];
  Grid[{{Row[{"Time = ", t0, " seconds"}]}, {Plot[{usol1[y, t0], 
       usol2[y, t0], usol3[y, t0]}, {y, 0, 5}, 
      AxesLabel -> {"y", "U"}, BaseStyle -> 12, ImageSize -> 300, 
      PlotRange -> {Automatic, {-0.1, 2}}, 
      PlotStyle -> {Red, Blue, Green}, GridLines -> Automatic, 
      GridLinesStyle -> LightGray, 
      PlotLegends -> 
       Placed[LineLegend[
         Automatic, {"\[Alpha]=1", "\[Alpha]=3", 
          "\[Alpha]=5"}], {.84, .62}]]}}]], {{t0, 0, "time"}, 0, 
  5, .01, Appearance -> "Labeled"}, TrackedSymbols :> {t0}]```


$\endgroup$
1
  • 1
    $\begingroup$ In e.g. pde1 you wrote u[t, y] but in ic you wrote u[y, 0], the order is obviouly inconsistent. $\endgroup$
    – xzczd
    Jan 20, 2023 at 5:38

1 Answer 1

5
$\begingroup$

You have lots of basic errors. Order of arguments is wrong. Your ode has [t,y] but in your bc you reversed these. NDSolve actually complained about this.

Also you have bc D[u[t, y], y, y] /. y -> 0) == 0 but this is same order as in the pde. It should be one order less, so I removed this from your bc. (NDSolve also complains about this). May be you meant to put something else there. May be you did not see these errors because everything was in one big module.

Fixing all these, I get Warning: boundary and initial conditions are inconsistent which is something you need to work on as you know your system better.

it will be better to provide a minimal example. No need for all the extra code you have with plots and all that. The issue is getting NDSolve first to work.

When you throw lots of code in and an error shows up, it will be hard to know the cause of the error. You need to do it step by step first, before putting everything together. This is basic debugging that is needed in Mathematica.

ClearAll["Global`*"]
pde1 = D[u[t, y], t] == D[u[t, y], y, y] (α*(D[u[t, y], y, y, t])) + (Gr*θ[t, y]) + (Gm*
     c[t, y]) - ((M + (1/K))*u[t, y])
pde2 = D[θ[t, y], t] == ((1/Pr)*D[θ[t, y], y, y])
pde3 = D[c[t, y], t] == ((1/Sc)*D[c[t, y], y, y]) - (Kc*c[t, y])

ic={u[0,y]==0,θ[0,y]==0,c[0,y]==0};
(*bc={u[t,0]==1,θ[t,0]==1,c[t,0]==t,(D[u[t,y],y,y]/. y->0)==0,(D[u[t,y],y]/. y->0)==0,(D[θ[t,y],y]/. y->0)==0,(D[c[t,y],y]/. y->0)==0}*)
bc={u[t,0]==1,θ[t,0]==1,c[t,0]==t,(D[u[t,y],y]/. y->0)==0,(D[θ[t,y],y]/. y->0)==0,(D[c[t,y],y]/. y->0)==0}
parm={Gr->10,Gm->5,α->1,M->1,K->3,Pr->5,Sc->2.02,Kc->2}

parm = {Gr -> 10, Gm -> 5, α -> 3, M -> 1, K -> 3, Pr -> 5, 
   Sc -> 2.02, Kc -> 2};
sys = {pde1, pde2, pde3, ic, bc} /. parm

Mathematica graphics

And only now

 NDSolveValue[sys, {u, θ, c}, {t, 0, 20}, {y, 0, 10}]

Mathematica graphics

Update

bc = {u[t, 0] == Sin[t], θ[t, 0] == 1, c[t, 0] == t,    
       u[t, 1000] == 0, θ[t, 1000] == 0, c[t, 1000] == 0} 

after taking this BC I get output with boundary condition inconsistent. Is there any fault in BC or any other reason. –

This is because you have initial conditions

ic = {u[0, y] == 0, θ[0, y] == 0, c[0, y] == 0};

lets look at θ function only for now.

One of the Boundary condition says θ[t, 0] == 1 but this is valid for any $t$ So this BC says that for any time, including $t=0$, when $y=0$ then θ is 1. i.e. θ[0, 0] == 1

Now look the initial condition above which says θ[0, y] == 0. This says at $t=0$ and for any y. Then for $y=0$ the initial condition says that θ[0, 0] == 0

This is conflict. θ[0, 0] can not be both one and zero.

Normally these warnings are harmless (they are encountered when the numerical method initiates and starts marching and depends on the internal method used how much error this can cause if any).

But it it better of course to avoid them in first place.

$\endgroup$
3
  • $\begingroup$ bc = {u[t, 0] == Sin[t], \[Theta][t, 0] == 1, c[t, 0] == t, u[t, 1000] == 0, \[Theta][t, 1000] == 0, c[t, 1000] == 0} after taking this BC I get output with boundary condition inconsistent. Is there any fault in BC or any other reason. $\endgroup$
    – FDMEM
    Jan 23, 2023 at 5:52
  • $\begingroup$ @FDMEM update answer to reply to your comment. $\endgroup$
    – Nasser
    Jan 23, 2023 at 6:21
  • $\begingroup$ Thank you so much . $\endgroup$
    – FDMEM
    Jan 23, 2023 at 6:45

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