How to solve this coupled linear equation with the 2D plot of the variation of parameter with constant with I.C: u(y,0)=c(y,0)=theta(y,0)=0, B.C: u(0,t)=1,c(0,t)=theta(0,t)=t.
1 Answers
Since this forum is for using Mathematica to solve problems, here is how you would solve these using NDSolve.
If you want code using finite difference, I suggest the forum https://scicomp.stackexchange.com/ instead.
I fixed few things. First your BC and IC is not consistent, You say u(y,0)=0 but then say u(0,t)=1. So I changed u(0,t)=0.
You also do not have enough spatial B.C. You have derivatives w.r.t. y twice, but only provided one BC. So I added more BC's to make NDSolve happy. You can change these as needed.
You also did not provide numerical values for Gr,Gm,RmPr,Sc do I added dummy values for these. You can change them to the actual values.
ClearAll[u, y, t, c, θ, Gr, Gm, R, Pr, Sc]
pde1 = D[u[y, t], t] == Gr* θ[y, t] + Gm*c[y, t] + D[u[y, t], {y, 2}]
pde2 = D[θ[y, t], t] == 1/Pr*D[ θ[y, t], {y, 2}] - R/Pr*θ[y, t];
pde3 = D[c[y, t], t] == 1/Sc*D[c[y, t], {y, 2}]
ic = {u[y, 0] == 0, θ[y, 0] == 0, c[y, 0] == 0}
bc = {u[0, t] == 0, θ[0, t] == t, c[0, t] == t,
(D[u[y, t], y] /. y -> 0) == 0, (D[θ[y, t], y] /. y -> 0) == 0,
(D[c[y, t], y] /. y -> 0) == 0};
parm = {Gr -> 1, Gm -> 2, R -> 3, Pr -> 4, Sc -> 5};
NDSolve[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ, c}, {t, 0, 2}, {y, 0, 1}];

Update to make plot
You can make plots as follows
{usol, θsol, Csol} =
NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ,
c}, {t, 0, 2}, {y, 0, 1}]
Plot3D[usol[t, y], {t, 0, 2}, {y, 0, 1}, PlotLabel -> "u solution",
AxesLabel -> {"time", "y", "u(t,y)"}, BaseStyle -> 14]

Plot3D[θsol[t, y], {t, 0, 2}, {y, 0, 1},
PlotLabel -> "θ solution",
AxesLabel -> {"time", "y", "θ(t,y)"}, BaseStyle -> 14]

