Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Re: Using NDSolve solution as an initial condition for another
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Alexei Boulbitch

Posts: 483
Registered: 2/28/08
Re: Using NDSolve solution as an initial condition for another
Posted: Feb 2, 2013 1:15 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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,

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.
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@iee.lu

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2016. All Rights Reserved.