MathGroup Archive 2010

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

Search the Archive

Re: NDSolve grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113360] Re: NDSolve grid
  • From: schochet123 <schochet123 at gmail.com>
  • Date: Mon, 25 Oct 2010 06:40:56 -0400 (EDT)
  • References: <i9m83u$jhm$1@smc.vnet.net>

On Oct 20, 10:09 am, pratip <pratip.chakrabo... at gmail.com> wrote:

> 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?

I found the following trick in the source code of the NDSolveUtilities
package:

sol=NDSolve[whatever]

ifun=u /.sol[[1]] (* where u is the name of (one of ) the dependent
variable(s) *)
                      (* This should return an InterpolatingFunction
object *)

ifun["Coordinates"]
 (* returns list of lists of coordinates for each independent variable
*)
  (* e.g. {{t0,t1, ... tf},{x1,x2,...,xf}} *)

Steve


  • Prev by Date: Re: More Mathematica CAN'T do than CAN???
  • Next by Date: Re: More Mathematica CAN'T do than CAN???
  • Previous by thread: NDSolve grid
  • Next by thread: Interpolation undocumented error