~ Heat conduction partial differential equation Explicit method from Carnahan, Luther & Wilkes, "Applied Numerical Methods", Wiley, 1969, p. 432 Programmed by Victor Bloomfield (victor@biosci.cbs.umn.edu) 11/11/96 ~ --Heat conduction in a rod of length L with ends held at --T_1 and T_2 and initial internal temperature T_in --Reduced time tau=a*t/L^2, a=thermal diffusivity k/(rho*cp) --Reduced position = x/L --To calculate T(x,t) from the heat conduction equation in --reduced coordinates: dT/dt = d^2 T/ dx^2. T_in=70; T_1=70; T_2=0 nx=13 -- number of spatial grid points, including ends dx=1/(nx-1) -- length step in reduced length units x/L tmax=.5 -- in reduced time units nt=201 -- number of time steps dt=tmax/(nt-1) -- time step in reduced units r=dt/(dx)^2; r:0.360; -- lambda in Carnahan et al (should be 2.5 for convergence) --Set up T matrix, including initial condition T=T_in everywhere zeros2[i,j] = T_in dim[nx,nt] T:=zeros2: --Boundary conditions T1:=T_1[:nt]:; T2:=T_2[:nt]: k:=1,(T[1,k]:=T1[k],T[nx,k]:=T2[k],k:=k+1) while k<=nt: --Step through grid k:=2, ((i:=2, (T[i,k]:=r*T[i-1,k-1]+(1-2*r)*T[i,k-1]+r*T[i+1,k-1], i:=i+1) while i