1
$\begingroup$

I am trying to plot the solution to the Dolve at a position /. x -> 0

Clear["Global`*"];
pde = D[u[x, t], t] == d*D[u[x, t], {x, 2}] + c;
bc = {D[u[x, t], x] == 0 /. x -> 0, u[L, t] == 0};
ic = u[x, 0] == 0.8*2800*9.8*(L - x);(*made up IC*)sol = 
 DSolve[{pde, ic, bc}, u[x, t], {x, t}];
sol = u[x, t] /. 
  First@Activate[sol /. {Infinity -> 10, K[1] -> n}]

Here is how to do it:

     Manipulate[Module[{pars, L0, x0}, {L0 = 3.5, x0 = 0.0};
  pars = {d -> d0, L -> L0, t -> t0, c -> c0};
  Quiet@Plot[
    Evaluate[sol/(0.8*2800*9.8*L0) /. pars  ] /. x -> 0, {t, 0, t0} , 
    PlotRange -> {Automatic, {0, 1.5}}, GridLines -> Automatic, 
    GridLinesStyle -> LightGray, PlotStyle -> Red, 
    AxesLabel -> {"t", "u(0,t)"}, BaseStyle -> 12]], {{d0, 0.01, "D"},
   0.001, 1, 0.001, Appearance -> "Labeled"}, {{c0, 0, "c"}, 0, 200, 
  0.01, Appearance -> "Labeled"}, {{t0, 1, "time"}, 0.1, maxTime, 0.1,
   Appearance -> "Labeled"}, {{maxTime, 1000}, None}, 
 TrackedSymbols :> {d0, c0, t0}]
$\endgroup$
1
$\begingroup$

Use SynchronousUpdating -> False

By default, Manipulate will time out if the contents take more than five seconds to evaluate

see https://reference.wolfram.com/language/ref/SynchronousUpdating.html

Then the error goes away. But your Plot takes too long the way it is. When it now eventually completes, there is no error, but I see nothing in there even when I change the slides. This is different issue.

I would suggest first make sure the plot is working OK outside Manipulate to test it. (use some values to test with)

$\endgroup$
2
  • $\begingroup$ I found a solution; see new edition $\endgroup$
    – Dave
    Dec 4 '21 at 3:46
  • $\begingroup$ @Dave Yes that is better. I was busy and did not have time to look to see why your code was slow to plot. I was just trying to fix the cause of the aborted message which you asked about. $\endgroup$
    – Nasser
    Dec 4 '21 at 9:35
0
$\begingroup$
Clear["Global`*"];
pde = D[u[x, t], t] == d*D[u[x, t], {x, 2}] + c;
bc = {D[u[x, t], x] == 0 /. x -> 0, u[L, t] == 0};
ic = u[x, 0] == 0.8*2800*9.8*(L - x);(*made up IC*)sol = 
 DSolve[{pde, ic, bc}, u[x, t], {x, t}];
sol = u[x, t] /. 
  First@Activate[sol /. {Infinity -> 10, K[1] -> n}](*/.x\[Rule]0*)
(*D[sol,t]*)

then

Manipulate[Module[{pars, L0, x0}, {L0 = 3.5, x0 = 0.0};
  pars = {d -> d0, L -> L0, t -> t0, c -> c0};
  Quiet@Plot[
    Evaluate[sol/(0.8*2800*9.8*L0) /. pars  ] /. x -> 0, {t, 0, t0} , 
    PlotRange -> {Automatic, {0, 1.5}}, GridLines -> Automatic, 
    GridLinesStyle -> LightGray, PlotStyle -> Red, 
    AxesLabel -> {"t", "u(0,t)"}, BaseStyle -> 12]], {{d0, 0.01, "D"},
   0.001, 1, 0.001, Appearance -> "Labeled"}, {{c0, 0, "c"}, 0, 200, 
  0.01, Appearance -> "Labeled"}, {{t0, 1, "time"}, 0.1, maxTime, 0.1,
   Appearance -> "Labeled"}, {{maxTime, 1000}, None}, 
 TrackedSymbols :> {d0, c0, t0}]
$\endgroup$

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.