MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

NDSolve grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113250] NDSolve grid
  • From: pratip <pratip.chakraborty at gmail.com>
  • Date: Wed, 20 Oct 2010 04:09:56 -0400 (EDT)

Dear Group,

Here is the code that tries to recover the data about the grid where a
PDE is solved in Mathematica.
{sol, steps} =
  Reap[NDSolve[{D[u[t, x, y], t, t] ==
      D[u[t, x, y], x, x] + D[u[t, x, y], y, y] + Sin[u[t, x, y]],
     u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L],
     u[0, x, y] == Exp[-(x^2 + y^2)],
     Derivative[1, 0, 0][u][0, x, y] == 0},
    u, {t, 0, L/2}, {x, -L, L}, {y, -L, L},
    StepMonitor :> Sow[{x, y}]]];

I want to see the 2D grid that NDSolve use to discretize the PDE. Is
it possible to do?
However the followimg example simply works.

{sol, steps} = Reap[NDSolve[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(t, t\)]\(u[t, x]\)\) == \!\(
\*SubscriptBox[\(\[PartialD]\), \(x, x\)]\(u[t, x]\)\) - Sin[u[t, x]],
      u[0, x] == E^-(x - 5)^2 + E^(-(x + 5)^2/2),
\!\(\*SuperscriptBox["u",
TagBox[
RowBox[{"(",
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[0, x] == 0, u[t, -50] == u[t, 50]},
    u, {t, 0, 40}, {x, -50, 50},
    StepMonitor :>
     Sow[ParametricPlot3D[{t, x, u[t, x]}, {x, -50, 50}]]]];
Show[steps, PlotRange -> All, BoxRatios -> {1, 1, 0.4}]

Any suggestions?

Pratip


  • Prev by Date: Re: ListAnimate
  • Next by Date: Re: Sin*Cos + Log
  • Previous by thread: Re: Why so slow and not getting faster
  • Next by thread: Re: NDSolve grid