Sunteți pe pagina 1din 7

475 4.

2: Heat Equation - Fixed-End Temperature Example: 80 cm


copper rod, with insulated lateral surface, left end fixed at 0 C,
right end fixed at 100 C.
Find Solution (a is length of rod; k is thermal diffusivity of copper; T0 and T1 are left and
right end temperatures, respectively; m is the maximum number of terms in the series
solution)
In[1]:=

a 80;
k 1.1;
T0 0;
T1 100;
m 25;

In[6]:=

fx_ : 20;

In[7]:=

gx_ : fx T0 T1 T0

x
;
a
nx

2
In[8]:=

Integrategx Sin

bn_ : Simplify

In[9]:=

bn Tablebn, n, 1, m

Out[9]=

In[10]:=

ux_, t_ :

120

100

100
,

40

50
,

24

100
,

120

25
,

, x, 0, a

40

20
,

120

50
,

120

3
7

11 3
13
8 25
120 100
120 10
40
100
120
25
24
, ,
,
,
,
,
,
,
,
,
,

7
2
17 9
19

7 11
23 3
5
T0 T1 T0

x
a

Sumbnn Sin

nx
a

Exp

n
a

k t, n, 1, m N

475HeatEquationExample2012.nb

In[11]:=

Out[11]=

Plot3DEvaluateux, t, x, 0, a, t, 0, 1000, AxesLabel x, t, "ux,t",


PlotRange All, PlotLabel "Fixed End Temperatures"

475HeatEquationExample2012.nb

Check convergence of "solution" u(x,t) as t (we are actually looking at a partial sum
approximating u(x,t)) - the blue curve is the steady-state
In[12]:=

Manipulate
PlotEvaluateux, t, T0 T1 T0

, x, 0, a, AxesLabel x, u, Frame True,


a
PlotStyle RGBColor1, 0, 0, RGBColor0, 0, 1, PlotRange 0, a, 0, 100,
x

PlotLabel StyleStringForm"t `1` sec", NumberFormt, 2, t, 0, 1000, 10

t = 0 sec
100

80

Out[12]=

60

40

20

0
0

20

40

60

80

Check convergence of Nth partial sum SN (x,5) as N increases - the blue curve is u(x,5)
In[13]:=

SM_, x_, t_ :
x
nx
n
T0 T1 T0
Sumbnn Sin
Exp
a
a
a

k t, n, 1, M N

475HeatEquationExample2012.nb

In[14]:=

ManipulatePlotEvaluateSM, x, 5, ux, 5, x, 0, a,
Frame True, PlotStyle RGBColor1, 0, 0, RGBColor0, 0, 1,
PlotRange 0, a, 30, 100,
PlotLabel StyleStringForm"t 5 sec; N `1` ", NumberFormM, 2,
M, 1, "N", 1, m, 1

t = 5 sec; N = 1
100

80

60
Out[14]=

40

20

0
-20
0

20

40

60

80

475HeatEquationExample2012.nb

Check convergence of Nth partial sum SN (65,t) as N increases - the blue curve is u(65,t)
In[15]:=

ManipulatePlotEvaluateSM, 65, t, u65, t, t, 0, 100,


Frame True, PlotStyle RGBColor1, 0, 0, RGBColor0, 0, 1,
PlotRange 0, 100, 30, 100,
PlotLabel StyleStringForm"x 65 cm; N `1` ", NumberFormM, 2,
M, 1, "N", 1, m, 1

x = 65 cm; N = 1
100

80

60
Out[15]=

40

20

0
-20
0

20

40

60

80

100

Check convergence of Nth partial sum SN (x,t) as N increases with a table of 3D plots - the
blue graphs are u(x,t)
In[16]:=

Out[16]=

TablePlot3DEvaluateSM, x, t, ux, t, x, 0, a,
t, 0, 1000, AxesLabel x, t, "ux,t", PlotRange All,
PlotLabel StyleStringForm"N `1` ", NumberFormM, 2,
PlotStyle RGBColor1, 0, 0, RGBColor0, 0, 1, M, 1, m

475HeatEquationExample2012.nb

475HeatEquationExample2012.nb

S-ar putea să vă placă și