0

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?

xzczd
  • 299
  • 5
  • 20

2 Answers2

1

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).

acl
  • 6,490
  • 1
  • 27
  • 33
  • Er...do you mean what I should do is to turn to (maybe here I should say create? ) a new system of units to make the coefficient of the PDE simpler? It seems useless...: a = NDSolve[{D[tes[t, x], t] == D[tes[t, x], x, x], tes[t, 0] == 298 + 200/6.588910766757118` t, tes[t, 0.01/Sqrt[2.04988920646734`*^-6 ]] == 298, tes[0, x] == 298}, {tes[t, x]}, {t, 0, 0.005/6.588910766757118`}, {x, 0, 0.01/Sqrt[2.04988920646734`*^-6 ]}] Plot[(tes[t, x] /. a) /. t -> 0.0005/ 6.588910766757118`, {x, 0, 0.01/Sqrt[2.04988920646734`*^-6 ]}, PlotRange -> All] – xzczd Jul 29 '12 at 07:04
  • you probably should read about putting things in terms of dimensionless variables before doing numerics. – acl Jul 29 '12 at 12:06
  • Well…I'm sorry, my English isn't that good, maybe I just misunderstand you, but…I'm afraid I don't understand what you mean, in fact the numbers in the original equation (such as 2.04988920646734`*^-6)are all in terms of SI units, so…what's the meaning of putting the numbers in terms of dimensionless numbers? – xzczd Jul 29 '12 at 14:09
  • I wasn't being ironic, you really should read up about putting things in terms of dimensionless variables before doing numerics. This isn't the best place for me to explain that... – acl Jul 29 '12 at 15:18
  • Hehe…so…where's the "best place"? We can go there if you don't mind! – xzczd Jul 30 '12 at 09:41
  • Well, you're right, [that](http://mathematica.stackexchange.com/questions/9017/could-the-precisiongoal-for-ndsolve-be-a-negative-number/9018#comment25944_9018) is not the place to discuss it, so I'll comment here. I guess you considered my doubt as something refer to the absolute size(here it's 298) of temperature, right? But, in fact, what puzzles me is the relative size, i.e. the tes can't be smaller than the **initial and boundary condition**, I want to make some supplement with graphs, but my reputation is still under 10 here…@acl – xzczd Aug 03 '12 at 06:52
0

This problem has been solved here,

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

Community
  • 1
  • 1
xzczd
  • 299
  • 5
  • 20