I am stuck in an attempt to pass an interpolating function that was generated from a PDE solved using NDSolveValue to a second call to NDSolveValue for a solution to a simple ODE. Here is my code for what I thought would work:
(*First solve the PDE*)
Subscript\[t, cyc\] = 15; d = 0.8; c0 = 0.01;
ic := c\[x, 0\] == 0.01;
bc1 := c\[0, t\] == 0.1;
bc2 := NeumannValue\[0, x == d\];
ics := s\[x, 0\] == 0;
csat = 0.1; v = 0.1; Tamb = 30;
Tadsf := Tamb + 6*t;
\[CapitalOmega\] = Line\[{{0}, {d}}\];
pdec = D\[c\[x, t\], t\] ==
bc2 + v*c\[x, t\]/csat*Tadsf/Tamb*D\[c\[x, t\], {x, 2}\]
solc = First@
NDSolveValue\[{pdec, bc1, ic}, {c}, {t, 0, Subscript\[t, cyc\]},
x \[Element\] \[CapitalOmega\], AccuracyGoal -\> 10,
PrecisionGoal -\> 10\]
(*Compute time derivative*)
mdotc = D\[solc\[x, t\], t\]
(*This line integral is what I was wanting to use in an ODE for NDSolve*)
imdotc\[t\_?NumericQ\] :=
1/d\*NIntegrate\[mdotc, {x, 0, d}, MaxRecursion -\> 50,
Method -\> "LocalAdaptive"\]
(*If you plot it, the function looks fine*)
Plot\[imdotc\[t\], {t, 0, Subscript\[t, cyc\]}, PlotRange -\> Full,
AxesLabel -\> Automatic\]
(*But if passed into this simple ODE, NIntegrate fails with many error messages*)
icTads := Tads\[0\] == 30;
vair = 0.5; dH = 400;
ode := D\[Tads\[t\], t\] == -vair\*(Tads\[t\] - Tamb) + dH\*imdotc\[t\]
solT = NDSolveValue\[{ode, icTads}, Tads, {t, 0, Subscript\[t, cyc\]}\]
I am probably doing something simple wrong and would appreciate any help. I was able to get a solution for the ODE by using Integrate instead of NIntegrate for the imdotc function. With that running in NDSolve, NIntegrate convergence failures after 9 recursive bisections are reported but the solve completes and the solT[t] solution looks OK. Because there are no options to increase the MaxRecursion in Integrate, there is no way to fix this.
Any advice on a better way to approach this would be appreciated.