Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Could someone else verify that an example from the Numerical

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127319] Re: Could someone else verify that an example from the Numerical
  • From: Roland Franzius <roland.franzius at uos.de>
  • Date: Sun, 15 Jul 2012 23:43:57 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <jttv31$gut$1@smc.vnet.net>

Am 15.07.2012 10:30, schrieb W Craig Carter:
> I am looking at the example on page 348 of the tutorial for a numerical solution to the Sine-Gordon equation.
> (http://www.wolfram.com/learningcenter/tutorialcollection/AdvancedNumericalDifferentialEquationSolvingInMathematica/).
> It doesn't work for me for M8.0.4, MacBook, MacOs 10.7.4. Can someone else verify that this doesn't work?
>
> Here is the example:
>
> L = 10; (*the tutorial has L=-10, but I think that is a typo. In any case, the example doesn't work with + or - *)
>
> state = First[NDSolve`ProcessEquations[{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[0, x, y] == Exp[-(x^2 + y^2)],
>      Derivative[1, 0, 0][u][0, x, y] == 0,
>      u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L]}, u,
>     t, {x, -L, L},
>     {y, -L, L},
>     Method ->  {"MethodOfLines",
>       "SpatialDiscretization" ->  {"TensorProductGrid",
>         "DifferenceOrder" ->  "Pseudospectral"}}]]
>
> GraphicsGrid[Partition[Table[
>     NDSolve`Iterate[state, tau];
>     Plot3D[
>      Evaluate[
>       u[tau, x, y] /.
>        NDSolve`ProcessSolutions[state, "Forward"]], {x, -L, L}, {y, -L,
>        L}, PlotRange ->  {-1/4, 1/4}],
>     {tau, 0, 20, 5}], 2]]


The graphics constructs have changed in vs8 and I encounter an internal 
error in the replacement procedure above resulting in empty solution 
lists except the last element.

Consider the following alternative

(* you can skip the << lines *)
<<"DifferentialEquations`NDSolveProblems`";
<<"DifferentialEquations`NDSolveUtilities`";
<<"FunctionApproximations`";

L=10;

state=First@NDSolve`ProcessEquations[
{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[0,x,y]==Exp[-(x^2+y^2)],
Derivative[1,0,0]u][0,x,y]==0,
u[t,-L,y]==u[t,L,y],
u[t,x,-L]==u[t,x,L]},
u,t,{x,-L,L},{y,-L,L},
Method->{
"MethodOfLines",
"SpatialDiscretization"->{"TensorProductGrid","DifferenceOrder"®"Pseudospectral"}}]

Generate the time table of the interpolation functions of solutions and 
time derivatives

pl=Flatten@Table[(NDSolve`Iterate[state,t];NDSolve`ProcessSolutions[state,"Forward"]),{t,0.0,1.0,0.25} 
]

Map the Plot3D into table of solutions u

Partition[Plot3D[#,{x,-10,10},{y,-10,10}]&/@
(Table[u[t,x,y],{t,0,1,0.25}]/.pl),2]



Hope it helps

-- 

Roland Franzius



  • Prev by Date: Re: Could someone else verify that an example from the
  • Next by Date: IsoWeek Function
  • Previous by thread: Re: Could someone else verify that an example from the
  • Next by thread: Re: Could someone else verify that an example from the Numerical