I'm having a difficulty to NDSolve
a ODE due to the dimensions problem (according to the error message). Below is the code I have.
First of all are functions:
otime = 0; nzone = 5; iex = 6;T0 = 293.15;hd=150;
lj={6, 12, 18, 24, 29.5};
tmax={35.4, 17.7, 8.85, 5.9, 4.425, 3.97753};
webSpeed={5/6, 5/3, 10/3, 5, 20/3, 89/12};
TE={{383, 393, 403, 413, 298}, {383, 393, 403, 413, 298}, {383, 393, 403,413, 298}, {383, 393, 403, 413, 298}, {383, 393, 403, 413,298}, {383, 393, 403, 413,298}};
TA[t_, ie_] := If[t <= otime,T0,For[i = 1, i <= nzone, i++,If[t - otime <lj[[i]]/webSpeed[[ie]], Return[TE[[ie, i]]]]]]
VE={{36, 36, 36, 36, 36}, {36, 36, 36, 36, 36}, {36, 36, 36, 36,36}, {36, 36,36, 36, 36}, {36, 36, 36, 36, 36}, {36, 36, 36, 36,36}};
hi[ie_, i_] := (VE[[ie, i]]/36)^0.8 hd (293/TE[[ie, i]])^(2/3);
htc[t_, ie_]:= If[t <= otime, 0,For[i = 1, i <= nzone, i++,If[t - otime <lj[[i]]/webSpeed[[ie]], Return[hi[ie, i]]]]]
Then is the NDSolve
equation:
NDSolve[{T'[t] == htc[t, iex] (TA[t, iex] - T[t]), T[0] == T0}, T, {t, 0, tmax[[iex]]}]
The ultimate goal is to NDSolve
the ODE above by varying the index iex
from 1, 2, 3, ..., iex
But first of all I need to make sure the NDSolve
can work! Below is the error message:
NDSolve::nlnum: "The function value {0.0128667 Return[125.469] (-293.15+Return[383])} is not a list of numbers with dimensions {1} at {t,T[t]} = {8.9003*10^-308,293.15}."
Any suggestions would be greatly appreciated!!
Return
. Did you try removing it? $\endgroup$