Here is my thoughts based on MethodOfLines
introduced here:
We first create $2M$ equidistant grid points $x_m=(m-M)h$ with $m=1,2,...,2M$.
The x-position of grid points is stored in xtab
:
M = 10; L = 10; h = L/M;
xtab = Table[(m - M) h, {m, 1, 2*M}]
Then we should discretize the solution of PDE along $x$ into $2M$ solutions of a set of coupled ODEs. u[m][t]
denotes the solution of function $u(x,t)$ at point $x_m$. Here, I didn't include the left end-point, since it can be set to be u[0][t]=u[2*M][t]
according to the periodicity.
U[t_] = Table[u[m][t], {m, 1, 2*M}];
The spatial derivatives are discretized using 2nd-order central differences, here the periodic condition should be applied:
1st-derivative wrt x
:
internaldUdx = ListCorrelate[{-1, 0, 1}/(2 h), U[t]];
dUdx = Join[{(u[1][t] - u[2*M - 1][t])/(2 h)},
internaldUdx, {(u[1][t] - u[2*M - 1][t])/(2 h)}];
2nd-derivative wrt x
:
internaldUdxx = ListCorrelate[{1, -2, 1}/h^2, U[t]];
dUdxx = Join[{(u[2*M - 1][t] - 2 u[2*M][t] + u[1][t])/h^2},
internaldUdxx, {(u[2*M - 1][t] - 2 u[2*M][t] + u[1][t])/h^2}];
3rd-derivative wrt x
:
internaldUdxxx = ListCorrelate[{-1, 2, 0, -2, 1}/(2 h^3), U[t]];
dUdxxx = Join[{(-u[2*M - 2][t] + 2 u[2*M - 1][t] - 2 u[1][t] +
u[2][t])/(2 h^3), (-u[2*M - 1][t] + 2 u[2*M][t] - 2 u[2][t] + u[3][t])/(
2 h^3)}, internaldUdxxx, {(-u[2*M - 3][t] + 2*u[2*M - 2][t] - 2 u[2*M][t] +
u[1][t])/(2 h^3), (-u[2*M - 2][t] + 2 u[2*M - 1][t] - 2 u[1][t] + u[2][t])/(2 h^3)}];
4th-derivative wrt x
:
internaldUdxxxx = ListCorrelate[{1, -4, 6, -4, 1}/h^4, U[t]];
dUdxxxx = Join[{(u[2*M - 2][t] - 4*u[2*M - 1][t] + 6*u[2*M][t] - 4*u[1][t] +
u[2][t])/h^4, (u[2*M - 1][t] - 4*u[2*M][t] + 6*u[1][t] - 4*u[2][t] + u[3][t])/h^4},
internaldUdxxxx,
{(u[2*M - 3][t] - 4*u[2*M - 2][t] + 6*u[2*M - 1][t] - 4*u[2*M][t] +
u[1][t])/h^4, (u[2*M - 2][t] - 4*u[2*M - 1][t] + 6*u[2*M][t] - 4 u[1][t] +
u[2][t])/h^4}]
To discretize the integral, we may introduce the mid-points $x_{m+1/2}=(x_m+x_{m+1})/2$ for $m=1,2,...,2M-1$ with $x_{1/2}=(-L+x_1)/2$, which are saved in midxtab
:
midxtab = Join[{(-L+(1-M) dx)/2}, Table[((m - M) dx + (m + 1 - M) dx)/2, {m, 1, 2*M-1}]];
I have trouble to discretized the integral.
usum = dUdxxx[t].Cot[...]*h;
After constructing the system of ODEs and the discrete initial condition:
eqns = Thread[D[U[t], t] == -U[t]*dUdx - dUdxx - dUdxxxx - 1/(2 L)*usum];
initc = Thread[U[0] == 0.1*Cos[\[Pi]/L*xtab]];
The original PDE should be solved numerically:
tmax = 2;
lines = NDSolveValue[{eqns, initc}, U[t], {t, 0, tmax}] // Flatten;