# NDsolve with ODE-PDE

Kindly I hope to know what is the wrong here. How to use NDsolve for a coupled ODE-PDE differential equations

NDSolve[{F''[t]+F[t]==0,
F==0,F'[3*Pi]==1,D[u[t,x],t]==D[u[t,x],x,x],u[0,x]==0,u[t,0]==5*F[t],u[t,5]==0},
{F,u},{t,0,3*Pi},{x,0,5}];


I have received the following messages

Function::fpct: Too many parameters in {t,x} to be filled from Function[{t,x},0][t].

NDSolve::ndode: The equations {(F^[Prime])[3 [Pi]]==1,F[t]+(F^[Prime][Prime])[t]==0} are not differential equations or initial conditions in the dependent variables {u}.

• Functions must be defined in the whole area {t,0,3*Pi},{x,0,5}. It is necessary to separate the ODE from the PDE. Or calculate the function F[t,x], but then the problem loses its meaning – Alex Trounev Jan 15 '19 at 12:23
• Many thanks for your reply. But I want to solve them simultaneously. How I can do that – Esza Jan 15 '19 at 17:38

You can solve for F and use that solution to solve for u:

solF = NDSolve[{F''[t] + F[t] == 0, F == 0, F'[3*Pi] == 1}, {F}, {t, 0, 3*Pi}][];
ff = F /. solF;
Plot[ff[t], {t, 0, 3*Pi}, AxesLabel -> {"t", "F[t]"}] solu = NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0,
u[t, 0] == 5*ff[t], u[t, 5] == 0}, {u}, {t, 0, 3*Pi}, {x, 0, 5}][[1, 1]];
Plot3D[Evaluate[u[t, x] /. solu], {t, 0, 3*Pi}, {x, 0, 5},
AxesLabel -> {"t", "x", "u[t,x]"}] • Many thanks for your reply. But I want to solve them simultaneously. How I can do that? – Esza Jan 15 '19 at 17:38

To solve the equations jointly, we need to define the problem so that there is a Cauchy problem. I will propose the option that the solution of the system of equations coincides with that obtained by another method by @kglr

sol = NDSolve[{D[F[t, x], t, t] + F[t, x] == D[F[t, x], x, x],
F[0, x] == 0, Derivative[1, 0][F][0, x] == -1,
Derivative[0, 1][F][t, 0] == 0, Derivative[0, 1][F][t, 5] == 0,
D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0,
u[t, 0] == 5*F[t, 0], u[t, 5] == 0}, {F, u}, {t, 0, 3*Pi}, {x, 0,
5}];

{Plot3D[F[t, x] /. sol, {t, 0, 3*Pi}, {x, 0, 5},
AxesLabel -> Automatic, PlotLabel -> "F"],
Plot3D[u[t, x] /. sol, {t, 0, 3*Pi}, {x, 0, 5},
AxesLabel -> Automatic, PlotLabel -> "u"]} 