Mathematica Asked by crises on March 12, 2021
I need to solve a system of three coupled PDEs. I used this code but it seems that the solution for the third function (B2(x,t)) results in small fluctuations at the beginning of the numerical solution, which due to system are magnified. Is there a way to eliminate them?
X = 30; T = 10;
p[x_, t_] = 1
v = 1;
d = 5;
eq1 = D[U[x, t], t] ==
d *D[U[x, t], x, x] -
p[x, t]* U[x, t] *(1 - B2[x, t]) + (B2[x, t])* (1 - U[x, t]);
eq2 = v *D[B1[x, t], x] + D[B1[x, t], t] ==
0.8 *p[x, t] *U[x, t] (1 - B1[x, t]) - 0.8* B1[x, t] *(1 - U[x, t]);
eq3 = -v*D[B2[x, t], x] + D[B2[x, t], t] ==
0.2 *p[x, t] *U[x, t] (1 - B2[x, t]) - 0.2 *B2[x, t] *(1 - U[x, t])
C1 = {U[x, 0] == 0.75, U[0, t] == 0.75, U[X, t] == 0.75,
(*B1[0,t][Equal]0.75,B1[x,0][Equal]0.75+Exp[-(x-15)^2],B1[X,
t][Equal]0.75,*)
B2[0, t] == 0.75, B2[X, t] == 0.75,
B2[x, 0] == 0.75};
sol = NDSolve[{eq1, eq3, C1}, {U[x, t], B2[x, t]}, {x, 0, X}, {t, 0,
T}, AccuracyGoal -> 8, PrecisionGoal -> 15, MaxStepSize -> 0.05];
r[y_, q_] := sol[[1, 1, 2]] /. {x -> y, t -> q}
s1[y_, q_] := sol[[1, 2, 2]] /. {x -> y, t -> q}
s2[y_, q_] := sol[[1, 3, 2]] /. {x -> y, t -> q}
plist = Table[
Plot[r[y, q], {y, 0, X}, PlotRange -> {0, 2}], {q, 0, T, T/10}];
plist2 = Table[
Plot[{s1[y, q], s2[y, q]}, {y, 0, X}, PlotRange -> {0, 2}], {q, 0,
T, T/10}];
ListAnimate[plist]
ListAnimate[plist2]
Have I done something wrong?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP