2
$\begingroup$

I'm having the following issue that can not find a solution , by using this boundary condition v[0, t] == u[1, t] that Mathematica does not understand, someone please help me!

NDSolve[{
        D[u[x, t], t] == D[u[x, t], x, x] - u[x, t],
        D[v[x, t], t] == D[v[x, t], x, x] - v[x, t],
        u[x, 0] == 1,
        v[x, 0] == 1,
        u[0, t] == 1,
        Derivative[1, 0][u][1, t] == 0,
        v[0, t] == u[1, t],
        Derivative[1, 0][v][1, t] == 0
        },
      {u[x, t], v[x, t]},
      {x, 0, 1},
      {t, 0, 5}]

I appreciate any help...

$\endgroup$
  • $\begingroup$ v[0, t] and u[1, t] could be anything compatible with the boundary conditions (for example 1 - t^n for any n). How could NDSolve[ ] guess what you want? $\endgroup$ – Dr. belisarius Aug 16 '15 at 6:28
  • $\begingroup$ Can you give us an idea as to what these two equations are trying to solve? Are they meant to be coupled somehow? The significance of the equation itself may allow for clues to help you. $\endgroup$ – dearN Aug 16 '15 at 11:30
  • $\begingroup$ Yes , they are to be coupled equations for the boundary conditions. Describe the transfer of heat between two different material plates. Thank you, any help. $\endgroup$ – Jeiveison Gobério Maia Aug 16 '15 at 16:28
2
$\begingroup$

NDSolve is complaining, because v[0, t] == u[1, t] appears to link boundary conditions at x == 0 and x == 1. This can be circumvented by redefining x as 1 - x for v, so that the code becomes,

{su, sv} = NDSolveValue[{
        D[u[x, t], t] == D[u[x, t], x, x] - u[x, t],
        D[v[x, t], t] == D[v[x, t], x, x] - v[x, t],
        u[x, 0] == 1, v[x, 0] == 1, u[0, t] == 1,
        Derivative[1, 0][u][1, t] == 0,
        v[1, t] == u[1, t],
        Derivative[1, 0][v][0, t] == 0},
        {u, v}, {x, 0, 1}, {t, 0, 5}];

The solutions for u[x, t] and v[1-x, t] can be spliced together and plotted by

Plot3D[Piecewise[{{su[x, t], x <= 1}, {sv[2 - x, t], x > 1}}], {x, 0, 2}, 
    {t, 0, 5}, PlotRange -> {All, All, {0, 1}}, AxesLabel -> {x, t, u : v}]

enter image description here

Note that, although the surface is continuous at x == 1, its derivative is not. Possibly, the boundary conditions there, as given in the Question, should be revised.

$\endgroup$
  • $\begingroup$ Thank you, but this is not an acceptable solution because the boundary condition for v at x = 1 has been modified. What precisely it is actually a way to write properly in Mathematica a jump condition. I am most grateful for the help so far and future! $\endgroup$ – Jeiveison Gobério Maia Aug 17 '15 at 5:19
  • $\begingroup$ @JeiveisonGobérioMaia Actually, I did not change the physical boundary condition for v at x == 1. Rather, I changed the definition of the first independent variable from x to 1 - x for v, did the computation, and changed it back again in the Plot3D. This redefinition has no impact of the differential equation itself, because it is second order in x, and its only effect on the boundary conditions is to change v[0, t] to v[1, t] and Derivative[1, 0][v][1, t] == 0 to Derivative[1, 0][v][0, t] == 0, which allows NDSolve to handle the calculation. $\endgroup$ – bbgodfrey Aug 17 '15 at 14:22
  • $\begingroup$ @JeiveisonGobérioMaia Your problem also can be solved with the procedure discussed in Introduction to Method of Lines but a lot more work is involved. See 78493 for another problem involving a non-local boundary condition. $\endgroup$ – bbgodfrey Aug 17 '15 at 14:35
  • $\begingroup$ Thank you.......................................... $\endgroup$ – Jeiveison Gobério Maia Aug 19 '15 at 19:06

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.