# Is it possible to solve a PDE in NDSolve for a simple functional PDE where the dependent variable is evaluated at a point?

Is it possible to configure NDSolve to approximate solutions of a PDE where the state variable is evaluated at a point? Mathematica detects such a PDE as a delay equation, but clearly all that is needed is for the internal function call to allow evaluation at a specified point for time stepping.

The following code block works perfectly

end = 20.0;
un = NDSolveValue[{D[u[s, x], s] == u[s, x] D[u[s, x], x, x] + 20.0,
DirichletCondition[u[s, x] == 0.0, x^2 == 0.1 || x^2 == 1],
u[0, x] == 0.0}, u, {s, 0, end}, {x, 0.1, 1.0}]
Plot[un[s, 0.5], {s, 0, end}, PlotRange -> All, Frame -> True]


But the desired case where the independent variable is evaluated at x=0.5 does not:

end = 20.0;
un = NDSolveValue[{D[u[s, x], s] == u[s, 0.5] D[u[s, x], x, x] + 20.0,
DirichletCondition[u[s, x] == 0.0, x^2 == 0.1 || x^2 == 1],
u[0, x] == 0.0}, u, {s, 0, end}, {x, 0.1, 1.0}]
Plot[un[s, 0.5], {s, 0, end}, PlotRange -> All, Frame -> True]


Of course, the PDE here is simply a toy example to illustrate the issue. Is there a (simple) fix?

• You simply can;t write u[s, 0.5] since 0.5 is not a variable. I think you knew this, I am not even sure what this all mean mathematically when you say to approximate solutions of a PDE where the state variable is evaluated at a point? but may be someone else could. It will help also if you could give reference to examples of what you mean. I never saw a PDE written like this before. – Nasser Jul 8 at 16:28
• The point is that the differential equation I wish to solve is not a PDE; it is a functional PDE because in the equation the state variable u is evaluated at a point (x=0.5) in its spatial variable. Mathematica does not seem to be set up to handle functional equations of this type. But, it is a simple functional equation. You could see what to do if you were writing your own code from scratch. My question is essentially to ask if a workaround exists so that NDSolve could be used to approximate solutions of this particular type of functional PDE. – Carmen Chicone Jul 8 at 20:53
• @CarmenChicone With using Mathematica we can handle this kind of problems. Do you need some code? – Alex Trounev Jul 8 at 23:58
• Some code would be welcome! You should of course answer the question for the benefit of all on this site by explaining your solution and providing a short revision of my code, or if you prefer a private communication send me an e-mail at chiconeC@missouri.edu. – Carmen Chicone Jul 9 at 1:13
• @CarmenChicone Do you have some theorem that solution of this kind of functional equation is unique? – Alex Trounev Jul 9 at 11:37

We can test the first pies of code and get a message

end = 20.0;
un = NDSolveValue[{D[u[s, x], s] == u[s, x] D[u[s, x], x, x] + 20.0,
DirichletCondition[u[s, x] == 0.0, x == 0.1 || x == 1],
u[0, x] == 0.0}, u, {s, 0, end}, {x, 0.1, 1.0}]

NDSolveValue::femcscd: The PDE is convection dominated and the result may not be stable. Adding artificial diffusion may help.


So it is not "works perfectly", it is not even stable result. Therefore we need to add some options to avoid instability. For future analysis it is suitable to extend solution on {x,0,1} since we spouse to use wavelets to solve the main problem

end = 20.0;
u0 = NDSolveValue[{D[u[s, x], s] == u[s, x] D[u[s, x], x, x] + 20.0,
u[s, 0] == 0.0, u[s, 1] == 0, u[0, x] == 0},
u, {s, 0, end}, {x, 0., 1.0},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"DifferenceOrder" -> "Pseudospectral"}}]


There are now messages for this code and solution looks like that The simplest way to solve functional equation is to use iterations:

end = 20.0; xm = 1/2; end = 20.0;
u0 = NDSolveValue[{D[u[s, x], s] == u[s, x] D[u[s, x], x, x] + 20.0,
u[s, 0] == 0.0, u[s, 1] == 0, u[0, x] == 0},
u, {s, 0, end}, {x, 0., 1.0},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"DifferenceOrder" -> "Pseudospectral"}}];
un[s_, x_] := u0[s, x]; un[-1][s_, x_] := u0[s, x]; n = 21;
Do[un[i] =
NDSolveValue[{D[u[s, x],
s] == .5 (un[i - 1][s, xm] + un[i - 2][s, xm]) D[u[s, x], x,
x] + 20.0, u[s, 0] == 0.0, u[s, 1] == 0, u[0, x] == 0},
u, {s, 0, end}, {x, 0., 1.0},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"DifferenceOrder" -> "Pseudospectral"}}];, {i, n}]


Solution converges fast with 21 iterations and looks like this

{Plot[Evaluate[Table[un[i][s, xm], {i, n - 5, n}]], {s, 0.1, end},
PlotLegends -> Automatic, PlotRange -> All],
DensityPlot[un[n][s, x], {s, 0, end}, {x, .0, 1}, PlotRange -> All,
ColorFunction -> "Rainbow", PlotLegends -> Automatic,
PlotPoints -> 50]} • Thanks Alex! I hoped there was a direct solution, perhaps by reformulating, so the problem could be solved by a single call to NDSolve, but your method is an excellent workaround. I will play with your suggested solution and try it on more complicated functional PDEs of the same type. – Carmen Chicone Jul 9 at 16:57
• @CarmenChicone You are welcome! Also I am interested in your complicated functional PDEs to apply my method with wavelets. – Alex Trounev Jul 9 at 17:05
• Let me suggest a problem of this type: Consider your previous post on a glass that is struck and its vibrations are measured. Suppose I wish to control the vibrations with a feed back loop where I put a sensor somewhere on the glass so it measures the strain in some direction at that point and I also have an actuator that can input a stress at some other point. The sensor output translates to some function of some values of the elastic deformation at the actuator attachment point, so in the closed loop the dynamical system is no longer a PDE but a functional PDE of the type I posed. – Carmen Chicone Jul 9 at 18:23
• @CarmenChicone I see that it is interesting approach to the natural system management. – Alex Trounev Jul 9 at 18:32