Good evening everybody!
There's a problem I dealt with some time ago. I tried to find numerical solution of PDE (and managed) and then tried to draw a graph of an energy, that may be represented as a triple integral of a solution of this PDE (see the code below). Everything was OK, but after I'd compiled my programm, there existed a strange problem: the programm stopped to work and the graph of energy wasn't drawn. I'd be very grateful to you, if you show me where I had a mistake and whether it's possible to correct it and improve the code.
Thanks beforehand.
Clear[A, sol, x, y, z, t, R, V, v1, v2, E1, x1, y1, z1];
R = 1000;
V = 0.1;
sol = NDSolve[{D[A[t, x, y, z], t] +
V*Sin[z]*Exp[-z/R]*D[A[t, x, y, z], x] == (1/R)*
D[A[t, x, y, z], z, z], A[0, x, y, z] == Sin[x] + Sin[y],
A[t, 0, y, z] == A[t, 2*Pi, y, z],
A[t, x, 0, z] == A[t, x, 2*Pi, z]},
A, {t, 0, 10}, {x, 0, 2*Pi}, {y, 0, 2*Pi}, {z, 0,
2*Pi}];
nsol = Evaluate[A[t, x, y, z] /. sol][[1, 0]];
v1[t_, x_, y_, z_] :=
Exp[-t/R]*(V*Sin[z] - (D[nsol[x, y1, z, t], y1] /. y1 -> y));
v2[t_, x_, y_, z_] :=
Exp[-t/R]*(D[nsol[x1, y, z, t], x1] /. x1 -> x);
E1[t_] := -(1/R)*
NIntegrate[(D[v1[t, x, y, z1], z1] /.
z1 -> z)^2 + (D[v2[t, x, y, z1], z1] /. z1 -> z)^2, {x, 0,
2*Pi}, {y, 0, 2*Pi}, {z, 0, 2*Pi}];
Plot[E1[t], {t, 0, 10}]