and so on. To plot one solution against the other, you could look into ParametricPlot and ParametricPlot3D. I am not sure what you want to plot, but there are examples how to use these commands in help.
Update to plot with varying time
like when varying t other parameters are constant.
You could use Manipulate for this. Here is an example for u(y,t) which you can the code for the other solutions. To play with varying the other parameters, you just make a slider for each one and then solve again whenever any parameter changes.
Manipulate[
Grid[{
{Row[{"Time = ", t0, " seconds"}]},
{Plot[usol[y, t0], {y, 0, 1},
AxesLabel -> {"y", "u(t,y)"}, BaseStyle -> 12,
ImageSize -> 300, PlotRange -> {Automatic, {-.1, .3}},
PlotStyle -> Red, GridLines -> Automatic,
GridLinesStyle -> LightGray]
}}],
{{t0, 0, "time"}, 0, 2, .01, Appearance -> "Labeled"},
TrackedSymbols :> {t0}
]
how I get 3 different line accordance to this 3 change value in R
You can make new Manipulate variable for R and solve new each time this is clicked. Like this
Make similar variable for the other variables. Here is the new code
Manipulate[
Module[{u, y, t, c, θ, Gr, Gm, Pr, Sc, pde1, pde2, pde3},
pde1 =
D[u[y, t], t] ==
Gr*θ[y, t] + Gm*c[y, t] + D[u[y, t], {y, 2}];
pde2 =
D[θ[y, t], t] ==
1/Pr*D[θ[y, t], {y, 2}] - R/Pr*θ[y, t];
pde3 = D[c[y, t], t] == 1/Sc*D[c[y, t], {y, 2}];
ic = {u[y, 0] == 0, θ[y, 0] == 0, c[y, 0] == 0};
bc = {u[0, t] == 0, θ[0, t] == t,
c[0, t] == t, (D[u[y, t], y] /. y -> 0) ==
0, (D[θ[y, t], y] /. y -> 0) ==
0, (D[c[y, t], y] /. y -> 0) == 0};
parm = {Gr -> 1, Gm -> 2, Pr -> 4, Sc -> 5};
{usol, θsol, Csol} =
NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ,
c}, {y, 0, 1}, {t, 0, 2}];
Grid[{
{Row[{"Time = ", t0, " seconds"}]},
{Row[{"R = ", R}]},
{Plot[usol[y, t0], {y, 0, 1}, AxesLabel -> {"y", "u(t,y)"},
BaseStyle -> 12, ImageSize -> 300,
PlotRange -> {Automatic, {-.1, .3}}, PlotStyle -> Red,
GridLines -> Automatic, GridLinesStyle -> LightGray]
}}]
],
{{t0, 0, "time"}, 0, 2, .01, Appearance -> "Labeled"},
{R, {3, 2, 9}},
TrackedSymbols :> {t0, R}
]
How to manipulate simulationsly all three plots for R .
One way is to make 3 plots and then use show. This could be improved but gives you the idea
Updated code
Manipulate[
Module[{u, y, t, c, θ, Gr, Gm, Pr, Sc, pde1, pde2, pde3, R,
parm},
pde1 = D[u[y, t], t] == Gr*θ[y, t] + Gm*c[y, t] + D[u[y, t], {y, 2}];
pde2 = D[θ[y, t], t] == 1/Pr*D[θ[y, t], {y, 2}] - R/Pr*θ[y, t];
pde3 = D[c[y, t], t] == 1/Sc*D[c[y, t], {y, 2}];
ic = {u[y, 0] == 0, θ[y, 0] == 0, c[y, 0] == 0};
bc = {u[0, t] == 0, θ[0, t] == t,
c[0, t] == t, (D[u[y, t], y] /. y -> 0) ==
0, (D[θ[y, t], y] /. y -> 0) ==
0, (D[c[y, t], y] /. y -> 0) == 0};
parm = {Gr -> 1, Gm -> 2, R -> 3, Pr -> 4, Sc -> 5};
{usol1, θsol1, Csol1} = NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ, c}, {y, 0, 1}, {t, 0, 2}];
parm = {Gr -> 1, Gm -> 2, R -> 30, Pr -> 4, Sc -> 5};
{usol2, θsol2, Csol2} = NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ, c}, {y, 0, 1}, {t, 0, 2}];
parm = {Gr -> 1, Gm -> 2, R -> 200, Pr -> 4, Sc -> 5};
{usol3, θsol3, Csol3} = NDSolveValue[{pde1, pde2, pde3, ic, bc} /. parm, {u, θ, c}, {y, 0, 1}, {t, 0, 2}];
Grid[{
{Row[{"Time = ", t0, " seconds"}]},
{Plot[{usol1[y, t0], usol2[y, t0], usol3[y, t0]}, {y, 0, 1},
AxesLabel -> {"y", "u(t,y)"}, BaseStyle -> 12, ImageSize -> 300,
PlotRange -> {Automatic, {-.1, .3}},
PlotStyle -> {Red, Blue, Green}, GridLines -> Automatic,
GridLinesStyle -> LightGray,
PlotLegends -> {"R=3", "R=30", "R=200"}]
}}]
],
{{t0, 0, "time"}, 0, 2, .01, Appearance -> "Labeled"},
TrackedSymbols :> {t0}
]
- 143,286
- 11
- 154
- 359
-
Thank you so much, up to that I'm clear. But one thing I ask is a 2D plot with various parameter values. Gm has multiple values while others are the constant mean same value. – FDMEM Oct 27 '22 at 04:05
-
Plot[Evaluate[{u[y, t]}, {\[Theta][y, t]}, {c[y, t]} /. sol], {t, 0, 1}, {y, 0, 1}, PlotStyle -> Automatic]. In this plot, I get t an error likePlot::nonopt: Options expected (instead of {y,0,1}) beyond position 2 in Plot[{u[y,t]},{\[Theta][y,t]},{{InterpolatingFunction[{{0.,1.},{0.,2.}},{5,5,1,{25,64},{6,4},0,0,0,0,Automatic,<<3>>},{{0.,<<9>>,<<15>>},{0.,<<9>>,<<54>>}},{DeveloperPackedArrayForm,{0,3,6,9,12,15,18,21,24,27,0072*10^15,1.,0.000033917,<<4790>>}},{Automatic,Automatic}][y,t]}},<<1>>,{y,0,1},PlotStyle->Automatic]. An option must be a rule or a list of rules.` – FDMEM Oct 27 '22 at 04:30 -
-
Thank you for the 3D one, sir, I want a 2D plot (u vs y),(c vs y).... just varying the parameter. please help me to plot the solution in 2D such that if I take 3 different value of Sc how the 3 profile effect u profile etc . – FDMEM Oct 27 '22 at 05:57
-
@AshirbadRath I am not sure I understand. Let concentrate on one for now. You want to plot u vs. y? For what time t? since u depends on time also. Or do you meant you want to vary t? What parameter is it you want to vary? is it time? – Nasser Oct 27 '22 at 06:04
-
Yes, I need multiple variations, like when varying t other parameters are constant. suppose I need a plot where Pr varies keeping others constant. – FDMEM Oct 27 '22 at 06:16
-
-
Thank you sir for this manipulation of the plot. Still, I can't get an idea of what I am asking. Considering the value of [ Gr, Gm, R, Pr, Sc]=[1,2,3,4,5],[ Gr, Gm, R, Pr, Sc]=[1,2,0.2,4,5],[ Gr, Gm, R, Pr, Sc]=[1,2,9,4,5], here I just varies R-value, how I get 3 different line accordance to this 3 change value in R. – FDMEM Oct 27 '22 at 06:47
-
@AshirbadRath updated to make R control variable. You could do the same for the other variables. – Nasser Oct 27 '22 at 07:15
-
I'm sorry for that many questions, but one last question sir, How to manipulate simulationsly all three plots for R . Like shown in a single figure for R=1 this line R=2 this line and R=3 this line....like this. – FDMEM Oct 27 '22 at 07:46
-
-
-
For the same manipulation Code if we use u (0, t) =1, Why do inconsistent errors occur in boundary conditions? – FDMEM Nov 10 '22 at 07:25
-
if we use u (0, t) =1, Why do inconsistent errors occur in boundary conditions? because you have $u(y,0)=0$, then you if you say $u(0,t)=1$, this is inconsistent with the first one. What happens if you replace $t=0$ in the second one? (since it is valid for $t=0$ also. You get $u(0,0)=1$ but the first BC, when $y=0$ now gives $u(0,0)=0$. Hence $0=1$ which is not allowed. That is why NDSolve gives warnings. Normally these warnings are not too serious for numerical solver, (sometimes you can get away with it) but if you can correct them so all BC are consistent, it will be better. – Nasser Nov 10 '22 at 07:38
-
Thank you @Naaser. Shell we use the same method for Nonlinear PDEs also? – FDMEM Nov 11 '22 at 15:27
-
@FDMEM for numerical solving, yes. it does not matter for NDSolve if your pde is linear or not. – Nasser Nov 11 '22 at 15:30
-
Hey, @Naaser how do I get a single plot with 3 different times? I mean the plot of the solution, in the previous code we manipulate with increasing time different values of parameters in a single plot. But how do I plot a single solution at a different time in a single plot? – FDMEM Feb 18 '23 at 10:10
-
@FDMEM one way is to call NDSolveValue for the 3 different time ranges you want, then plot each solution and use
Showcommand to put these 3 plots in same plot. – Nasser Feb 18 '23 at 14:42 -
May I know the code format? Actually, I already tried for
Showbut it can't give the accurate output. – FDMEM Feb 19 '23 at 16:50 -
@FDMEM I am sorry, but very busy with other things. But feel free to post new question on this and make sure to indicate what you want to do and plot, I am sure others will be able to help. – Nasser Feb 19 '23 at 17:20
-
-
Actually, I have conveyed to you what I want, so I'm comfortable asking you about my minor doubts; So please help me when you are free. I would be happy if you keep my request. – FDMEM Feb 20 '23 at 05:36




Gr,Gm,R,Pr,Schave? – Nasser Oct 26 '22 at 20:36