MathGroup Archive 2013

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

Search the Archive

Re: Using NDSolve solution as an initial condition for another

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129648] Re: Using NDSolve solution as an initial condition for another
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Sat, 2 Feb 2013 01:17:47 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Hi,

I have a PDE that I've solved numerically, but now I need to use that solution as an initial condition for another PDE. Is there a way I can do this?

Thank you,
Teresa

Hi, Teresa,

It seems to be rather straightforward. The only question is that you need to take care of the boundary conditions of the second equation that in general may be in conflict with the solution of the first equation.
If this represents no problem in your case, you may do as I did below. I took two equation from the Examples Section of the Menu/Help/NDSolve:

This is the solution of the first equation for the function u=u(t,x):

s = NDSolve[{D[u[t, x], t] == D[u[t, x], x, x] + Cos[x - t],
    u[0, x] == Sin[2 \[Pi]*x/5], u[t, 0] == 0, u[t, 5] == 0},
   u, {t, 0, 2 \[Pi]}, {x, 0, 5}][[1, 1]]

Evaluate it and have a look here:

Plot3D[Evaluate[u[t, x] /. s], {t, 0, 2 \[Pi]}, {x, 0, 5},
 PlotRange -> All]

The second equation is for the function v=v(t,x). Its initial condition is

v[0,x]==u[10, x] /. s

This is the plot of the initial condition for the second equation:

Plot[Evaluate[u[2 \[Pi], x] /. s], {x, 0, 5}]

The solution takes the following form:

ss = NDSolve[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(\[Tau]\)]\(v[\[Tau], x]\)\) == \!\(
\*SubscriptBox[\(\[PartialD]\), \(x, x\)]\(v[\[Tau], x]\)\),
   v[0, x] == Evaluate[u[2 \[Pi], x] /. s], v[\[Tau], 0] == 0,
   v[\[Tau], 5] == 0}, v, {\[Tau], 0, 10}, {x, 0, 5}]

Have a look at the solution here:

Plot3D[Evaluate[v[t, x] /. ss], {t, 0, 10}, {x, 0, 5},
 PlotRange -> All]

Have fun, Alexei



Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Integrate bug in v 9.0.0
  • Next by Date: Labelling each curve and changing grid in ParametricPlot
  • Previous by thread: Re: Integrate bug in v 9.0.0
  • Next by thread: Labelling each curve and changing grid in ParametricPlot