1
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Nasser Jul 8 at 16:28
  • $\begingroup$ 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. $\endgroup$ – Carmen Chicone Jul 8 at 20:53
  • 1
    $\begingroup$ @CarmenChicone With using Mathematica we can handle this kind of problems. Do you need some code? $\endgroup$ – Alex Trounev Jul 8 at 23:58
  • $\begingroup$ 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. $\endgroup$ – Carmen Chicone Jul 9 at 1:13
  • $\begingroup$ @CarmenChicone Do you have some theorem that solution of this kind of functional equation is unique? $\endgroup$ – Alex Trounev Jul 9 at 11:37
1
$\begingroup$

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
Figure 1

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[0][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]}

Figure 2

| improve this answer | |
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Carmen Chicone Jul 9 at 16:57
  • $\begingroup$ @CarmenChicone You are welcome! Also I am interested in your complicated functional PDEs to apply my method with wavelets. $\endgroup$ – Alex Trounev Jul 9 at 17:05
  • $\begingroup$ 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. $\endgroup$ – Carmen Chicone Jul 9 at 18:23
  • $\begingroup$ @CarmenChicone I see that it is interesting approach to the natural system management. $\endgroup$ – Alex Trounev Jul 9 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.