I am trying to examine the results of and NDSolve solution for a BVP, and the output is not at all "pretty". Here's the code:
*d = .0005; (* diffusion coefficient (L^2/t *)
v = .0010; (* velocity (L/s) *)
r = 3.; (* depth of lower boundary condition *)
xmax = r/1.; (* maximum plotted value of x *)
NDSolve[
{
D[c[t, x], t] == d*D[c[t, x], x, x] - v*D[c[t, x], x],
c[0, x] == UnitStep[x - .002] - UnitStep[x - .15],
Derivative[0, 1][c][t, 0] == c[t, 0]*v/d,
c[t, r] == 0
},
c,
{t, 0, 50},
{x, 0, r}];
q = Evaluate[c[t, x] /. % ];
Table[{x, q}, {t, 50, 50}, {x, 0, r/2, .05}]
ContourPlot[q, {t, 0, 50}, {x, 0, xmax/5},
ColorFunction -> Hue,
Contours -> 20,
AspectRatio -> .75,
PlotPoints -> 25,
Axes -> True,
AxesLabel -> {"time", "distance"},
PlotLabel -> "Concentration"]
Plot3D[q, {t, 0, 50}, {x, 0, xmax}, PlotRange -> All]
There are two things I'd like to be able to change in the output:
The output by the
Tablecommand is one long line that wraps until it's done. I'd like to see two columns, one forxand one forq. The value ofqshould bet = 50, andxshould be the sequence{x, 0, r/2, .05}.I have been unsuccessful getting the
ContourPlotto print out a legend showing which colour represents what values of the dependent variableq[t,x].
Any suggestions will be greatly appreciated.
