In fact My problem is this $$\frac{\partial u}{\partial t}+\ \sin(y)\frac{\partial u}{\partial x}=\nu(\frac{\partial^2 u}{\partial x^2} +\frac{\partial^2 u}{\partial y^2})$$ But I wanted to test the method first to the heat equation and check if the L^2 norm of the solution behaves like this $$|u|_{L^2} =(\int_{-\pi}^{\pi} \int_{-\pi}^{\pi} u^2 dx dy)^{1/2} \leq e^{-\nu t}$$ Given that $$\frac{\partial u}{\partial t}=\nu\Bigl(\frac{\partial^2u}{\partial x^2}+\frac{\partial^2u}{\partial y^2}\Bigr)$$ With the following periodic boundary conditions: $$u(-\pi,y,t)=u(\pi,y,t) \\ u(x,-\pi,t)=u(x,\pi,t) \\u_x(-\pi,y,t)=u_x(\pi,y,t)\\ u_y(x,-\pi,t)=u_y(x,\pi,t)\\ u(x,y,0)=\sin(x)$$
I have tried to solve this using fourier collocation method in mathematica And then using NDSolve to solve the system of ODe.
n = 11;
ν = 1;
T = 100;
u[x_, y_, t_] := \!\(
\*UnderoverscriptBox[\(∑\), \(k = 0\), \(n - 1\)]\(
\*UnderoverscriptBox[\(∑\), \(l = 0\), \(n - 1\)]\(a[k, l]\)[t]*
EXP[I*k*x]*EXP[I*l*y]\)\);
R[x_, y_, t] =
D[u[x, y, t], t] - ν*(D[u[x, y, t], x, x] + D[u[x, y, t], y, y]);
{S1} = Table[
R[(2 πk)/n, (2 πl)/n, mT/n] == 0, {k, 1, n - 2}, {l, 1,
n - 2}, {m, 1, n - 1}];
S2 = Table[
u[(2 πk)/n, -π, t] == u[(2 πk)/n, π, t], {k, 1,
n - 2}];
S3 = Table[
D[u[(2 πk)/n, -π, t], y] ==
D[u[(2 πk)/n, π, t], y], {k, 1, n - 1}];[] ( {
{[Placeholder], [Placeholder]}
} )
S4 = Table[
u[-π, (2 πl)/n, t] == u[π, (2 πl)/n, t], {l, 1,
n - 2}];
S5 = Table[
D[u[-π, (2 πl)/n, t], x] ==
D[u[π, (2 πl)/n, t], x], {l, 1, n - 1}];
S6 = Table[u[(2 πk)/n, y, 0] == Sin[(2 πk)/n], {k, 1, n - 2}];
Sys = Join[S1, S2, S3, S4, S5, S6];
Dimensions[Sys];
I have a problem plotting the solution using NDSovle . And How to plot the L^2 norm of the solution ?
Edited
n = 11;
ν = 1;
T = 100;
u[x_, y_, t_] := \!\(
\*UnderoverscriptBox[\(∑\), \(k = 0\), \(n - 1\)]\(
\*UnderoverscriptBox[\(∑\), \(l = 0\), \(n - 1\)]\(a[k, l]\)[t]*
Exp[I*k*x]*Exp[I*l*y]\)\);
R[x_, y_, t] =
D[u[x, y, t], t] +
Sin[y]*D[u[x, , y, t],
x] - ν*(D[u[x, y, t], x, x] + D[u[x, y, t], y, y]);
S1 = Table[
R[(2 πk)/n, (2 πl)/n, t] == 0, {k, 1, n - 2}, {l, 1,
n - 2}];
S2 = Table[
u[(2 πk)/n, -π, t] == u[(2 πk)/n, π, t], {k, 1,
n - 2}];
S3 = Table[
D[u[(2 πk)/n, -π, t], y] ==
D[u[(2 πk)/n, π, t], y], {k, 1, n - 1}];
S4 = Table[
u[-π, (2 πl)/n, t] == u[π, (2 πl)/n, t], {l, 1,
n - 2}];
S5 = Table[
D[u[-π, (2 πl)/n, t], x] ==
D[u[π, (2 πl)/n, t], x], {l, 1, n - 1}];
S6 = Table[u[(2 πk)/n, y, 0] == Sin[(2 πk)/n], {k, 1, n - 2}];
Sys = Join[S1, S2, S3, S4, S5, S6];
Dimensions[Sys]







EXPbyExp. But I'd like to point out that this site is not a free debugging service. – Henrik Schumacher Jul 22 '19 at 19:53*between\[Pi]andl, otherwise Mathematica thinks it's a new symbol\[Pi]l. If you're new to Mathematica, check out this Q&A. – Chris K Jul 22 '19 at 20:33Clear[f]; D[f[1, y], x]. – xzczd Jul 23 '19 at 03:51{S1} = Table[....]work on your end and not generate an error? You should get anot the same shapeerror if you run the code. May be you meant justS1= Table[....]– Nasser Jul 23 '19 at 05:08