Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window[x_] := (Cos[Pi x] + 1)/2;
- n = 3;
- ps = {0.6, -0.3, 0.1};
- as = {0.1, 0.5, 0.8};
- initu[x_] := Sum[2 as[[i]] Exp[-20 (x - ps[[i]])^2], {i, n}];
- Tmax = 80;
- \[Tau] = 0.1; du2 = 0.00028; dv2 = 0.005; \[Kappa] = -0.005;
- soln = NDSolve[{
- D[u[x, t], t] ==
- du2 D[u[x, t], {x, 2}] + u[x, t] - u[x, t]^3 -
- v[x, t] - \[Kappa],
- \[Tau] D[v[x, t], t] ==
- dv2 D[v[x, t], {x, 2}] + u[x, t] - v[x, t],
- u[x, 0] == 0.5 window[x] x,
- v[x, 0] == 0.1 window[x],
- Derivative[1, 0][u][-1, t] == 0,
- Derivative[1, 0][u][1, t] == 0,
- Derivative[1, 0][v][-1, t] == 0,
- Derivative[1, 0][v][1, t] == 0
- }, {u, v}, {x, -1, 1}, {t, 0, Tmax}];
- frame[tt_] := Show[
- ArrayPlot[{
- Table[
- Tanh[
- 3 Max[0, (First[(u[x, t] - v[x, t]) /. soln] /. {x -> xx,
- t -> tt})]]^2,
- {xx, -1, 1, 2/100}]}
- , AspectRatio -> 1, ColorFunction -> "DeepSeaColors",
- Frame -> False]
- ,
- Plot[
- Max[0, (1 + First[(u[x, t] /. soln)] /. {x -> (xx - 50)/50,
- t -> tt})/2]
- , {xx, 0, 101}, PlotRange -> {-1, 1},
- PlotStyle -> Directive[Thick, Red], Axes -> None],
- Plot[
- Max[0, (1 + First[(v[x, t] /. soln)] /. {x -> (xx - 50)/50,
- t -> tt})/2]
- , {xx, 0, 101}, PlotRange -> {-1, 1},
- PlotStyle -> Directive[Thick, Yellow]],
- ImageSize -> 300];
- Manipulate[
- frame[Exp[tt] - 0.99],
- {tt, 0, 3.5}
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement