0
$\begingroup$

I have a $4$-dimensional nonlinear system of second order PDEs with periodic boundary conditions. Let $y(t,x)=(y_1(t,x),...,y_4(t,x))$ with $t \in \mathbb{R}$ and $x \in [0,1]$ then the system is $$\partial_t y = M_1\partial_x y+M_2y+\partial^2_x y +Q(y)$$ $y(t,0)=y(t,1)$ and $\partial_xy(t,0)=\partial_xy(t,1)$. Here $M_1, M_2$ are $4 \times 4$ matrices, and $Q$ is the nonlinearity. How can such a system be solved numerically?

Here is my particular example:

e = 0.1;
k = -4.47675;
eqns = {D[y1[t, x], {t, 1}] + k/Pi * D[y1[t, x], {x, 1}] + y3[t, x] +
  y4[t, x] - e*(k/(2*Pi)^2)*D[y1[t, x], {x, 2}] + 
 y1[t, x]*y1[t, x] == 0,

D[y2[t, x], {t, 1}] + k/(2*Pi)* D[y2[t, x], {x, 1}] - y3[t, x] - 
  e*(k/(2*Pi)^2)*D[y2[t, x], {x, 2}] - y1[t, x]*y1[t, x] == 0,

D[y3[t, x], {t, 1}] - k/Pi*D[y3[t, x], {x, 1}] + y1[t, x] + 
  y3[t, x] - e*(k/(2*Pi)^2)*D[y3[t, x], {x, 2}] + 
  y3[t, x]*y3[t, x] == 0,

D[y4[t, x], {t, 1}] - k/(2*Pi)* D[y4[t, x], {x, 1}] - y1[t, x] - 
  2*y4[t, x] - e*(k/(2*Pi)^2)*D[y4[t, x], {x, 2}] - 
  y3[t, x]*y3[t, x] == 0,

y1[t, 0] == y1[t, 1], y2[t, 0] == y2[t, 1], y3[t, 0] == y3[t, 1], 
y4[t, 0] == y4[t, 1],

D[y1[t, x], {x, 1}][t, 0] == D[y1[t, x], {x, 1}][t, 1], 
D[y2[t, x], {x, 1}][t, 0] == D[y2[t, x], {x, 1}][t, 1],
D[y3[t, x], {x, 1}][t, 0] == D[y3[t, x], {x, 1}][t, 1], 
D[y4[t, x], {x, 1}][t, 0] == D[y4[t, x], {x, 1}][t, 1]};

Then I try NDSolve but it doesn't work. (Sorry if this is a trivial question I am new to Mathematica). Thank you!

NDSolve[eqns, {y1, y2, y3, y4}, {t, -1, 1}, {x, 0, 1}]
$\endgroup$
  • $\begingroup$ I think you want (D[y1[t, x], {x, 1}] /. x -> 0) instead of D[y1[t, x], {x, 1}][t, 0] Try that and see if it gives you things in the correct form. Even making all those changes it still isn't happy with your giving initial conditions of "these two edges are equal" instead of "this edge equals this constant." $\endgroup$ – Bill Feb 3 '16 at 7:21
3
$\begingroup$

NDSolve as used in the question has too many boundary conditions in x and none in t. (One periodic boundary condition in x for each dependent variable fully meets the need for boundary conditions in that dimension.) Not knowing what boundary conditions are desired in t, I made some up.

e = 0.1;
k = -4.47675;
eqns = {D[y1[t, x], {t, 1}] + k/Pi * D[y1[t, x], {x, 1}] + y3[t, x] +
  y4[t, x] - e*(k/(2*Pi)^2)*D[y1[t, x], {x, 2}] + y1[t, x]*y1[t, x] == 0,

D[y2[t, x], {t, 1}] + k/(2*Pi)* D[y2[t, x], {x, 1}] - y3[t, x] - 
  e*(k/(2*Pi)^2)*D[y2[t, x], {x, 2}] - y1[t, x]*y1[t, x] == 0,

D[y3[t, x], {t, 1}] - k/Pi*D[y3[t, x], {x, 1}] + y1[t, x] + 
  y3[t, x] - e*(k/(2*Pi)^2)*D[y3[t, x], {x, 2}] + y3[t, x]*y3[t, x] == 0,

D[y4[t, x], {t, 1}] - k/(2*Pi)* D[y4[t, x], {x, 1}] - y1[t, x] - 
  2*y4[t, x] - e*(k/(2*Pi)^2)*D[y4[t, x], {x, 2}] - y3[t, x]*y3[t, x] == 0,

y1[t, 0] == y1[t, 1], y2[t, 0] == y2[t, 1], y3[t, 0] == y3[t, 1], y4[t, 0] == y4[t, 1],

y1[-1, x] == .01, y2[-1, x] == .01, y3[-1, x] == .01, y4[-1, x] == .01};

sol = NDSolve[eqns, {y1, y2, y3, y4}, {t, -1, 1}, {x, 0, 1}];

A plot of y1 is

Plot3D[y1[t, x] /. sol, {t, -1, 1}, {x, 0, 1}, AxesLabel -> {t, x, y}]

enter image description here

Unless the initial conditions in t depend on x, the problem is effectively one-dimensional, and all four curves can conveniently be plotted together.

Plot[Evaluate[{y1[t, .5], y2[t, .5], y3[t, .5], y4[t, .5]} /. sol], {t, -1, 1},
    AxesLabel -> {t, y}, PlotRange -> All]

enter image description here

Note that the solution rapidly becomes very large for initial conditions larger than about 0.1, preventing NDSolve from reaching t = 1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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