Mathematica 2D Heat Equation Animation -
i'm working on mapping temperature gradient in 2 dimensions , having lot of trouble. current approach define interpolating function , try graph lot of times, animate table of graphs. here's have far:
rt = 388.726919 r = 1 func == ndsolve[{d[t[x, y, t], t] == rt*(d[t[x, y, t], x, x] + d[t[x, y, t], y, y]), t[x, y, 0] == 0, t[0, y, t] == r*t, t[9, y, t] == r*t, t[x, 0, t] == r*t, t[x, 9, t] == r*t}, t, {x, 0, 9}, {y, 0, 9}, {t, 0, 6}] so first 2 variables control rate of change. equation i'm solving basic 2d heat equation, dt/dt=a(d^2t/dx^2+d^2t/dy^2). initial conditions set 0, define edges source of heat change. right sweeps on 9x9 block t=0 t=6.
the second part attempts animate function working.
listanimate[ table[ densityplot[t[x, y, t] /. func, {x, 0, 9}, {y, 0, 9}, mesh -> 9] , {t, 0, 6}] ] unfortunately, doesn't work, , i'm going crazy trying figure out why. first thought had interpolating function i'm not confident animating code works either. have ideas?
just quick check:
rt = 1 r = 1 func = ndsolve[{d[t[x, y, t], t] == rt*(d[t[x, y, t], x, x] + d[t[x, y, t], y, y]), t[x, y, 0] == 0, t[0, y, t] == r*t, t[9, y, t] == r*t, t[x, 0, t] == r*t, t[x, 9, t] == r*t}, t, {x, 0, 9}, {y, 0, 9}, {t, 0, 6}]; = table[ plot3d[t[x, y, t] /. func, {x, 0, 9}, {y, 0, 9}, mesh -> 15, plotrange -> {{0, 9}, {0, 9}, {-1, 10}}, colorfunction -> function[{x, y, z}, hue[.3 (1 - z)]]], {t, 0, 6}] export["c:\anim.gif", a] 
ps: lot of mistakes avoided using lowercase letter first char symbols...
Comments
Post a Comment