This is a very simple one-dimensional solid-phase heat conduction differential equation, here is my code:

 a = NDSolve[{D[721.7013888888889` 0.009129691127380562` tes[t, x], 
     t] == 2.04988920646734`*^-6 D[tes[t, x], x, x], 
   tes[t, 0] == 298 + 200 t, tes[t, 0.01] == 298, 
   tes[0, x] == 298}, {tes[t, x]}, {t, 0, 0.005}, {x, 0, 0.01}]
Plot3D[tes[t, x] /. a, {t, 0, 0.005}, {x, 0, 0.01}, PlotRange -> All]
(Plot[(tes[t, x] /. a) /. t -> 0.0005, {x, 0, 0.01}, 
  PlotRange -> All])

After you run it, you will see: the temperature (in the equation it's named as tes) is lower than 298! It's ridiculous, it's against the second law of thermodynamics…how does this error come out? How can I correct it?

2

There are 2 answers

0
xzczd On BEST ANSWER

This problem has been solved here,

I should admit that I haven't catch the nature yet at the time I posted this question…

6
acl On

I'll deal only with the numerical aspects of this. First, scale time and space so that your equation becomes $\partial_t f=\partial_{x,x}f$ in the dimensionless units. then, for instance,

a = NDSolve[{D[ tes[t, x], t] == D[tes[t, x], x, x], 
   tes[t, 0] \[Equal] 1,
   tes[t, 1] \[Equal] 1,
   tes[0, x] \[Equal] Cos[2 \[Pi]*x/2]^2},
  tes[t, x],
  {t, 0, 1},
  {x, 0, 1}
  ]

Plot3D[tes[t, x] /. a, {t, 0, .2}, {x, 0, 1}, PlotRange -> All, 
 AxesLabel \[Rule] {"t", "x"}]

Mathematica graphics

so heat just diffuses inwards (note I changed the boundary and initial conditions).