Skip to main content
Replaced formal variables used in plotting with t and x for clarity.
Source Link
Tim Laska
  • 16.4k
  • 1
  • 35
  • 58

The following throws some inconsistency warnings, but appears to work (i.e., no obvious discontinuities at the seam). Also, I did not change the boundary condition, but I fed the final condition of the first solution to the "initial" condition of the second solution.

uif1 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, 
    u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}];
uif2 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], 
    u[10, x] == uif1[10, x], u[t, 0] == Sin[t], u[t, 5] == 0}, 
   u, {t, 10, 20}, {x, 0, 5}];
plt1 = Plot3D[
   uif1[\[FormalX]Plot3D[uif1[t, \[FormalY]]x], {\[FormalX]t, 0., 10.}, {\[FormalY]x, 
    0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}];
plt2 = Plot3D[
   uif2[\[FormalX]Plot3D[uif2[t, \[FormalY]]x], {\[FormalX]t, 10.`, 
    20.`}, {\[FormalY]x, 0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}, 
   PlotStyle -> RGBColor[0.22`, 1.`, 0.44`]];
Show[{plt1, plt2}]

Seamed Solutions

The following throws some inconsistency warnings, but appears to work (i.e., no obvious discontinuities at the seam). Also, I did not change the boundary condition, but I fed the final condition of the first solution to the "initial" condition of the second solution.

uif1 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, 
    u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}];
uif2 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], 
    u[10, x] == uif1[10, x], u[t, 0] == Sin[t], u[t, 5] == 0}, 
   u, {t, 10, 20}, {x, 0, 5}];
plt1 = Plot3D[
   uif1[\[FormalX], \[FormalY]], {\[FormalX], 0., 10.}, {\[FormalY], 
    0.`, 5.`}, PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}];
plt2 = Plot3D[
   uif2[\[FormalX], \[FormalY]], {\[FormalX], 10.`, 
    20.`}, {\[FormalY], 0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}, 
   PlotStyle -> RGBColor[0.22`, 1.`, 0.44`]];
Show[{plt1, plt2}]

Seamed Solutions

The following throws some inconsistency warnings, but appears to work (i.e., no obvious discontinuities at the seam). Also, I did not change the boundary condition, but I fed the final condition of the first solution to the "initial" condition of the second solution.

uif1 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, 
    u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}];
uif2 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], 
    u[10, x] == uif1[10, x], u[t, 0] == Sin[t], u[t, 5] == 0}, 
   u, {t, 10, 20}, {x, 0, 5}];
plt1 = Plot3D[uif1[t, x], {t, 0., 10.}, {x, 0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}];
plt2 = Plot3D[uif2[t, x], {t, 10.`, 20.`}, {x, 0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}, 
   PlotStyle -> RGBColor[0.22`, 1.`, 0.44`]];
Show[{plt1, plt2}]

Seamed Solutions

Source Link
Tim Laska
  • 16.4k
  • 1
  • 35
  • 58

The following throws some inconsistency warnings, but appears to work (i.e., no obvious discontinuities at the seam). Also, I did not change the boundary condition, but I fed the final condition of the first solution to the "initial" condition of the second solution.

uif1 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, 
    u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}];
uif2 = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], 
    u[10, x] == uif1[10, x], u[t, 0] == Sin[t], u[t, 5] == 0}, 
   u, {t, 10, 20}, {x, 0, 5}];
plt1 = Plot3D[
   uif1[\[FormalX], \[FormalY]], {\[FormalX], 0., 10.}, {\[FormalY], 
    0.`, 5.`}, PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}];
plt2 = Plot3D[
   uif2[\[FormalX], \[FormalY]], {\[FormalX], 10.`, 
    20.`}, {\[FormalY], 0.`, 5.`}, 
   PlotRange -> {{0, 20}, {0, 5}, {-1, 1}}, 
   PlotStyle -> RGBColor[0.22`, 1.`, 0.44`]];
Show[{plt1, plt2}]

Seamed Solutions