I would appreciate some help with following issue:
I am trying to solve a 1D transient heat equation problem with a control loop in order to compensate a time variable boundary condition at one extremity, so that the temperature at the other extremity stays stable around 25.
$u(t,x)$ obeys to following PDE on a x-line from 0 to 10:
$u^{(0,1)}(x,t)=u^{(2,0)}(x,t)+ \operatorname{compensator}(t)$,
with:
Initial condition: $u(0,x)=25$
Boundary conditions: $u(t,0)=25+ 3 \sin \left(\frac{t}{50}\right)$ and $u^{(0,1)}(t,10)=0$
the compensator is the output from a P-controller: $\operatorname{compensator}(t)=-0.05(u(t, 10) - 25)$
If that works, I would then like to try with a PI or PID-controller.
Here is the code I have tried in Mathematica 11 (just replace 0 by 1 before 0.05 to activate the controller and get the error):
sol = NDSolveValue[{D[u[t, x], t] == 0.5*D[u[t, x], x, x] - 0*0.05*(u[t, 10] - 25),
u[0, x] == 25,
u[t, 0] == 25 + 3*Sin[t/50],
(D[u[t, x], x] /. x -> 10) == 0},
u,{t, 0, 1000}, {x, 0, 10}]
{Plot3D[sol[t, x], {t, 0, 1000}, {x, 0, 10}, PlotRange -> All,
AxesLabel -> {"Time", "x"}, PlotLegends -> {"usol(t,x)"}, PlotTheme ->"Detailed",ImageSize -> 300],
Plot[Evaluate[sol[t, x] /. x -> {0, 10}, {t, 0, 1000}],ImageSize -> 300, PlotLegends -> Table[Style[StringJoin["x=", ToString[i]],
FontSize -> 12, FontFamily -> "Cambria Math"], {i, {0, 10}}],
PlotStyle -> Table[RGBColor[0.1, j, 0.5], {j, 0, 1, 1/2}], PlotTheme ->"Detailed",
PlotRange -> All, FrameLabel -> {Style["Time", 12, FontFamily -> "Cambria Math"]}]}
NDSolve
is just moody today.... $\endgroup$