1
$\begingroup$

I am trying to find the numerical solution for the nonlinear, first-order, nonhomogeneous ODE shown below.

q := 4835
As := 3.08*10^-4
h := 50
S := 5.6703*10^-8
e := .04
p := 630
Vc := 3514
Temp := 477 
NDSolve[{(q - (h*(T[t] - Temp) + e*S*((T[t])^4 - Temp^4))*As) ==  p*Vc*T'[t], T[0] == 274}, T, {t, 0, 100}]

But I keep getting the error "NDSolve: Encountered non-numerical value for a derivative at t == 0.`"

This ODE is the lumped capacitance method in heat transfer, so I know there needs to be a numerical solution. Any thoughts as to the issue?

Thanks.

$\endgroup$
2
  • $\begingroup$ Adding Quit [] solved the issue of getting the NDSolve to work. However, I cannot plot the solution. Typing 'Plot[T[t] /. sltn, {t, 0, 100}, PlotRange -> {{0, 100}, {0, 300}}]' give me the following errors: ReplaceAll::reps: {sltn} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. General::stop: Further output of ReplaceAll::reps will be suppressed during this calculation. $\endgroup$
    – Lane
    Mar 4, 2022 at 3:42
  • $\begingroup$ Welcome to Mathematica SE. To get started:1) take the introductory tour now,2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge,3) remember to accept the answer, if any, that solves your problem, by clicking checkmark sign,4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – user49048
    Mar 4, 2022 at 3:56

2 Answers 2

0
$\begingroup$

The following works fine and produces a nice plot.

q := 4835
As := 3.08*10^-4
h := 50
S := 5.6703*10^-8
e := .04
p := 630
Vc := 3514
Temp := 477
sltn = NDSolve[{(q - (h*(T[t] - Temp) + e*S*((T[t])^4 - Temp^4))*
        As) == p*Vc*T'[t], T[0] == 274}, T, {t, 0, 100}];
Plot[T[t] /. sltn, {t, 0, 100}, PlotRange -> {{0, 100}, {0, 300}}]

enter image description here

$\endgroup$
0
$\begingroup$

Let me give you some hints.

{q = 4835, As = 3.08*10^-4, h = 50, S = 5.6703*10^-8, e = .04, 
 p = 630, Vc = 3514, Temp = 477};

eqs = {(q - (h*(T[t] - Temp) + e*S*((T[t])^4 - Temp^4))*As) == 
       p*Vc*T'[t], T[0] == 274} // Simplify

(*   {0.0154 T[t] + 6.98581*10^-13 T[t]^4 + 2.21382*10^6 Derivative[1][T][t] == 4842.38, 
      T[0] == 274}   *)

You see, the T[t]^4 term is more than 10 magnitudes smaller than any other term. If you rationalize to 10^-12, which is much more accurate than the accuracy of given parameters, the T[t]^4 term disappears and you can solve with DSolve. Regard the very small difference compared to strict numerical solutions Tnsol (which also is restricted due to limited accuracy of parameters).

eqsrat = eqs // Rationalize[#, 10^-12] &

(*   {(77 T[t])/5000 + 2213820 Derivative[1][T][t] == 4126973296/852261, 
      T[0] == 274}   *)

Tdsol = T /. Flatten@DSolve[eqsrat, T, t]

    (*   Function[{t}, 
    (2 E^(-11 t/1581300000) (-10308442738711 + 
    10317433240000 E^(11 t/1581300000)))/65624097]   *)

Tnsol = T /. 
   Flatten@NDSolve[eqs, T, {t, 0, 100}, InterpolationOrder -> All]

Plot[{Tnsol[t] - Tdsol[t]}, {t, 0, 100}]

Difference in magnitude of 10^-7.

Solutions are very close to linear. ( numerical solution restricted too by limited order of interpolation polynom)

Series[Tdsol[t], {t, 0, 6}]//Normal// N[#, 6] &



    (*  274.000 + 0.00218544 t - 7.60128*10^-12 t^2 + 1.76256*10^-20 t^3 - 
 3.06522*10^-29 t^4 + 4.26452*10^-38 t^5 - 4.94422*10^-47 t^6   *)

Series[Tnsol[t], {t, 0, 6}]//Normal

(*   274. + 0.00218543 t   *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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