Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13334

Re: Using NDSolve solution as an initial condition for another

From Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Using NDSolve solution as an initial condition for another
Date 2013-02-02 06:15 +0000
Message-ID <keiaul$qqv$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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



Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Using NDSolve solution as an initial condition for another Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2013-02-02 06:15 +0000

csiph-web